A Python bug? (core dump)

Huaiyu Zhu huaiyu_zhu at moon.localdomain
Thu Jan 13 18:52:52 EST 2000


The following script dumps core when the "print self" line is uncommented,
because print calls __str__ which calls print which calls ...

##################################
class Item:
    def __init__(self, item):
        self._ = item
	    
    def __str__(self):
#       print self
        return `self._`

print Item ('aaa')
##################################

For some other recursive calls I tried that do not involve print and
__str__, the outcomes are sane:

RuntimeError: Maximum recursion depth exceeded

I've read somewhere that "Python never dumps core".  So this must be a bug.
The versions are:

Python 1.5.2 (#1, Sep 17 1999, 20:15:36)  [GCC egcs-2.91.66 19990314/Linux
(egcs- on linux-i386

-- 
Huaiyu Zhu		huaiyu_zhu at yahoo.com



More information about the Python-list mailing list