[New-bugs-announce] [issue16566] Structure._anonymous_ should not allow strings

anatoly techtonik report at bugs.python.org
Tue Nov 27 22:29:49 CET 2012


New submission from anatoly techtonik:

http://docs.python.org/2/library/ctypes.html#ctypes.Structure._anonymous_

  "An optional sequence that lists the names of unnamed (anonymous) fields".

If you feed it a string, such as _offset, it will print a very interesting error:

...
  File "C:\roundup\.\roundup\backends\portalocker.py", line 70, in <module>
    class A_OFFSET_UNION(Union):
AttributeError: type object '_OFFSET_UNION' has no attribute '_'

Considering complexity that ctypes already has, the simple check that _anonymous_ is a sequence (and not a string) will make our lifes easier.

----------
components: ctypes
messages: 176494
nosy: techtonik
priority: normal
severity: normal
status: open
title: Structure._anonymous_ should not allow strings
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16566>
_______________________________________


More information about the New-bugs-announce mailing list