]> granicus.if.org Git - python/commitdiff
Issue 5041: ctypes unwilling to allow pickling wide character.
authorThomas Heller <theller@ctypes.org>
Fri, 24 Apr 2009 20:00:41 +0000 (20:00 +0000)
committerThomas Heller <theller@ctypes.org>
Fri, 24 Apr 2009 20:00:41 +0000 (20:00 +0000)
Lib/ctypes/test/test_pickling.py
Misc/NEWS
Modules/_ctypes/_ctypes.c

index c7925c7ac783d2a951f49126f76a1b8fb5dbf956..28868f43d2abec8a5ca91b631782f5b36a3bb40c 100644 (file)
@@ -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)
index f5ef3b66ca2b55803762b65d0345e80066c41a45..a8fb9ceaaa32f7a5265c46fcb9012d7ebcf208ca 100644 (file)
--- 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.
index 43da2095cdfea6188bb06eab68d2de857ce4bb71..7caef2902d133c7a4f64753968930afda0e7a03a 100644 (file)
@@ -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;