prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.1k stars 717 forks source link

Disable workaround for ipython >= 8.18 #1821

Closed tornaria closed 6 months ago

tornaria commented 7 months ago

Since ipython 8.18 already merged https://github.com/ipython/ipython/pull/14241, this workaround is no longer necessary. Moreover, the workaround gives a deprecation warning in python 3.12.

This PR uses the test sys.modules['IPython'].version_info < (8, 18, 0, '') to apply the workaround only in older ipython.

In case the IPython module is not loaded this will raiseKeyErrorand correctlyreturn Falsethanks to theexcept BaseException` already there.

See: https://github.com/prompt-toolkit/python-prompt-toolkit/pull/1811#issuecomment-1827043359

Cc: @jonathanslenders

jonathanslenders commented 6 months ago

Thanks!