gh-143715: Deprecate incomplete initialization of struct.Struct() by serhiy-storchaka · Pull Request #145580 · python/cpython
and others added 29 commits
January 10, 2026 16:37* ``Struct.__new__()`` will require a mandatory argument (format) * Calls of ``__init__()`` method on initialized Struct are deprecated
This make format argument in the __init__() - optional. If it's missing, the object must be already initialized in __new__().
This catch current pattern for Struct's subclassing like
class MyStruct(Struct):
def __init__(self):
super().__init__('>h')
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters