[Python-Dev] Directions for reproducing the coredump (original) (raw)
Ka-Ping Yee ping@lfw.org
Sat, 12 Aug 2000 01:09:53 -0700 (PDT)
- Previous message: [Python-Dev] Directions for reproducing the coredump
- Next message: [Python-Dev] Directions for reproducing the coredump
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, 11 Aug 2000, Ka-Ping Yee wrote:
On Fri, 11 Aug 2000, Ka-Ping Yee wrote: > I have successfully reproduced the core dump.
I'm investigating. Top of the stack looks like:
This chunk of stack repeats lots and lots of times. The problem is due to infinite recursion in your repr routine:
class Requirement:
"A requirement, together with a message to be shown if it's violated."
def __init__(self, wff, message=None):
self.predicate = wff
self.message = message
def str(self):
return display_expression(self.predicate)
def __repr__(self):
if self.message:
return self.message
else:
return str(self)
Notice that Requirement.repr calls str(self), which triggers Requirement.repr again because there is no str method.
If i change "def str(self)" to "def str(self)", the problem goes away and everything works properly.
With a reasonable stack depth limit in place, this would produce a run-time error rather than a segmentation fault.
-- ?!ng
"This code is better than any code that doesn't work has any right to be." -- Roger Gregory, on Xanadu
- Previous message: [Python-Dev] Directions for reproducing the coredump
- Next message: [Python-Dev] Directions for reproducing the coredump
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]