From e377416c10eb0bf055b0728cdcdc4488fdfd3b5f Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Mon, 22 May 2017 19:46:40 -0700 Subject: bpo-29102: Add a unique ID to PyInterpreterState. (#1639) --- Programs/_testembed.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Programs') 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 +#include #include /********************************************************* @@ -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;" -- cgit v1.2.1