Commits

Amaury Forgeot d'Arc committed e53e985

ctypes should not call a Structure user-defined __new__ and __init__,
we may not know the signature.

Comments (0)

Files changed (4)

lib-python/modified-2.7.0/ctypes/test/test_cast.py

 import unittest
 import sys
 
-from ctypes.test import xfail
-
 class Test(unittest.TestCase):
 
     def test_array2pointer(self):

lib-python/modified-2.7.0/ctypes/test/test_init.py

 from ctypes import *
 import unittest
-from ctypes.test import xfail
 
 class X(Structure):
     _fields_ = [("a", c_int),
 
 
 class InitTest(unittest.TestCase):
-    @xfail
     def test_get(self):
         # make sure the only accessing a nested structure
         # doesn't call the structure's __new__ and __init__

lib-python/modified-2.7.0/ctypes/test/test_prototypes.py

 from ctypes import *
 import unittest
-from ctypes.test import xfail
 
 # IMPORTANT INFO:
 #

lib_pypy/_ctypes/structure.py

     __setattr__ = struct_setattr
 
     def from_address(self, address):
-        instance = self.__new__(self)
+        instance = StructOrUnion.__new__(self)
         instance.__dict__['_buffer'] = self._ffistruct.fromaddress(address)
         return instance
 
         return _CDataMeta.from_param(self, value)
 
     def _CData_output(self, resarray, base=None, index=-1):
-        res = self.__new__(self)
+        res = StructOrUnion.__new__(self)
         ffistruct = self._ffistruct.fromaddress(resarray.buffer)
         res.__dict__['_buffer'] = ffistruct
         res.__dict__['_base'] = base
         return res
     
     def _CData_retval(self, resbuffer):
-        res = self.__new__(self)
+        res = StructOrUnion.__new__(self)
         res.__dict__['_buffer'] = resbuffer
         res.__dict__['_base'] = None
         res.__dict__['_index'] = -1