[Python-checkins] CVS: python/dist/src/Include object.h,2.88,2.89

Tim Peters tim_one@users.sourceforge.net
Tue, 04 Sep 2001 15:08:58 -0700


Update of /cvsroot/python/python/dist/src/Include
In directory usw-pr-cvs1:/tmp/cvs-serv11322/python/Include

Modified Files:
	object.h 
Log Message:
At Guido's suggestion, here's a new C API function, PyObject_Dir(), like
__builtin__.dir().  Moved the guts from bltinmodule.c to object.c.


Index: object.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/object.h,v
retrieving revision 2.88
retrieving revision 2.89
diff -C2 -d -r2.88 -r2.89
*** object.h	2001/08/29 23:46:35	2.88
--- object.h	2001/09/04 22:08:56	2.89
***************
*** 347,350 ****
--- 347,358 ----
  extern DL_IMPORT(void) (*PyObject_ClearWeakRefs)(PyObject *);
  
+ /* PyObject_Dir(obj) acts like Python __builtin__.dir(obj), returning a
+    list of strings.  PyObject_Dir(NULL) is like __builtin__.dir(),
+    returning the names of the current locals.  In this case, if there are
+    no current locals, NULL is returned, and PyErr_Occurred() is false.
+ */
+ extern DL_IMPORT(PyObject *) PyObject_Dir(PyObject *);
+ 
+ 
  /* Helpers for printing recursive container types */
  extern DL_IMPORT(int) Py_ReprEnter(PyObject *);