]> granicus.if.org Git - python/commitdiff
Modify ctypes types with 'official' functions. Backport from trunk,
authorThomas Heller <theller@ctypes.org>
Sat, 18 Oct 2008 21:33:44 +0000 (21:33 +0000)
committerThomas Heller <theller@ctypes.org>
Sat, 18 Oct 2008 21:33:44 +0000 (21:33 +0000)
snv rev 59943 and 59946.

Misc/NEWS
Modules/_ctypes/_ctypes.c

index a492d461315142186200c1f4973f20509282779d..e62bb7cf6b1737d75da10d02b11c73a387a5096d 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -92,6 +92,9 @@ Core and builtins
 Library
 -------
 
+- Assigning methods to ctypes.Structure and ctypes.Union subclasses
+  after creation of the class does now work correctly.  See Issue #1700288.
+
 - Issue #3895: _lsprof could be crashed with an external timer that did not
   return a float when a Profiler object is garbage collected.
 
index 51a9cf8bb8e7f33f2bc51d1b47467535490ff274..e97f9bb0745b84e284c396dc4ebd120e99002c22 100644 (file)
@@ -410,7 +410,7 @@ static int
 StructType_setattro(PyObject *self, PyObject *key, PyObject *value)
 {
        /* XXX Should we disallow deleting _fields_? */
-       if (-1 == PyObject_GenericSetAttr(self, key, value))
+       if (-1 == PyType_Type.tp_setattro(self, key, value))
                return -1;
        
        if (value && PyString_Check(key) &&