bpo-40268: Rename _PyInterpreterState_GET_UNSAFE() (GH-19509)
Rename _PyInterpreterState_GET_UNSAFE() to _PyInterpreterState_GET()
for consistency with _PyThreadState_GET() and to have a shorter name
(help to fit into 80 columns).
Add also "assert(tstate != NULL);" to the function.
diff --git a/Parser/listnode.c b/Parser/listnode.c
index f53b265..3bcc03e 100644
--- a/Parser/listnode.c
+++ b/Parser/listnode.c
@@ -3,7 +3,7 @@
#include "Python.h"
#include "pycore_interp.h" // PyInterpreterState.parser
-#include "pycore_pystate.h" // _PyInterpreterState_GET_UNSAFE
+#include "pycore_pystate.h" // _PyInterpreterState_GET
#include "token.h"
#include "node.h"
@@ -20,7 +20,7 @@
static void
listnode(FILE *fp, node *n)
{
- PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE();
+ PyInterpreterState *interp = _PyInterpreterState_GET();
interp->parser.listnode.level = 0;
interp->parser.listnode.atbol = 1;
@@ -40,7 +40,7 @@
list1node(fp, CHILD(n, i));
}
else if (ISTERMINAL(TYPE(n))) {
- interp = _PyInterpreterState_GET_UNSAFE();
+ interp = _PyInterpreterState_GET();
switch (TYPE(n)) {
case INDENT:
interp->parser.listnode.level++;