diff Python/bltinmodule.c @ 3587:b5cccf1c8f38 legacy-trunk

Removed some redundant header includes. dir(object) now returns object.__dict__.keys() even if __dict__ is not a dictionary.
author Guido van Rossum <guido@python.org>
date Thu, 23 May 1996 22:49:07 +0000
parents 03c6c18325ea
children 516490c8192c
line wrap: on
line diff
--- a/Python/bltinmodule.c	Thu May 23 22:46:51 1996 +0000
+++ b/Python/bltinmodule.c	Thu May 23 22:49:07 1996 +0000
@@ -28,12 +28,8 @@
 
 #include "node.h"
 #include "graminit.h"
-#include "sysmodule.h"
 #include "bltinmodule.h"
 #include "import.h"
-#include "pythonrun.h"
-#include "ceval.h"
-#include "modsupport.h"
 #include "compile.h"
 #include "eval.h"
 
@@ -356,7 +352,11 @@
 		}
 	}
 	else {
-		v = newlistobject(0);
+		v = PyObject_CallMethod(d, "keys", NULL);
+		if (v == NULL) {
+			PyErr_Clear();
+			v = newlistobject(0);
+		}
 	}
 	DECREF(d);
 	return v;