Skip to content

Commit 60dafbb

Browse files
committed
gh-142349: Fix build errors from PEP 810
The PEP 810 commit added an is_lazy parameter to _PyAST_ImportFrom but did not update the test_peg_generator test that calls this function directly from a custom grammar. It also introduced a trailing comma in the PyImport_LazyImportsMode enum which is invalid under C++03 with -pedantic-errors, breaking test_cppext. Pass 0 for the new is_lazy argument in the test grammar's _PyAST_ImportFrom calls, and remove the trailing comma from the enum definition to restore C++03 compatibility.
1 parent 46d5106 commit 60dafbb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Include/import.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ PyAPI_FUNC(int) PyImport_AppendInittab(
9191
typedef enum {
9292
PyImport_LAZY_NORMAL,
9393
PyImport_LAZY_ALL,
94-
PyImport_LAZY_NONE,
94+
PyImport_LAZY_NONE
9595
} PyImport_LazyImportsMode;
9696

9797
#ifndef Py_LIMITED_API

Lib/test/test_peg_generator/test_c_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,9 @@ def test_same_name_different_types(self) -> None:
356356
grammar_source = """
357357
start[mod_ty]: a[asdl_stmt_seq*]=import_from+ NEWLINE ENDMARKER { _PyAST_Module(a, NULL, p->arena)}
358358
import_from[stmt_ty]: ( a='from' !'import' c=simple_name 'import' d=import_as_names_from {
359-
_PyAST_ImportFrom(c->v.Name.id, d, 0, EXTRA) }
359+
_PyAST_ImportFrom(c->v.Name.id, d, 0, 0, EXTRA) }
360360
| a='from' '.' 'import' c=import_as_names_from {
361-
_PyAST_ImportFrom(NULL, c, 1, EXTRA) }
361+
_PyAST_ImportFrom(NULL, c, 1, 0, EXTRA) }
362362
)
363363
simple_name[expr_ty]: NAME
364364
import_as_names_from[asdl_alias_seq*]: a[asdl_alias_seq*]=','.import_as_name_from+ { a }

0 commit comments

Comments
 (0)