prompt-toolkit / prompt-toolkit/python-prompt-toolkit
local variable 'mouse_modifiers' referenced before assignment
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
Since upgrading from prompt-toolkit==3.0.19 to prompt-toolkit==3.0.28, I started seeing this issue pretty frequently.
File "/usr/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/root/.local/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 711, in read_from_input
self.key_processor.process_keys()
File "/root/.local/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 270, in process_keys
self._process_coroutine.send(key_press)
File "/root/.local/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 185, in _process
self._call_handler(matches[-1], key_sequence=buffer[:])
File "/root/.local/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 320, in _call_handler
handler.call(event)
File "/root/.local/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 124, in call
result = self.handler(event)
File "/root/.local/lib/python3.9/site-packages/prompt_toolkit/key_binding/bindings/mouse.py", line 279, in _
modifiers=mouse_modifiers,
Exception local variable 'mouse_modifiers' referenced before assignment
Press ENTER to continue...```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in prompt_toolkit/key_binding/bindings/mouse.py at the handler location shown in the traceback, and compare the mouse-event paths between prompt-toolkit 3.0.19 and 3.0.28. Reproduce the reported event-loop failure if possible; done means the local-variable exception no longer occurs for the affected mouse input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100