Skip to content

Commit 1b97477

Browse files
Fix the stable ABI.
1 parent 8375a8d commit 1b97477

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Include/cpython/pystate.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ struct _ts {
268268
// Alias for backward compatibility with Python 3.8
269269
#define _PyInterpreterState_Get PyInterpreterState_Get
270270

271+
/* An alias for the internal _PyThreadState_New(),
272+
kept for stable ABI compatibility. */
273+
PyAPI_FUNC(PyThreadState *) _PyThreadState_Prealloc(PyInterpreterState *);
274+
271275
/* Similar to PyThreadState_Get(), but don't issue a fatal error
272276
* if it is NULL. */
273277
PyAPI_FUNC(PyThreadState *) _PyThreadState_UncheckedGet(void);

Python/pystate.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,13 @@ _PyThreadState_New(PyInterpreterState *interp)
13211321
return new_threadstate(interp);
13221322
}
13231323

1324+
// We keep this for stable ABI compabibility.
1325+
PyThreadState *
1326+
_PyThreadState_Prealloc(PyInterpreterState *interp)
1327+
{
1328+
return _PyThreadState_New(interp);
1329+
}
1330+
13241331
// We keep this around for (accidental) stable ABI compatibility.
13251332
// Realisically, no extensions are using it.
13261333
void

0 commit comments

Comments
 (0)