Skip to content
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

dis: update for py311 #7649

Merged
merged 2 commits into from
Apr 17, 2022
Merged

dis: update for py311 #7649

merged 2 commits into from
Apr 17, 2022

Conversation

hauntsaninja
Copy link
Collaborator

No description provided.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Comment on lines +48 to +69
if sys.version_info >= (3, 11):
class Instruction(NamedTuple):
opname: str
opcode: int
arg: int | None
argval: Any
argrepr: str
offset: int
starts_line: int | None
is_jump_target: bool
positions: Positions | None = ...

else:
class Instruction(NamedTuple):
opname: str
opcode: int
arg: int | None
argval: Any
argrepr: str
offset: int
starts_line: int | None
is_jump_target: bool
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be simpler with if statement inside the class:

Suggested change
if sys.version_info >= (3, 11):
class Instruction(NamedTuple):
opname: str
opcode: int
arg: int | None
argval: Any
argrepr: str
offset: int
starts_line: int | None
is_jump_target: bool
positions: Positions | None = ...
else:
class Instruction(NamedTuple):
opname: str
opcode: int
arg: int | None
argval: Any
argrepr: str
offset: int
starts_line: int | None
is_jump_target: bool
class Instruction(NamedTuple):
opname: str
opcode: int
arg: int | None
argval: Any
argrepr: str
offset: int
starts_line: int | None
is_jump_target: bool
if sys.version_info >= (3, 11):
positions: Positions | None = ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, at least mypy doesn't like that

@Akuli Akuli merged commit a24ce3f into python:master Apr 17, 2022
@hauntsaninja hauntsaninja deleted the dis branch April 17, 2022 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants