Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 795ba58

Browse files
committed
Removed some redundant header includes.
dir(object) now returns object.__dict__.keys() even if __dict__ is not a dictionary.
1 parent 441e4ab commit 795ba58

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Python/bltinmodule.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,8 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2828

2929
#include "node.h"
3030
#include "graminit.h"
31-
#include "sysmodule.h"
3231
#include "bltinmodule.h"
3332
#include "import.h"
34-
#include "pythonrun.h"
35-
#include "ceval.h"
36-
#include "modsupport.h"
3733
#include "compile.h"
3834
#include "eval.h"
3935

@@ -356,7 +352,11 @@ builtin_dir(self, args)
356352
}
357353
}
358354
else {
359-
v = newlistobject(0);
355+
v = PyObject_CallMethod(d, "keys", NULL);
356+
if (v == NULL) {
357+
PyErr_Clear();
358+
v = newlistobject(0);
359+
}
360360
}
361361
DECREF(d);
362362
return v;

0 commit comments

Comments
 (0)