diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-12-11 10:13:14 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-11 10:13:14 (GMT) |
commit | be6ec444729f727f304ae10f3a7e2feda3cc3aaa (patch) | |
tree | e6f2d90acb8b9e9b6d9903e809656209b36e82df /Objects/methodobject.c | |
parent | f74cabd9203cf3be97fdb3821a7fa0b74d7b2263 (diff) | |
download | cpython-be6ec444729f727f304ae10f3a7e2feda3cc3aaa.zip cpython-be6ec444729f727f304ae10f3a7e2feda3cc3aaa.tar.gz cpython-be6ec444729f727f304ae10f3a7e2feda3cc3aaa.tar.bz2 |
bpo-35444: Fix error handling when fail to look up builtin "getattr". (GH-11047) (GH-11107) (GH-11108)
(cherry picked from commit bb86bf4c4eaa30b1f5192dab9f389ce0bb61114d)
(cherry picked from commit 3cae16d2e98ffaa89ddd311df70a857dfaff4020)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Objects/methodobject.c')
-rw-r--r-- | Objects/methodobject.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Objects/methodobject.c b/Objects/methodobject.c index fe52545..6794bf2 100644 --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -320,16 +320,13 @@ meth_dealloc(PyCFunctionObject *m) static PyObject * meth_reduce(PyCFunctionObject *m) { - PyObject *builtins; - PyObject *getattr; _Py_IDENTIFIER(getattr); if (m->m_self == NULL || PyModule_Check(m->m_self)) return PyUnicode_FromString(m->m_ml->ml_name); - builtins = PyEval_GetBuiltins(); - getattr = _PyDict_GetItemId(builtins, &PyId_getattr); - return Py_BuildValue("O(Os)", getattr, m->m_self, m->m_ml->ml_name); + return Py_BuildValue("N(Os)", _PyEval_GetBuiltinId(&PyId_getattr), + m->m_self, m->m_ml->ml_name); } static PyMethodDef meth_methods[] = { |