Message304328
The following code causes an assertion failure:
import _struct
struct_obj = _struct.Struct.__new__(_struct.Struct)
struct_obj.iter_unpack(b'foo')
This is because Struct_iter_unpack() (in Modules/_struct.c) assumes that
Struct.__init__() was called, and so it does `assert(self->s_codes != NULL);`.
The same happens in (almost) every method of Struct, and in s_get_format(), so
in all them, too, we would get an assertion failure in case of an uninitialized
Struct object.
The exception is __sizeof__(), which doesn't have an `assert`, and simply
crashes while trying to iterate over `self->s_codes`.
I would open a PR to fix this soon. |
|
Date |
User |
Action |
Args |
2017-10-13 10:54:20 | Oren Milman | set | recipients:
+ Oren Milman |
2017-10-13 10:54:20 | Oren Milman | set | messageid: <1507892060.42.0.213398074469.issue31779@psf.upfronthosting.co.za> |
2017-10-13 10:54:20 | Oren Milman | link | issue31779 messages |
2017-10-13 10:54:19 | Oren Milman | create | |
|