Steven D'Aprano <[email protected]> added the comment:
This exception goes back to at least Python 2.6 (if not older) but I'm not
convinced it is a bug.
Calling __new__ alone is not guaranteed to initialise a new instance
completely. The public API for creating an instance is to call the class object:
s = Struct()
not to call __new__. You bypassed the proper initialisation of the instance,
resulting in a broken, half-initialised instance. When you tried to use it, it
correctly raised an exception.
If this caused a crash or a seg fault, then it would be reasonable to report it
as a bug, but it looks to me that this is behaving correctly.
If you disagree, please explain why you think it is a bug.
(Also, for the record, you shouldn't be importing Struct from the private
module _struct, you should import it from the public struct module.)
----------
nosy: +steven.daprano
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue34543>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com