Staging
v0.5.1
https://github.com/python/cpython
Revision 6e770fc4fe511a3b40169307c91e9093c90f7eef authored by Miss Islington (bot) on 08 September 2020, 23:36:07 UTC, committed by GitHub on 08 September 2020, 23:36:07 UTC


This is a trivial PR to fix a typo in a docstring in typing.py. From reverences -> references
(cherry picked from commit 84ef33c5117acd9867781135a9aeb62052432e8a)


Co-authored-by: Graham Bleaney <gbleaney@gmail.com>
1 parent 1671b0e
Raw File
Tip revision: 6e770fc4fe511a3b40169307c91e9093c90f7eef authored by Miss Islington (bot) on 08 September 2020, 23:36:07 UTC
[3.9] Fix typo in typing.py (GH-22121) (GH-22156)
Tip revision: 6e770fc
listnode.c

/* List a node on a file */

#include "Python.h"
#include "pycore_interp.h"        // PyInterpreterState.parser
#include "pycore_pystate.h"       // _PyInterpreterState_GET()
#include "token.h"
#include "node.h"

/* Forward */
static void list1node(FILE *, node *);
static void listnode(FILE *, node *);

void
PyNode_ListTree(node *n)
{
    listnode(stdout, n);
}

static void
listnode(FILE *fp, node *n)
{
    PyInterpreterState *interp = _PyInterpreterState_GET();

    interp->parser.listnode.level = 0;
    interp->parser.listnode.atbol = 1;
    list1node(fp, n);
}

static void
list1node(FILE *fp, node *n)
{
    PyInterpreterState *interp;

    if (n == NULL)
        return;
    if (ISNONTERMINAL(TYPE(n))) {
        int i;
        for (i = 0; i < NCH(n); i++)
            list1node(fp, CHILD(n, i));
    }
    else if (ISTERMINAL(TYPE(n))) {
        interp = _PyInterpreterState_GET();
        switch (TYPE(n)) {
        case INDENT:
            interp->parser.listnode.level++;
            break;
        case DEDENT:
            interp->parser.listnode.level--;
            break;
        default:
            if (interp->parser.listnode.atbol) {
                int i;
                for (i = 0; i < interp->parser.listnode.level; ++i)
                    fprintf(fp, "\t");
                interp->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;
            }
            else
                fprintf(fp, "%s ", STR(n));
            break;
        }
    }
    else
        fprintf(fp, "? ");
}
back to top