# HG changeset patch # Parent 7d9885fd6777dc51eda20a0f25cb67f9e162113a Issue #4347: Fix dependencies between pgen, parsetok.c and graminit.h diff -r 7d9885fd6777 Makefile.pre.in --- a/Makefile.pre.in Sat Nov 05 01:56:58 2016 +0000 +++ b/Makefile.pre.in Sat Nov 05 02:27:58 2016 +0000 @@ -819,6 +819,7 @@ $(OPCODE_H_GEN) Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H) +Parser/parsetok.o: $(GRAMMAR_H) Python/getplatform.o: $(srcdir)/Python/getplatform.c $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c diff -r 7d9885fd6777 Misc/NEWS --- a/Misc/NEWS Sat Nov 05 01:56:58 2016 +0000 +++ b/Misc/NEWS Sat Nov 05 02:27:58 2016 +0000 @@ -389,6 +389,8 @@ Build ----- +- Issue #4347: Fix dependencies between pgen, parsetok.c and graminit.h. + - Issue #28444: Fix missing extensions modules when cross compiling. - Issue #28208: Update Windows build and OS X installers to use SQLite 3.14.2. diff -r 7d9885fd6777 Parser/parsetok.c --- a/Parser/parsetok.c Sat Nov 05 01:56:58 2016 +0000 +++ b/Parser/parsetok.c Sat Nov 05 02:27:58 2016 +0000 @@ -8,13 +8,17 @@ #include "parser.h" #include "parsetok.h" #include "errcode.h" -#include "graminit.h" + +#ifndef PGEN +# include "graminit.h" +#endif /* Forward */ static node *parsetok(struct tok_state *, grammar *, int, perrdetail *, int *); static int initerr(perrdetail *err_ret, PyObject * filename); +#ifndef PGEN /* Parse input coming from a string. Return error code, print some errors. */ node * PyParser_ParseString(const char *s, grammar *g, int start, perrdetail *err_ret) @@ -60,10 +64,8 @@ return NULL; } -#ifndef PGEN Py_INCREF(err_ret->filename); tok->filename = err_ret->filename; -#endif return parsetok(tok, g, start, err_ret, flags); } @@ -74,7 +76,6 @@ { node *n; PyObject *filename = NULL; -#ifndef PGEN if (filename_str != NULL) { filename = PyUnicode_DecodeFSDefault(filename_str); if (filename == NULL) { @@ -82,13 +83,11 @@ return NULL; } } -#endif n = PyParser_ParseStringObject(s, filename, g, start, err_ret, flags); -#ifndef PGEN Py_XDECREF(filename); -#endif return n; } +#endif /* Parse input coming from a file. Return error code, print some errors. */ @@ -329,7 +328,9 @@ err_ret->text[len] = '\0'; } } - } else if (tok->encoding != NULL) { + } +#ifndef PGEN + else if (tok->encoding != NULL) { /* 'nodes->n_str' uses PyObject_*, while 'tok->encoding' was * allocated using PyMem_ */ @@ -352,6 +353,7 @@ } done: +#endif PyTokenizer_Free(tok); return n;