This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author b1tninja
Recipients b1tninja
Date 2019-11-20.02:34:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1574217244.17.0.279528403217.issue38860@roundup.psfhosted.org>
In-reply-to
Content
When subclassing the ctypes.Structure class, __new__ and __init__ are not invoked when using the inherited classmethod from_buffer_copy to create the object.

I think this is because tp_alloc is ultimately used by GenericPyCData_new when creating the object using the from_buffer_copy classmethod inherited from _CData.

https://github.com/python/cpython/blob/be143ec99674ba38c5811f34cdb85ef39c2dc8f8/Modules/_ctypes/_ctypes.c#L3202

Expected behavior: creation of Structure subclass object would invoke __new__ and possibly __init__.
History
Date User Action Args
2019-11-20 02:34:04b1tninjasetrecipients: + b1tninja
2019-11-20 02:34:04b1tninjasetmessageid: <1574217244.17.0.279528403217.issue38860@roundup.psfhosted.org>
2019-11-20 02:34:04b1tninjalinkissue38860 messages
2019-11-20 02:34:03b1tninjacreate