changeset 53364:00a927815dcd 2.6

Merged revisions 71847 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r71847 | thomas.heller | 2009-04-24 22:00:41 +0200 (Fr, 24 Apr 2009) | 2 lines Issue 5041: ctypes unwilling to allow pickling wide character. ........
author Thomas Heller <theller@ctypes.org>
date Fri, 24 Apr 2009 20:18:22 +0000
parents fa4f18ede260
children 642910a01d7f
files Lib/ctypes/test/test_pickling.py Misc/NEWS Modules/_ctypes/_ctypes.c
diffstat 3 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Lib/ctypes/test/test_pickling.py	Fri Apr 24 16:40:20 2009 +0000
+++ b/Lib/ctypes/test/test_pickling.py	Fri Apr 24 20:18:22 2009 +0000
@@ -66,6 +66,11 @@
             ]:
             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)
--- a/Misc/NEWS	Fri Apr 24 16:40:20 2009 +0000
+++ b/Misc/NEWS	Fri Apr 24 20:18:22 2009 +0000
@@ -17,9 +17,11 @@
 
 - Issue #5759: float() didn't call __float__ on str subclasses.
 
-Librar
+Library
 -------
 
+- Issue #5041: ctypes does now allow pickling wide character.
+
 - Issue #5768: Fixed bug in Unicode output logic and test case for same.
 
 - Issue #1161031: fix readwrite select flag handling: POLLPRI now
--- a/Modules/_ctypes/_ctypes.c	Fri Apr 24 16:40:20 2009 +0000
+++ b/Modules/_ctypes/_ctypes.c	Fri Apr 24 20:18:22 2009 +0000
@@ -1952,7 +1952,7 @@
 			ml = &c_void_p_method;
 			stgdict->flags |= TYPEFLAG_ISPOINTER;
 			break;
-		case 'u':
+		case 's':
 		case 'X':
 		case 'O':
 			ml = NULL;