Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

_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.)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34543>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to