Message301034
The following code causes PyCData_setstate() (in Modules/_ctypes/_ctypes.c) to
raise a SystemError:
import ctypes
class BadStruct(ctypes.Structure):
def __dict__(self):
pass
BadStruct().__setstate__({}, b'foo')
this is because PyCData_setstate() assumes that the __dict__ attribute is a dict.
while we are here, I wonder whether we should change the format given to
PyArg_ParseTuple() to "!Os#", so that the following would raise a TypeError:
import ctypes
class MyStruct(ctypes.Structure):
pass
MyStruct().__setstate__(42, b'foo')
AttributeError: 'int' object has no attribute 'keys'
what do you think? |
|
Date |
User |
Action |
Args |
2017-08-30 19:29:41 | Oren Milman | set | recipients:
+ Oren Milman |
2017-08-30 19:29:41 | Oren Milman | set | messageid: <1504121381.44.0.97838192699.issue31311@psf.upfronthosting.co.za> |
2017-08-30 19:29:41 | Oren Milman | link | issue31311 messages |
2017-08-30 19:29:41 | Oren Milman | create | |
|