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.

Title: restype pointer to Structure subclass never initialized
Type: Stage:
Components: ctypes Versions: Python 2.5
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: theller Nosy List: dontbugme, theller
Priority: normal Keywords:

Created on 2009-08-19 18:59 by dontbugme, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg91736 - (view) Author: (dontbugme) Date: 2009-08-19 18:59
So, say I'm sub-classing ctypes.Structure with a class: MyClass.

I define __init__() in MyClass..

If I explicitly instantiate MyClass(), then the __init__() is properly
executed as expected.

But say I have a CFUNCTYPE where I set it's restype member to a POINTER
to MyClass.. A python MyClass object is obviously instantiated at one
point in time, but it's __init__ is never called. Seems odd to me?
msg91738 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2009-08-19 19:57
This is on purpose.

The idea is that the function call returns an existing pointer to an
existing object, so __init__ (or __new__, IIRC) is never called in this
Date User Action Args
2022-04-11 14:56:52adminsetgithub: 50984
2009-08-19 19:57:13thellersetstatus: open -> closed
resolution: not a bug
messages: + msg91738
2009-08-19 18:59:17dontbugmecreate