summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-02-27 17:40:01 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-02-27 17:40:01 (GMT)
commit23e018ab9893369e7669631af16016b83b0de09b (patch)
treec9d25a600019030cee49f5c9390fd352b4cc59ff /Python
parent8de42e2d50e9609ef4f9a656a0b8e1234db969ac (diff)
downloadcpython-23e018ab9893369e7669631af16016b83b0de09b.zip
cpython-23e018ab9893369e7669631af16016b83b0de09b.tar.gz
cpython-23e018ab9893369e7669631af16016b83b0de09b.tar.bz2
only accept AttributeError as indicating no __prepare__ attribute on a metaclass, allowing lookup errors to propogate
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 7fe164f..5c7138e 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -108,8 +108,16 @@ builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds)
}
prep = PyObject_GetAttrString(meta, "__prepare__");
if (prep == NULL) {
- PyErr_Clear();
- ns = PyDict_New();
+ if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ PyErr_Clear();
+ ns = PyDict_New();
+ }
+ else {
+ Py_DECREF(meta);
+ Py_XDECREF(mkw);
+ Py_DECREF(bases);
+ return NULL;
+ }
}
else {
PyObject *pargs = PyTuple_Pack(2, name, bases);