Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-105481: add flags to each instr in the opcode metadata table, to replace opcode.hasarg/hasname/hasconst #105482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 13, 2023
Prev Previous commit
Next Next commit
forbid reserved words 'co_consts', 'co_names'
  • Loading branch information
iritkatriel committed Jun 13, 2023
commit 0d3dc8e67759159f04a29ec9806f5a0d47f5323b
8 changes: 8 additions & 0 deletions 8 Tools/cases_generator/generate_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
UNUSED = "unused"
BITS_PER_CODE_UNIT = 16

RESERVED_WORDS = {
"co_consts" : "Use FRAME_CO_CONSTS.",
"co_names": "Use FRAME_CO_NAMES.",
}

arg_parser = argparse.ArgumentParser(
description="Generate the code for the interpreter switch.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
Expand Down Expand Up @@ -605,6 +610,9 @@ def parse_file(self, filename: str, instrs_idx: dict[str, int]) -> None:
thing: parser.InstDef | parser.Macro | parser.Family | None
thing_first_token = psr.peek()
while thing := psr.definition():
if ws := [w for w in RESERVED_WORDS if variable_used(thing, w)]:
self.error(f"'{ws[0]}' is a reserved word. {RESERVED_WORDS[ws[0]]}", thing)

match thing:
case parser.InstDef(name=name):
if name in self.instrs:
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.