summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-04-04 22:04:20 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-04-04 22:04:20 (GMT)
commita701388de1135241b5a8e4c970e06c0e83a66dc0 (patch)
tree5faf9071aa6fd65c55424f1e5851bce8634a1bb7 /Objects/object.c
parentd4dc6dc9e7e1fc1708c243b308a27e2faf59a3ea (diff)
downloadcpython-a701388de1135241b5a8e4c970e06c0e83a66dc0.zip
cpython-a701388de1135241b5a8e4c970e06c0e83a66dc0.tar.gz
cpython-a701388de1135241b5a8e4c970e06c0e83a66dc0.tar.bz2
Rename _PyIter_GetBuiltin to _PyObject_GetBuiltin, and do not include it in the stable ABI.
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 1b7f609..5bafbc0 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -1026,6 +1026,19 @@ PyObject_SelfIter(PyObject *obj)
return obj;
}
+/* Convenience function to get a builtin from its name */
+PyObject *
+_PyObject_GetBuiltin(const char *name)
+{
+ PyObject *mod, *attr;
+ mod = PyImport_ImportModule("builtins");
+ if (mod == NULL)
+ return NULL;
+ attr = PyObject_GetAttrString(mod, name);
+ Py_DECREF(mod);
+ return attr;
+}
+
/* Helper used when the __next__ method is removed from a type:
tp_iternext is never NULL and can be safely called without checking
on every iteration.