Message323498
Amusingly, this is because of an old hack to make directly calling somedict.__getitem__ fast: https://github.com/python/cpython/commit/8f5cdaa784f555149adf5e94fd2e989f99d6b1db
Reverting the dictobject.c changes of the commit, i.e., the following patch, fixes your example.
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 413557d667..d85834977d 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -3032,8 +3032,6 @@ dict_sizeof(PyDictObject *mp, PyObject *Py_UNUSED(ignored))
return PyLong_FromSsize_t(_PyDict_SizeOf(mp));
}
-PyDoc_STRVAR(getitem__doc__, "x.__getitem__(y) <==> x[y]");
-
PyDoc_STRVAR(sizeof__doc__,
"D.__sizeof__() -> size of D in memory, in bytes");
@@ -3071,8 +3069,6 @@ PyDoc_STRVAR(values__doc__,
static PyMethodDef mapp_methods[] = {
DICT___CONTAINS___METHODDEF
- {"__getitem__", (PyCFunction)dict_subscript, METH_O | METH_COEXIST,
- getitem__doc__},
{"__sizeof__", (PyCFunction)dict_sizeof, METH_NOARGS,
sizeof__doc__},
DICT_GET_METHODDEF |
|
Date |
User |
Action |
Args |
2018-08-14 04:40:20 | benjamin.peterson | set | recipients:
+ benjamin.peterson, bup |
2018-08-14 04:40:20 | benjamin.peterson | set | messageid: <1534221620.84.0.56676864532.issue34396@psf.upfronthosting.co.za> |
2018-08-14 04:40:20 | benjamin.peterson | link | issue34396 messages |
2018-08-14 04:40:20 | benjamin.peterson | create | |
|