From ec21ccde12da6a5cc7143b533e0c707ebe5c1a3a Mon Sep 17 00:00:00 2001 From: Thomas Heller Date: Fri, 24 Apr 2009 20:00:41 +0000 Subject: Issue 5041: ctypes unwilling to allow pickling wide character. --- Lib/ctypes/test/test_pickling.py | 5 +++++ Misc/NEWS | 2 ++ Modules/_ctypes/_ctypes.c | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Lib/ctypes/test/test_pickling.py b/Lib/ctypes/test/test_pickling.py index c7925c7..28868f4 100644 --- a/Lib/ctypes/test/test_pickling.py +++ b/Lib/ctypes/test/test_pickling.py @@ -66,6 +66,11 @@ class PickleTest(unittest.TestCase): ]: self.assertRaises(ValueError, lambda: self.dumps(item)) + def test_wchar(self): + pickle.dumps(c_char("x")) + # Issue 5049 + pickle.dumps(c_wchar(u"x")) + class PickleTest_1(PickleTest): def dumps(self, item): return pickle.dumps(item, 1) diff --git a/Misc/NEWS b/Misc/NEWS index f5ef3b6..a8fb9ce 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -244,6 +244,8 @@ Core and Builtins Library ------- +- Issue #5041: ctypes does now allow pickling wide character. + - Issue #5812: For the two-argument form of the Fraction constructor, Fraction(m, n), m and n are permitted to be arbitrary Rational instances. diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 43da209..7caef29 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1952,7 +1952,7 @@ SimpleType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) ml = &c_void_p_method; stgdict->flags |= TYPEFLAG_ISPOINTER; break; - case 'u': + case 's': case 'X': case 'O': ml = NULL; -- cgit v0.12