[Python-Dev] Possible bug in complexobject.c (still in Python 2.5) (original) (raw)
Travis E. Oliphant oliphant.travis at ieee.org
Thu Jun 1 02:35:21 CEST 2006
- Previous message: [Python-Dev] Possible bug in complexobject.c (still in Python 2.5)
- Next message: [Python-Dev] Possible bug in complexobject.c (still in Python 2.5)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I'm curious about the difference between
float_subtype_new in floatobject.c complex_subtype_from_c_complex in complexobject.c
The former uses type->tp_alloc(type, 0) to create memory for the object while the latter uses PyType_GenericAlloc(type, 0) to create memory for the sub-type (thereby by-passing the sub-type's own memory allocator).
It seems like this is a bug. Shouldn't type->tp_alloc(type, 0) also be used in the case of allocating complex subtypes?
This is causing problems in NumPy because we have a complex type that is a sub-type of the Python complex scalar. It sometimes uses the complex_new code to generate instances (so that the new interface is the same), but because complex_subtype_from_c_complex is using PyType_GenericAlloc this is causing errors.
I can work around this by not calling the new method for the base type but this is not consistent.
Thanks for any feedback,
P.S. Sorry about the cross-posting to another thread. I must have hit reply instead of compose. Please forgive the noise.
-Travis
- Previous message: [Python-Dev] Possible bug in complexobject.c (still in Python 2.5)
- Next message: [Python-Dev] Possible bug in complexobject.c (still in Python 2.5)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]