Skip to content

Commit d1559fb

Browse files
author
fdrake
committed
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. git-svn-id: http://svn.python.org/projects/python/trunk@23543 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 2378eb4 commit d1559fb

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

Include/pyerrors.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ extern DL_IMPORT(PyObject *) PyExc_NotImplementedError;
4848
extern DL_IMPORT(PyObject *) PyExc_SyntaxError;
4949
extern DL_IMPORT(PyObject *) PyExc_IndentationError;
5050
extern DL_IMPORT(PyObject *) PyExc_TabError;
51+
extern DL_IMPORT(PyObject *) PyExc_ReferenceError;
5152
extern DL_IMPORT(PyObject *) PyExc_SystemError;
5253
extern DL_IMPORT(PyObject *) PyExc_SystemExit;
5354
extern DL_IMPORT(PyObject *) PyExc_TypeError;

Python/exceptions.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ Exception\n\
9797
| | |\n\
9898
| | +-- UnicodeError\n\
9999
| |\n\
100+
| +-- ReferenceError\n\
100101
| +-- SystemError\n\
101102
| +-- MemoryError\n\
102103
|\n\
@@ -888,6 +889,9 @@ SystemError__doc__[] = "Internal error in the Python interpreter.\n\
888889
Please report this to the Python maintainer, along with the traceback,\n\
889890
the Python version, and the hardware/OS platform and version.";
890891

892+
static char
893+
ReferenceError__doc__[] = "Weak ref proxy used after referent went away.";
894+
891895
static char
892896
MemoryError__doc__[] = "Out of memory.";
893897

@@ -956,6 +960,7 @@ PyObject *PyExc_NotImplementedError;
956960
PyObject *PyExc_SyntaxError;
957961
PyObject *PyExc_IndentationError;
958962
PyObject *PyExc_TabError;
963+
PyObject *PyExc_ReferenceError;
959964
PyObject *PyExc_SystemError;
960965
PyObject *PyExc_SystemExit;
961966
PyObject *PyExc_UnboundLocalError;
@@ -1044,6 +1049,7 @@ static struct {
10441049
FloatingPointError__doc__},
10451050
{"ValueError", &PyExc_ValueError, 0, ValueError__doc__},
10461051
{"UnicodeError", &PyExc_UnicodeError, &PyExc_ValueError, UnicodeError__doc__},
1052+
{"ReferenceError", &PyExc_ReferenceError, 0, ReferenceError__doc__},
10471053
{"SystemError", &PyExc_SystemError, 0, SystemError__doc__},
10481054
{"MemoryError", &PyExc_MemoryError, 0, MemoryError__doc__},
10491055
/* Warning categories */

0 commit comments

Comments
 (0)