[Zope-Coders] core dump in Zope 2.7 test suite

Jeremy Hylton jeremy at zope.com
Tue Sep 16 00:01:02 EDT 2003


On Mon, 2003-09-15 at 20:45, Tim Peters wrote:
> In the earlier debug output:
> 
> $9 = {_ob_next = 0x0, _ob_prev = 0x0, ob_refcnt = 0,
>       ob_type = 0x8130160, length = 1, str = 0x41903130,
>       hash = -1, defenc = 0x0}
> 
> that certainly means the object has been released already.

This is code that is trying to revive an object from the freelist, so it
isn't a big surprise that the object looks like it has been freed.

Now here's a very strange thing.  If I apply the following patch, the
problem goes away.  The patch doesn't make a lot of sense to me, so I'm
guessing that it's just a lucky patch -- avoiding the problem without
fixing the cause.

The thing that is curious is that we change the test against
unicode->str[0], which is probably an unsigned int, so that we also test
that it is > 0.  In the specific case that crashes, the debugger says
the value is -875836469.  Does that make any sense?  Do we actually have
a signed value here?  Or does it get converted to a signed value when
the comparison occurs?

Jeremy

Index: unicodeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v
retrieving revision 2.196
diff -c -r2.196 unicodeobject.c
*** unicodeobject.c	16 Sep 2003 03:41:45 -0000	2.196
--- unicodeobject.c	16 Sep 2003 03:55:53 -0000
***************
*** 130,138 ****
      /* Resizing shared object (unicode_empty or single character
         objects) in-place is not allowed. Use PyUnicode_Resize()
         instead ! */
      if (unicode == unicode_empty || 
  	(unicode->length == 1 && 
! 	 unicode->str[0] < 256 &&
  	 unicode_latin1[unicode->str[0]] == unicode)) {
          PyErr_SetString(PyExc_SystemError,
                          "can't resize shared unicode objects");
--- 130,142 ----
      /* Resizing shared object (unicode_empty or single character
         objects) in-place is not allowed. Use PyUnicode_Resize()
         instead ! */
      if (unicode == unicode_empty || 
  	(unicode->length == 1 && 
! 	 unicode->str[0] < 256 && unicode->str[0] > 0 &&
  	 unicode_latin1[unicode->str[0]] == unicode)) {
          PyErr_SetString(PyExc_SystemError,
                          "can't resize shared unicode objects");





More information about the Zope-Coders mailing list