I'm the author of an extension module (blist) that provides a type that fits
the MutableSequence API. Is there a canonical way for me to register the
type as a MutableSequence from the C API?
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>
You are receiving this email because we wish you to use our cost-effective IT services.
We are a China based Custom Software Application Development provider. We offer full cycle custom software programming services, from product idea, software development to support and enhancement. We employ a large pool of software engineers coming from different backgrounds. We are able to balance product development efforts and project duration to your business needs.
Custom Application Development
Custom Software Development
iPhone Application Development
iPad Application Development
Mobile Application Development
Android Mobile Application Development
Soft Product Development
Game Design & Development
Game Testing & Quality Assurance
CRM Software Application Development
ERP Software Application Development
Enterprise Portal Solution
Sales Force Automation Solution
Game Design & Development
Knowledge Management Solution
Workflow Management Solution
SharePoint Development Services
Microsoft Online Services
Microsoft Azure Services
ITVIATSA Software Development
Pls send address to larryremove123(a)msn.com for remove
I'm trying to understand what is the best/safest/recommended way to
implement tp_dealloc on a heap type created by PyType_FromSpec.
The official docs don't say much on the topic. The only note I could find
> Finally, if the type is heap allocated (Py_TPFLAGS_HEAPTYPE), the
deallocator should decrement the reference count for its type object after
calling the type deallocator.
My doubts came after reading the source code. If I don't specify a
tp_dealloc, its default value depends on heap vs static types:
- for static types, the default is object_dealloc, which simply does a
- for heap types created by PyType_FromSpecWithBases, the default
value is subtype_dealloc, which seems to do a lot of complex logic which
I don't fully understand.
This means that if I create a heap type with a custom tp_dealloc, all the
logic implemented by subtype_dealloc will not be executed and that my type
will probably behave subtly differently. I also found BPO 26979  where
Christian Tismer claims that "The default of PyType_FromSpec for tp_dealloc
is wrong!", but it seems that nothing has been done for that.
Another interesting data point is that PyType_FromSpec+tp_dealloc does not
seem to be used a lot in the wild. I tried to grep for Py_tp_dealloc in the
top4000 PyPI packages and I found only a match, in Cython-generated code
; but it's code which is behind an "#if
CYTHON_COMPILING_IN_LIMITED_API", which makes me to suspect which is not
actually used a lot in practice.
So, back to my original problem:
1. Is the default value of tp_dealloc actually correct?
2. Is it actually possible to write a custom tp_dealloc which behaves
3. If (2) is true, what is the simplest way to do it?