diff options
Diffstat (limited to 'Objects/moduleobject.c')
-rw-r--r-- | Objects/moduleobject.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index fca8521f5f..9d6533257b 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -792,16 +792,17 @@ static PyObject * module_dir(PyObject *self, PyObject *args) { _Py_IDENTIFIER(__dict__); + _Py_IDENTIFIER(__dir__); PyObject *result = NULL; PyObject *dict = _PyObject_GetAttrId(self, &PyId___dict__); if (dict != NULL) { if (PyDict_Check(dict)) { - PyObject *dirfunc = PyDict_GetItemString(dict, "__dir__"); + PyObject *dirfunc = _PyDict_GetItemIdWithError(dict, &PyId___dir__); if (dirfunc) { result = _PyObject_CallNoArg(dirfunc); } - else { + else if (!PyErr_Occurred()) { result = PyDict_Keys(dict); } } |