This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients DeKrain, steven.daprano
Date 2018-08-29.16:43:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1535561031.77.0.56676864532.issue34543@psf.upfronthosting.co.za>
In-reply-to
Content
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.)
History
Date User Action Args
2018-08-29 16:43:51steven.dapranosetrecipients: + steven.daprano, DeKrain
2018-08-29 16:43:51steven.dapranosetmessageid: <1535561031.77.0.56676864532.issue34543@psf.upfronthosting.co.za>
2018-08-29 16:43:51steven.dapranolinkissue34543 messages
2018-08-29 16:43:51steven.dapranocreate