From bb9fa21cfe7a8343698ce5e26e845b4e0c877d6a Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Fri, 5 Oct 2001 21:50:08 +0000 Subject: weakref.ReferenceError becomes a built-in exception now that weak ref objects are moving into the core; with these changes, it will be possible for the exception to be raised without the weakref module ever being imported. --- Include/pyerrors.h | 1 + Python/exceptions.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/Include/pyerrors.h b/Include/pyerrors.h index d7b7639..c3960b7 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -48,6 +48,7 @@ extern DL_IMPORT(PyObject *) PyExc_NotImplementedError; extern DL_IMPORT(PyObject *) PyExc_SyntaxError; extern DL_IMPORT(PyObject *) PyExc_IndentationError; extern DL_IMPORT(PyObject *) PyExc_TabError; +extern DL_IMPORT(PyObject *) PyExc_ReferenceError; extern DL_IMPORT(PyObject *) PyExc_SystemError; extern DL_IMPORT(PyObject *) PyExc_SystemExit; extern DL_IMPORT(PyObject *) PyExc_TypeError; diff --git a/Python/exceptions.c b/Python/exceptions.c index ef9d01c..4d17529 100644 --- a/Python/exceptions.c +++ b/Python/exceptions.c @@ -97,6 +97,7 @@ Exception\n\ | | |\n\ | | +-- UnicodeError\n\ | |\n\ + | +-- ReferenceError\n\ | +-- SystemError\n\ | +-- MemoryError\n\ |\n\ @@ -889,6 +890,9 @@ Please report this to the Python maintainer, along with the traceback,\n\ the Python version, and the hardware/OS platform and version."; static char +ReferenceError__doc__[] = "Weak ref proxy used after referent went away."; + +static char MemoryError__doc__[] = "Out of memory."; static char @@ -956,6 +960,7 @@ PyObject *PyExc_NotImplementedError; PyObject *PyExc_SyntaxError; PyObject *PyExc_IndentationError; PyObject *PyExc_TabError; +PyObject *PyExc_ReferenceError; PyObject *PyExc_SystemError; PyObject *PyExc_SystemExit; PyObject *PyExc_UnboundLocalError; @@ -1044,6 +1049,7 @@ static struct { FloatingPointError__doc__}, {"ValueError", &PyExc_ValueError, 0, ValueError__doc__}, {"UnicodeError", &PyExc_UnicodeError, &PyExc_ValueError, UnicodeError__doc__}, + {"ReferenceError", &PyExc_ReferenceError, 0, ReferenceError__doc__}, {"SystemError", &PyExc_SystemError, 0, SystemError__doc__}, {"MemoryError", &PyExc_MemoryError, 0, MemoryError__doc__}, /* Warning categories */ -- cgit v0.12