Bugs item #1498638, was opened at 2006-05-31 22:24
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1498638&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Travis Oliphant (teoliphant)
Assigned to: Nobody/Anonymous (nobody)
Summary: tp_alloc for subtypes of  PyComplex_Type is not called

Initial Comment:
In the function complex_subtype_from_c_complex in the
file complexobject.c, the allocation routine for the
subtype is not called.   This causes memory management
problems if the sub-type does not use the Python memory
manager.  

The fix is to make the following change:

 {
        PyObject *op;

-       op = PyType_GenericAlloc(type, 0);
+       op = type->tp_alloc(type, 0);
        if (op != NULL)
                ((PyComplexObject *)op)->cval = cval;
        return op;


Attched is an example module and script illustrating
what can go wrong along with a patch. 



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1498638&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to