vxgmichel/aioconsole

Incompatible with Python 3.11.7 and 3.12.1

achimnol opened this issue · 2 comments

CPython 3.11.7 and 3.12.1 made an internal change (backported from 3.13):
python/cpython@19a266c
and this makes aioconsole to break.
(refs python/cpython#111384, python/cpython#111516)

Just running apython and pressing Enter makes it hanging.
In my test case involving aioconsole, it raises an error:

Traceback (most recent call last):
  File "/home/joongi/.pyenv/versions/aiomon-dev/lib/python3.11/site-packages/aioconsole/server.py", line 14, in handle_connect
    await interface.interact(banner=banner, stop=False, handle_sigint=False)
  File "/home/joongi/.pyenv/versions/aiomon-dev/lib/python3.11/site-packages/aioconsole/console.py", line 160, in interact
    await self._interact(banner)
  File "/home/joongi/.pyenv/versions/aiomon-dev/lib/python3.11/site-packages/aioconsole/console.py", line 204, in _interact
    more = await self.push(line)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/joongi/.pyenv/versions/aiomon-dev/lib/python3.11/site-packages/aioconsole/console.py", line 219, in push
    more = await self.runsource(source, self.filename)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/joongi/.pyenv/versions/aiomon-dev/lib/python3.11/site-packages/aioconsole/console.py", line 99, in runsource
    code = self.compile(source, filename, symbol)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/joongi/.pyenv/versions/3.11.7/lib/python3.11/codeop.py", line 160, in __call__
    return _maybe_compile(self.compiler, source, filename, symbol)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/joongi/.pyenv/versions/3.11.7/lib/python3.11/codeop.py", line 73, in _maybe_compile
    return compiler(source, filename, symbol, incomplete_input=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: compile_for_aexec() got an unexpected keyword argument 'incomplete_input'

I think aioconsole.execute.compile_for_aexec() method should be updated to work with Python 3.11.7 and 3.12.1.

Thanks a lot @achimnol for the investigation, the report and the fix :)

Release 0.7.0 is now out 🎉

Thanks for quick update!