diff options
author | Lysandros Nikolaou <lisandrosnik@gmail.com> | 2024-05-07 14:31:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-07 14:31:56 (GMT) |
commit | e5413ec7831608f6cb4f39d805785cb1d7b67702 (patch) | |
tree | 2682de33e27eb0cf3161bfacd5f606db9319b105 /Lib/_pyrepl/reader.py | |
parent | 71080b8a0fe5da46fb97659060db76fd95a3fb61 (diff) | |
download | cpython-e5413ec7831608f6cb4f39d805785cb1d7b67702.zip cpython-e5413ec7831608f6cb4f39d805785cb1d7b67702.tar.gz cpython-e5413ec7831608f6cb4f39d805785cb1d7b67702.tar.bz2 |
gh-118682: Revert forcing str commands, allow class commands in pyrepl (#118709)
Diffstat (limited to 'Lib/_pyrepl/reader.py')
-rw-r--r-- | Lib/_pyrepl/reader.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/_pyrepl/reader.py b/Lib/_pyrepl/reader.py index e36f65c..d84c164 100644 --- a/Lib/_pyrepl/reader.py +++ b/Lib/_pyrepl/reader.py @@ -568,12 +568,16 @@ class Reader: """`cmd` is a tuple of "event_name" and "event", which in the current implementation is always just the "buffer" which happens to be a list of single-character strings.""" - assert isinstance(cmd[0], str) trace("received command {cmd}", cmd=cmd) - command_type = self.commands.get(cmd[0], commands.invalid_command) - command = command_type(self, *cmd) # type: ignore[arg-type] + if isinstance(cmd[0], str): + command_type = self.commands.get(cmd[0], commands.invalid_command) + elif isinstance(cmd[0], type): + command_type = cmd[0] + else: + return # nothing to do + command = command_type(self, *cmd) # type: ignore[arg-type] command.do() self.after_command(command) |