Subtle change to make None.__class__ work:
- descrobject.c:descr_check(): only believe None means the same as
NULL if the type given is None's type.
- typeobject.c:wrap_descr_get(): don't "conventiently" default an
absent type to the type of the object argument. Let the called
function figure it out.
diff --git a/Objects/descrobject.c b/Objects/descrobject.c
index 40629f6..a2ecde5 100644
--- a/Objects/descrobject.c
+++ b/Objects/descrobject.c
@@ -91,9 +91,9 @@
static int
descr_check(PyDescrObject *descr, PyObject *obj, PyTypeObject *type,
- PyObject **pres)
+ PyObject **pres)
{
- if (obj == NULL || obj == Py_None) {
+ if (obj == NULL || (obj == Py_None && type != Py_None->ob_type)) {
Py_INCREF(descr);
*pres = (PyObject *)descr;
return 1;