Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

3.0.42 depends on ctypes.pythonapi that doesn't exist on PyPy3 #1831

Copy link
Copy link
Closed
@mgorny

Description

@mgorny
Issue body actions

The new release started using ctypes.pythonapi that doesn't exist on PyPy3. As a result, it is no longer possible to import prompt_toolkit on PyPy3, e.g.:

___________________________________________ ERROR collecting tests/test_async_generator.py ____________________________________________
ImportError while importing test module '/tmp/portage/dev-python/prompt-toolkit-3.0.42/work/prompt_toolkit-3.0.42/tests/test_async_generator.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/pypy3.10/site-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/pypy3.10/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/usr/lib/pypy3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/pypy3.10/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
    exec(co, module.__dict__)
tests/test_async_generator.py:5: in <module>
    from prompt_toolkit.eventloop import generator_to_async_generator
src/prompt_toolkit/__init__.py:25: in <module>
    from .application import Application
src/prompt_toolkit/application/__init__.py:3: in <module>
    from .application import Application
src/prompt_toolkit/application/application.py:20: in <module>
    from ctypes import c_int, c_void_p, pythonapi
E   ImportError: cannot import name 'pythonapi' from 'ctypes' (/usr/lib/pypy3.10/ctypes/__init__.py)

It is impossible to use PyPy's API via ctypes, as it relies on header-level C preprocessor definitions, and therefore it is only usable within C extensions. See https://doc.pypy.org/en/latest/discussion/ctypes-implementation.html#discussion-and-limitations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.