RuntimeError?

Tim Peters tim_one at email.msn.com
Tue Jun 29 03:15:07 EDT 1999


[RuntimeError ... generally seems to mean something bad and unexpected
 happened, but not bad enough to shut down the interpreter (things *that*
 bad raise SystemError).
]

[Gerrit Holl]
> Ah, I understand. But what kind of things are bad enough to raise
> SystemError?  core dump?

>>> print SystemError.__doc__
Internal error in the Python interpreter.

    Please report this to the Python maintainer, along with the traceback,
    the Python version, and the hardware/OS platform and version.
>>>

That means something has happened Python can't figure out -- it's a problem
in Python itself (or in some C code you wrote to extend Python), not a
problem in your Python code.  This is the kind of thing that *could* cause a
core dump (or other random damage) if Python didn't check for it first.
It's hard to give you an example, since if I could I'd have to report it to
the Python maintainer and he'd fix it before you could reproduce it <wink>.

Core dumps are even worse -- that's something so bad Python didn't even
check for it first, or didn't check for it correctly.  For example, if you
have unbounded recursion:

def f():
    f()
f()

Python does check how many levels deep f calls itself, and raises an
exception if it gets "too deep".  Under Windows, though, the check in 1.5.2
doesn't quite work, and Python dies with a stack overflow in the operating
system.  Python never wants that to happen!  There's no chance for your
Python program to recover from it.

read-Lib/exceptions.py-for-more-entertainment-ly y'rs  - tim






More information about the Python-list mailing list