diff options
| author | Raymond Hettinger <python@rcn.com> | 2013-09-02 15:59:26 -0700 |
|---|---|---|
| committer | Raymond Hettinger <python@rcn.com> | 2013-09-02 15:59:26 -0700 |
| commit | 69492dab07772f71aa226cbafa03f7d50309dd43 (patch) | |
| tree | d1ac5b703936538b8faa0fbd5bd5851064c5010d /Objects/setobject.c | |
| parent | 7f5c22c022592e5e9a82520e152d619f58382e7d (diff) | |
| download | cpython-git-69492dab07772f71aa226cbafa03f7d50309dd43.tar.gz | |
Factor-out the common code for setting a KeyError.
Diffstat (limited to 'Objects/setobject.c')
| -rw-r--r-- | Objects/setobject.c | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c index 8a3d4f2141..524bda9156 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -11,20 +11,6 @@ #include "structmember.h" #include "stringlib/eq.h" -/* Set a key error with the specified argument, wrapping it in a - * tuple automatically so that tuple keys are not unpacked as the - * exception arguments. */ -static void -set_key_error(PyObject *arg) -{ - PyObject *tup; - tup = PyTuple_Pack(1, arg); - if (!tup) - return; /* caller will expect error to be set anyway */ - PyErr_SetObject(PyExc_KeyError, tup); - Py_DECREF(tup); -} - /* This must be >= 1. */ #define PERTURB_SHIFT 5 #define LINEAR_PROBES 9 @@ -1948,7 +1934,7 @@ set_remove(PySetObject *so, PyObject *key) } if (rv == DISCARD_NOTFOUND) { - set_key_error(key); + _PyErr_SetKeyError(key); return NULL; } Py_RETURN_NONE; |
