Skip to content

Commit c1edbfa

Browse files
author
Remi Hakim
committed
[pyObject] Add support for PyObject_Dir
1 parent f5b703a commit c1edbfa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

object.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ func (self *PyObject) GetAttr(attr_name *PyObject) *PyObject {
142142
return togo(C.PyObject_GetAttr(self.ptr, attr_name.ptr))
143143
}
144144

145+
// PyObject* PyObject_Dir()
146+
// Return value: New reference.
147+
// This is equivalent to the Python expression dir(o), returning a (possibly empty) list of strings appropriate for the object argument, or NULL if there was an error. If the argument is NULL, this is like the Python dir(), returning the names of the current locals; in this case, if no execution frame is active then NULL is returned but PyErr_Occurred() will return false.
148+
func (self *PyObject) PyObject_Dir() *PyObject {
149+
return togo(C.PyObject_Dir(self.ptr))
150+
151+
}
152+
145153
// PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name)
146154
// Return value: New reference.
147155
// Retrieve an attribute named attr_name from object o. Returns the attribute value on success, or NULL on failure. This is the equivalent of the Python expression o.attr_name.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy