-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Open
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
Tools/cases_generator/tier1_generator.py
fails if you place comment before PyStackRef_FromPyObjectNew
assignment. Example reproducer (bytecodes.c:291-293):
pure inst(LOAD_CONST, (-- value)) {
// comment
value = PyStackRef_FromPyObjectNew(GETITEM(FRAME_CO_CONSTS, oparg));
}
/python.exe Tools/cases_generator/tier1_generator.py
Traceback (most recent call last):
File "/Users/yyanchii/Desktop/cpython/Tools/cases_generator/tier1_generator.py", line 221, in <module>
data = analyze_files(args.input)
File "/Users/yyanchii/Desktop/cpython/Tools/cases_generator/analyzer.py", line 1184, in analyze_files
return analyze_forest(parser.parse_files(filenames))
File "/Users/yyanchii/Desktop/cpython/Tools/cases_generator/analyzer.py", line 1133, in analyze_forest
desugar_inst(node, instructions, uops)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/yyanchii/Desktop/cpython/Tools/cases_generator/analyzer.py", line 947, in desugar_inst
uop = make_uop("_" + inst.name, inst, op_inputs, uops)
File "/Users/yyanchii/Desktop/cpython/Tools/cases_generator/analyzer.py", line 854, in make_uop
deferred_refs=analyze_deferred_refs(op),
~~~~~~~~~~~~~~~~~~~~~^^^^
File "/Users/yyanchii/Desktop/cpython/Tools/cases_generator/analyzer.py", line 458, in analyze_deferred_refs
raise analysis_error(
"PyStackRef_FromPyObjectNew() must be assigned to an output", tkn
)
File "/Users/yyanchii/Desktop/cpython/Python/bytecodes.c", line 293
^
SyntaxError: PyStackRef_FromPyObjectNew() must be assigned to an output
Problem is in:
cpython/Tools/cases_generator/analyzer.py
Lines 457 to 460 in 22a4421
if len(lhs) != 1 or lhs[0].kind != "IDENTIFIER": | |
raise analysis_error( | |
"PyStackRef_FromPyObjectNew() must be assigned to an output", tkn | |
) |
as lhs
may contain leading comments which are ignored during extraction.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux, macOS, Windows
Linked PRs
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error