Skip to content

Instantly share code, notes, and snippets.

@hanxi
Last active September 13, 2018 03:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanxi/8825b9eeac36bcc808a1e7ae93c76f9b to your computer and use it in GitHub Desktop.
Save hanxi/8825b9eeac36bcc808a1e7ae93c76f9b to your computer and use it in GitHub Desktop.
Python Dump
static void PrintRefCnt(const char *s, PyObject *obj)
{
printf("PrintRefCnt:%s.%ld\n", s, (long)(obj->ob_refcnt));
}
static void DumpPyObject(const char *s, PyObject *obj)
{
PyObject *str = PyObject_Str(obj);
printf("DumpPyObject:%s.%s\n", s, PyString_AsString(obj));
Py_DECREF(str);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment