mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-29102: Add a unique ID to PyInterpreterState. (#1639)
This commit is contained in:
parent
93fc20b73e
commit
e377416c10
8 changed files with 152 additions and 7 deletions
|
@ -1,4 +1,5 @@
|
|||
#include <Python.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/*********************************************************
|
||||
|
@ -22,9 +23,13 @@ static void _testembed_Py_Initialize(void)
|
|||
|
||||
static void print_subinterp(void)
|
||||
{
|
||||
/* Just output some debug stuff */
|
||||
/* Output information about the interpreter in the format
|
||||
expected in Lib/test/test_capi.py (test_subinterps). */
|
||||
PyThreadState *ts = PyThreadState_Get();
|
||||
printf("interp %p, thread state %p: ", ts->interp, ts);
|
||||
PyInterpreterState *interp = ts->interp;
|
||||
int64_t id = PyInterpreterState_GetID(interp);
|
||||
printf("interp %lu <0x%" PRIXPTR ">, thread state <0x%" PRIXPTR ">: ",
|
||||
id, (uintptr_t)interp, (uintptr_t)ts);
|
||||
fflush(stdout);
|
||||
PyRun_SimpleString(
|
||||
"import sys;"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue