Anonymous committed 65ee7a4

added pyobjc_id() function

Comments (0)

Files changed (1)


 static NSAutoreleasePool* global_release_pool = nil;
+  "pyobjc_id(obj) -> int\n"
+  "\n"
+  "Return the id of the underlying NSObject as an int."
+static PyObject*
+pyobjc_id(PyObject* self __attribute__((__unused__)), PyObject* args,
+PyObject *kwds)
+	static char* keywords[] = { "obj", NULL };
+	PyObject *o;
+	if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:pyobjc_id",
+		keywords, &o)) {
+		return NULL;
+	}
+	if (!PyObjCObject_Check(o)) {
+		PyErr_SetString(PyExc_TypeError, "not an Objective-C object");
+		return NULL;
+	}
+	return PyInt_FromLong((long)PyObjCObject_GetObject(o));
   "repythonify(obj, type='@') -> object\n"
 	{ "getNSNumberWrapper", (PyCFunction)getNSNumberWrapper, METH_VARARGS|METH_KEYWORDS, getNSNumberWrapper_doc },
 	{ "setVerbose", (PyCFunction)setVerbose, METH_VARARGS|METH_KEYWORDS, setVerbose_doc },
 	{ "getVerbose", (PyCFunction)getVerbose, METH_VARARGS|METH_KEYWORDS, getVerbose_doc },
+	{ "pyobjc_id", (PyCFunction)pyobjc_id, METH_VARARGS|METH_KEYWORDS, pyobjc_id_doc },
 	{ "repythonify", (PyCFunction)repythonify, METH_VARARGS|METH_KEYWORDS, repythonify_doc },
 	{ "setStrBridgeEnabled", (PyCFunction)setStrBridgeEnabled, METH_VARARGS|METH_KEYWORDS, setStrBridgeEnabled_doc },
 	{ "getStrBridgeEnabled", (PyCFunction)getStrBridgeEnabled, METH_VARARGS|METH_KEYWORDS, getStrBridgeEnabled_doc },
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.