Message324331
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:51 | steven.daprano | set | recipients:
+ steven.daprano, DeKrain |
2018-08-29 16:43:51 | steven.daprano | set | messageid: <1535561031.77.0.56676864532.issue34543@psf.upfronthosting.co.za> |
2018-08-29 16:43:51 | steven.daprano | link | issue34543 messages |
2018-08-29 16:43:51 | steven.daprano | create | |
|