[pypy-issue] Issue #2652: Using cffi lib objects as modules (pypy/pypy)

Ronan Lamy issues-reply at bitbucket.org
Mon Sep 11 17:35:59 EDT 2017


New issue 2652: Using cffi lib objects as modules
https://bitbucket.org/pypy/pypy/issues/2652/using-cffi-lib-objects-as-modules

Ronan Lamy:

On Python2 (both PyPy and CPython), it is possible to import names from cffi lib objects, i.e to write `from foo_cffi.lib import bar; do_stuff(bar)` instead of `from foo_cffi import lib; do_stuff(lib.bar)`.

AFAICT, this doesn't work on CPython3.

On pypy3, it appears to sort-of work, but since lib objects don't obey the (implicitly defined and poorly documented) module protocol, they interact poorly with importlib, causing some test failures in lib-python's test_importlib/.

I'm not sure what the best thing to do is and whether cffi needs fixing, but I think CPython3 and pypy3 should behave the same.




More information about the pypy-issue mailing list