Weird pointer errors... Stackless problem? PyString_InternInPlac e Fatal error

Mike Fletcher mfletch at tpresence.com
Fri Sep 15 00:56:36 EDT 2000


I'm working on a very large project, and yesterday things started going to
heck in an unfashionable wicker conveyance.  I'm using the binary Stackless
distribution over the binary Python 1.5.2 and Micro-threads (uthread9.py) on
NT 4.0sp5 to create the software, and I'm thinking it may be a problem with
Stackless.  I've had two "Fatal Python errors", the first (which I didn't
think to copy down) was a thread-state error effectively saying there was no
current thread.  The second is:

Fatal Python error: PyString_InternInPlace: strings only please!

abnormal program termination

This is on totally "normal" code, 
	if start < end:
		chars = map( chr, range( start, end +1 ) )
	else:
		chars = map( chr, range( end, start +1 ) )
	print 'start, end', (start, end)
	print 'character set:', chars[:4] # error occurs here...
	dataset.append( string.join( chars, ''))

If I change to printing all of chars, I get a memory access error on a
non-null address.  If I print chars[5:] I get:

character set: ['f', 'g', 'h', (None, 13, '\\', 2, 1), 'j', (None, 12,
"\\'", 1,
 1), 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',

Then a memory access error (note the weird contents, looks as though some
pointer fudging is going on somewhere), those are tuples from the parser
generator system from which the code is snipped.  Note: this is not
consistent, sometimes the list looks approximately normal (no
substitutions), but the y or z element causes a memory access error.
Sometimes it's the 5th element that causes the PyString fatal error instead
of the 4th element.

There are weird results like this all over the place, adding the first and
last characters of a string gives a TypeError that you can't add unlike
types in one instance (might be the same problem as above, as both involve
1-character strings).  The pointers seem to be re-pointing, as it were.
Note: this is in a highly micro-threaded system, so there's going to be a
lot of swapping of contexts.  The objects that are getting messed up are all
in the same thread (and nowhere else), and shouldn't ever get passed out of
the thread (after all, they're just getting passed from the map to the
string.join then deallocating).

Going to re-install everything now, but thoughts on how this could happen
and be avoided in the future would be appreciated.

Enjoy yourselves,
Mike





More information about the Python-list mailing list