Author steven.daprano
Recipients DeKrain, steven.daprano
Date 2018-08-29.16:43:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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.)
Date User Action Args
2018-08-29 16:43:51steven.dapranosetrecipients: + steven.daprano, DeKrain
2018-08-29 16:43:51steven.dapranosetmessageid: <>
2018-08-29 16:43:51steven.dapranolinkissue34543 messages
2018-08-29 16:43:51steven.dapranocreate