Kaydet (Commit) bdcb9410 authored tarafından Neal Norwitz's avatar Neal Norwitz

SF bug #978308, Spurious errors taking bool of dead pro

Need to return -1 on error.

Needs backport.
üst bd7f76dd
...@@ -104,6 +104,7 @@ class ReferencesTestCase(TestBase): ...@@ -104,6 +104,7 @@ class ReferencesTestCase(TestBase):
self.assertRaises(weakref.ReferenceError, check, ref1) self.assertRaises(weakref.ReferenceError, check, ref1)
self.assertRaises(weakref.ReferenceError, check, ref2) self.assertRaises(weakref.ReferenceError, check, ref2)
self.assertRaises(weakref.ReferenceError, bool, weakref.proxy(C()))
self.assert_(self.cbcalled == 2) self.assert_(self.cbcalled == 2)
def check_basic_ref(self, factory): def check_basic_ref(self, factory):
......
...@@ -504,7 +504,7 @@ proxy_nonzero(PyWeakReference *proxy) ...@@ -504,7 +504,7 @@ proxy_nonzero(PyWeakReference *proxy)
{ {
PyObject *o = PyWeakref_GET_OBJECT(proxy); PyObject *o = PyWeakref_GET_OBJECT(proxy);
if (!proxy_checkref(proxy)) if (!proxy_checkref(proxy))
return 1; return -1;
if (o->ob_type->tp_as_number && if (o->ob_type->tp_as_number &&
o->ob_type->tp_as_number->nb_nonzero) o->ob_type->tp_as_number->nb_nonzero)
return (*o->ob_type->tp_as_number->nb_nonzero)(o); return (*o->ob_type->tp_as_number->nb_nonzero)(o);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment