summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/ctypes/test/test_pickling.py5
-rw-r--r--Misc/NEWS2
-rw-r--r--Modules/_ctypes/_ctypes.c2
3 files changed, 7 insertions, 2 deletions
diff --git a/Lib/ctypes/test/test_pickling.py b/Lib/ctypes/test/test_pickling.py
index 94a14b9..d88f08b 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(b"x"))
+ # Issue 5049
+ pickle.dumps(c_wchar("x"))
+
class PickleTest_1(PickleTest):
def dumps(self, item):
return pickle.dumps(item, 1)
diff --git a/Misc/NEWS b/Misc/NEWS
index 1898e17..ed1e401 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -430,7 +430,7 @@ Core and Builtins
Library
-------
-- Issue #5795: Fixed test_distutils failure on Debian ppc.
+- Issue #5041: ctypes does now allow pickling wide character.
- Issue #5607: fixed Distutils test_get_platform for Mac OS X fat binaries.
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 69a8c73..5fedba3 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -1927,7 +1927,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;