Skip to content

Instantly share code, notes, and snippets.

@justdoit0823
Created July 3, 2017 00:56
Show Gist options
  • Save justdoit0823/ef7bc925a563b5f0aab8334352c8cfd4 to your computer and use it in GitHub Desktop.
Save justdoit0823/ef7bc925a563b5f0aab8334352c8cfd4 to your computer and use it in GitHub Desktop.
#include <Python.h>
#include "stdio.h"
int main(int argc, char * argv[]){
int i = 0;
PyTypeObject ptype, btype = PyType_Type, PyBaseObject_Type;
printf("i 0x%lx.\n", (unsigned long)&i);
printf("type name %s.\n", PyType_Type.tp_name);
printf("type 0x%lx, descr get %lx.\n", (unsigned long)&PyType_Type, (unsigned long)PyType_Type.tp_descr_get);
printf("object descr get %lx.\n", (unsigned long)PyBaseObject_Type.tp_descr_get);
PyType_Ready(&PyBaseObject_Type);
PyType_Ready(&PyType_Type);
/* PyType_Ready(&ptype); */
/* printf("descr get %lx.\n", (unsigned long)ptype.tp_descr_get); */
printf("type descr get %x.\n", (unsigned int)PyType_Type.tp_descr_get);
printf("object descr get %x.\n", (unsigned int)PyBaseObject_Type.tp_descr_get);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment