[issue12764] segfault in ctypes.Struct with bad _fields_
Meador Inge
report at bugs.python.org
Fri Sep 2 05:45:40 CEST 2011
Meador Inge <meadori at gmail.com> added the comment:
Vlad,
Thanks for the patch. A few nits:
1. The test case is in 'test_bitfields.py'.
I think it should go in 'test_structures.py'.
2. The test case would probably be cleaner using a 'with' context
manager:
with self.assertRaises(TypeError):
class S(Structure):
_fields_ = [(b"x", c_int)]
A few more test cases might be nice too.
3. The TypeError message display something like:
"structure field name must be string not bytes"
maybe the following would be more understandable:
"field name must be an object of type str not bytes"
4. The 'ptr', 'len', and 'buf' initializers are unnecessary.
Otherwise, looks good.
----------
nosy: +meadori
stage: -> patch review
versions: +Python 3.3, Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12764>
_______________________________________
More information about the Python-bugs-list
mailing list