[Python-bugs-list] [Bug #110863] Reference counting problem? (PR#338)

noreply@sourceforge.net noreply@sourceforge.net
Fri, 25 Aug 2000 07:31:00 -0700


Bug #110863, was updated on 2000-Aug-01 14:39
Here is a current snapshot of the bug.

Project: Python
Category: None
Status: Open
Resolution: None
Bug Group: Irreproducible
Priority: 1
Summary: Reference counting problem? (PR#338)

Details: Jitterbug-Id: 338
Submitted-By: gpk@bell-labs.com
Date: Wed, 24 May 2000 10:24:32 -0400 (EDT)
Version: 1.6 as of 5/21/2000
OS: Solaris 2.6


Python 1.6 seems to have some kind of reference counting problem.

The following function (in the midst of a large program)
will crash with a nonsensical exception if I comment out the
print statement.

def _pull_types(d, nc):
        """Finds all the column definitions in the data file,
        that is, attributes in the form 'TTYPE#'.   These
        attributes tell you what kind of data is in a specific
        column.  It then builds an output dictionary that
        tells you what column contains any desired type of data."""

        ts = type('')
        kl = d.keys()
        o = {}
        for k in kl:
                assert type(k)==ts, 'Key must be string'
		# comment out next line to crash:
                print "PULLTYPES(", k, ")", 'type(k)=', type(k)
                if len(k)>5 and k[:5] == 'TTYPE':
                        col = string.atoi(k[5:])
                        if col>0 and col<=nc:
                                o[d[k]] = col-1
        return o




Output with print statement in:

...
PULLTYPES( HISTORY ) type(k)= <type 'string'>
PULLTYPES( _FILETYPE ) type(k)= <type 'string'>
PULLTYPES( I_NOISE ) type(k)= <type 'string'>
PULLTYPES( NAXIS2 ) type(k)= <type 'string'>
PULLTYPES( CDELT2 ) type(k)= <type 'string'>
PULLTYPES( CDELT1 ) type(k)= <type 'string'>
...


Output with print statement commented out:

...
Traceback (most recent call last):
  File "/u/gpk/f0cls/bin/get_3_f0.sh", line 101, in ?
    pegg = get_f0(t + '/pegg.sd', pfile+'.pegg', t + '/pegg');
  File "/u/gpk/f0cls/bin/get_3_f0.sh", line 83, in get_f0
    return gpkimgclass.read(ttn + '.f0.dat')
  File "/home/gpk/lib/gpkimgclass.py", line 41, in read
    return gpk_img(hdr, data)
  File "/home/gpk/lib/gpkimgclass.py", line 69, in __init__
    self.types = _pull_types(self.hdr, self.n[1])
  File "/home/gpk/lib/gpkimgclass.py", line 23, in _pull_types
    if len(k)>5 and k[:5] == 'TTYPE':
IndexError: list index out of range
...




====================================================================
Audit trail:
Tue Jul 11 08:29:19 2000	guido	moved from incoming to irreproducible

Follow-Ups:

Date: 2000-Aug-01 14:39
By: none

Comment:
From: Guido van Rossum <guido@python.org>
Subject: Re: [Python-bugs-list] Reference counting problem? (PR#338)
Date: Thu, 25 May 2000 16:49:09 -0500

> Python 1.6 seems to have some kind of reference counting problem.
> 
> The following function (in the midst of a large program)
> will crash with a nonsensical exception if I comment out the
> print statement.

Without the whole program and its input data it's hard to debug this.
Does your program use any nonstandard extension modules?  That's where
I'd start looking...  A bug in core Python, while not impossible, is
pretty unlikely.

--Guido van Rossum (home page: http://www.python.org/~guido/)




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

Date: 2000-Aug-01 14:39
By: none

Comment:
From: Greg Kochanski <gpk@bell-labs.com>
Subject: Re: [Python-bugs-list] Reference counting problem? (PR#338)
Date: Fri, 26 May 2000 11:36:51 -0400

Guido van Rossum wrote:
> 
> > Python 1.6 seems to have some kind of reference counting problem.
>
> Without the whole program and its input data it's hard to debug this.
> Does your program use any nonstandard extension modules?  That's where
> I'd start looking... 

It does.  Some of the input data
is a copy of a directory the nonstandard module produces.
I'll look at the nonstandard module, and also see if I
can isolate the problem to a reasonable-size chunk of code.


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

Date: 2000-Aug-25 07:31
By: jhylton

Comment:
Will close this one unless the original poster reponds.

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

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=110863&group_id=5470