mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
dir() doesn't reify module
This commit is contained in:
parent
e5e9592863
commit
aa85f9d79e
3 changed files with 27 additions and 1 deletions
|
|
@ -1259,7 +1259,12 @@ static PyObject *
|
|||
module_dir(PyObject *self, PyObject *args)
|
||||
{
|
||||
PyObject *result = NULL;
|
||||
PyObject *dict = PyObject_GetAttr(self, &_Py_ID(__dict__));
|
||||
PyObject *dict;
|
||||
if (PyModule_CheckExact(self)) {
|
||||
dict = Py_NewRef(((PyModuleObject *)self)->md_dict);
|
||||
} else {
|
||||
dict = PyObject_GetAttr(self, &_Py_ID(__dict__));
|
||||
}
|
||||
|
||||
if (dict != NULL) {
|
||||
if (PyDict_Check(dict)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue