diff options
author | Victor Stinner <vstinner@python.org> | 2020-06-10 18:08:26 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-10 18:08:26 (GMT) |
commit | 1bcc32f0620d2e99649a6d423284d9496b7b3548 (patch) | |
tree | f42552bb9acbb5d9fd90b47f95a63487ab438262 /Parser | |
parent | 9c24e2e4c10705d95258558348417a28007dac66 (diff) | |
download | cpython-1bcc32f0620d2e99649a6d423284d9496b7b3548.zip cpython-1bcc32f0620d2e99649a6d423284d9496b7b3548.tar.gz cpython-1bcc32f0620d2e99649a6d423284d9496b7b3548.tar.bz2 |
bpo-39465: Use _PyInterpreterState_GET() (GH-20788)
Replace _PyThreadState_GET() with _PyInterpreterState_GET() in:
* get_small_int()
* gcmodule.c: add also get_gc_state() function
* _PyTrash_deposit_object()
* _PyTrash_destroy_chain()
* warnings_get_state()
* Py_GetRecursionLimit()
Cleanup listnode.c: add 'parser' variable.
Diffstat (limited to 'Parser')
-rw-r--r-- | Parser/listnode.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Parser/listnode.c b/Parser/listnode.c index c806b98..41e7a03 100644 --- a/Parser/listnode.c +++ b/Parser/listnode.c @@ -30,8 +30,6 @@ listnode(FILE *fp, node *n) static void list1node(FILE *fp, node *n) { - PyInterpreterState *interp; - if (n == NULL) return; if (ISNONTERMINAL(TYPE(n))) { @@ -40,26 +38,28 @@ list1node(FILE *fp, node *n) list1node(fp, CHILD(n, i)); } else if (ISTERMINAL(TYPE(n))) { - interp = _PyInterpreterState_GET(); + PyInterpreterState *interp = _PyInterpreterState_GET(); + struct _Py_parser_state *parser = &interp->parser; switch (TYPE(n)) { case INDENT: - interp->parser.listnode.level++; + parser->listnode.level++; break; case DEDENT: - interp->parser.listnode.level--; + parser->listnode.level--; break; default: - if (interp->parser.listnode.atbol) { + if (parser->listnode.atbol) { int i; - for (i = 0; i < interp->parser.listnode.level; ++i) + for (i = 0; i < parser->listnode.level; ++i) { fprintf(fp, "\t"); - interp->parser.listnode.atbol = 0; + } + parser->listnode.atbol = 0; } if (TYPE(n) == NEWLINE) { if (STR(n) != NULL) fprintf(fp, "%s", STR(n)); fprintf(fp, "\n"); - interp->parser.listnode.atbol = 1; + parser->listnode.atbol = 1; } else fprintf(fp, "%s ", STR(n)); |