[egenix-users] mx base 2.1.0b5 ref count bug?

M.-A. Lemburg mal at egenix.com
Tue May 3 10:21:55 CEST 2005


David Rushby wrote:
> --- "M.-A. Lemburg" <mal at egenix.com> wrote:
> 
>>Ok, we've found the problem and fixed it. Here's the new
>>release (which does build out of the box at least on our
>>boxes ;-):
>>
>>
> 
> http://www.egenix.com/files/python/egenix-mx-base-2.1.0-2005-05-01.zip
> 
> It does build now, but:
>   py24d -c "import mx.DateTime as dt; dt.DateTime(-1, 13, 32)"
> still behaves as it did when I submitted my original message:
>   Fatal Python error: UNREF invalid object
>   Aborted
> 
> This is the same debug build of Python 2.4.1 that I was previously
> using, running the same configuration (CentOS Linux 4.0/i386,
> everything compiled with GCC 3.4.3).
> 
> Have you examined my original claim as to the cause of the bug?

No. We haven't had time for looking into it.

I'm not sure whether your analysis of the problem
is correct: if you don't define WANT_SUBCLASSABLE_TYPES,
the API mxDateTime_Deallocate() is neither defined
nor used.

Furthermore, PyObject_Del() is only called by mxDateTime_Free()
if you have explicitely edited mxDateTime.c to disabled the
free list #defines.

In a standard build, PyObject_Del() is only called at
module finalization time.

Note that the reason we call mxDateTime_Free() in the
constructor is that we don't want the destructor of
the object to be called. Py_DECREF() would call the
destructor (mxDateTime_Deallocate).

It is possible that the debug code in Python complains
about the refcount in the object not being 0 at the time
the object is finalized (module finalization time),
but I don't see any such checks in PyObject_Free()
(which is what PyObject_Del() maps to).

Again, all of this does not happen in regular non-debug
Python builds.

Please be aware that we don't support debug builds,
so fixing the problem (if there is one - gcc has some
serious optimization problems on some combinations of
platform and version) will take a while.

Regards,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, May 03 2005)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::



More information about the egenix-users mailing list