Author steven.daprano
Recipients DeKrain, steven.daprano
Date 2018-08-29.17:28:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
_struct is a private implementation detail. You shouldn't use it. You shouldn't care where the implementation "really is" in your Python code, because it could move without warning. There are no backwards-compatibility guarantees for private modules like _struct.

But regardless of where you are importing it from, why are you calling Struct.__new__(Struct) in the first place? You should be calling Struct().

I still don't see any reason to consider this a bug. I can't reproduce your report of a crash:

py> from _struct import Struct
py> s = Struct.__new__(Struct)
py> b = bytearray()
py> s.pack_into(b)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: null argument to internal routine

I get an exception, which is the correct behaviour. Unless this segfaults, I don't believe this is a bug that needs fixing.

(By the way, Struct doesn't even have a __new__ method. You are calling the __new__ method inherited from object, which clearly knows nothing about how to initialise a Struct.)
Date User Action Args
2018-08-29 17:28:21steven.dapranosetrecipients: + steven.daprano, DeKrain
2018-08-29 17:28:21steven.dapranosetmessageid: <>
2018-08-29 17:28:21steven.dapranolinkissue34543 messages
2018-08-29 17:28:21steven.dapranocreate