Skip to content

Commit 22aec2d

Browse files
committedJun 12, 2023
Cpython test
1 parent ae733ae commit 22aec2d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <Python.h>
2+
#include <object.h>
3+
#include <listobject.h>
4+
5+
void print_python_list_info(PyObject *p)
6+
7+
{
8+
long int size = PyList_Size(p);
9+
int i;
10+
PyListObject *obj = (PyListObject *)p;
11+
12+
printf("[*] Size of the Python List = %li\n", size);
13+
printf("[*] Allocated = %li\n", obj->allocated);
14+
for (i = 0; i < size; i++)
15+
{
16+
printf("Element %i: %s\n", i, Py_TYPE(obj->ob_item[i])->tp_name);
17+
}
18+
19+
}

0 commit comments

Comments
 (0)
Please sign in to comment.