summaryrefslogtreecommitdiff
path: root/Programs
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2017-05-22 19:46:40 -0700
committerGitHub <noreply@github.com>2017-05-22 19:46:40 -0700
commite377416c10eb0bf055b0728cdcdc4488fdfd3b5f (patch)
tree26dac18a3dfca605d0d09a61603b70a7d635e3b5 /Programs
parent93fc20b73eea3da0b6305aaee951e5dd22d5c408 (diff)
downloadcpython-git-e377416c10eb0bf055b0728cdcdc4488fdfd3b5f.tar.gz
bpo-29102: Add a unique ID to PyInterpreterState. (#1639)
Diffstat (limited to 'Programs')
-rw-r--r--Programs/_testembed.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Programs/_testembed.c b/Programs/_testembed.c
index a68d4fa25f..de88404465 100644
--- a/Programs/_testembed.c
+++ b/Programs/_testembed.c
@@ -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;"