Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • pypy pypy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 668
    • Issues 668
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

Mercurial Paris conference scheduled ! Main event : 2022-09-22. Call for papers deadline: 2022-06-17.

  • PyPy
  • pypypypy
  • Issues
  • #3642

Closed
Open
Created Jan 20, 2022 by André Roberge@aroberge

Different exception raised in PyPy and cPython on Windows when importing readline

Trying to import readling on Windows raises a different exception when using PyPy compared with cPython.

First, doing it with cPython

>>> try:
...    import readline
... except ModuleNotFoundError:
...    print("caught")
...
caught

Next, with PyPy.

>>>> try:
....    import readline
.... except ModuleNotFoundError:
....    print("caught")
....
Traceback (most recent call last):
  File "C:\Users\Andre\bin\pypy3.8-v7.3.7-win64\Lib\readline.py", line 10, in <module>
    from pyrepl.readline import *
  File "C:\Users\Andre\bin\pypy3.8-v7.3.7-win64\Lib\pyrepl\readline.py", line 33, in <module>
    from pyrepl.unix_console import UnixConsole, _error
  File "C:\Users\Andre\bin\pypy3.8-v7.3.7-win64\Lib\pyrepl\unix_console.py", line 22, in <module>
    import termios, select, os, struct, errno
ModuleNotFoundError: No module named 'termios'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "C:\Users\Andre\bin\pypy3.8-v7.3.7-win64\Lib\readline.py", line 14, in <module>
    raise ImportError("the 'readline' module is not available on Windows"
ImportError: the 'readline' module is not available on Windows (on either PyPy or CPython)
>>>>

Of course, the ImportError exception could be caught ... but, since it is raised explicitly in the PyPy readline module, it might make sense to raise a ModuleNotFoundError instead.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking