Skip to content

Push PyPy3 compatibility to 100% #58

@Technologicat

Description

@Technologicat

PyPy3 looks promising, as it's rumored to be fast, and it supports version 3.6.9 of "the Python standard". Our main target platform just so happens to be Python 3.6.x.

Our PyPy3 compatibility is already near 100%. This issue documents what remains to be done.

  • Test compatibility with PyPy. Most things should work already.
    • Yes, pretty much everything already works. All tests pass except async_raise.
  • Macros? Is the ast close enough to CPython's?
    • Yes, macros work.
  • unpythonic.misc.async_raise? This may or may not work, depending on what is available in PyPy3's ctypes module. (It's only needed for remote Ctrl+C in the REPL server, but that's a nice feature to have.)
    • Doesn't work in PyPy, and without hacking PyPy itself, currently no way to make it work. See details below.
  • Get rid of __del__ methods, since they may be delayed or not called at all, and in most cases having a __del__ is just not pythonic anyway.
    • The one in unpythonic.tco._jump doesn't (really) matter, since its only purpose is to print a warning.
    • The one in unpythonic.dynassign._DynLiveView is more serious. How to get around it? A with block is no solution here, since the _DynLiveView instance is returned by unpythonic.dyn.asdict, so it has indefinite dynamic extent, depending on the code that calls asdict. Requiring users to call a .close() method explicitly just invites omission by accident or even on purpose (e.g. who ever calls socket.shutdown()?). OTOH, maybe _DynLiveView could be a singleton? The dynamic scopes are already context-managed, and that's really all that matters. _DynLiveView singleton FTW. 1a0f0f5. How about for the lose, instead. Can't work, since the dynamic scope stacks are thread-local. Having observers linger around a bit longer than they absolutely need to, or not having them cleaned up when the process exits, are not really a problem. In practice, the old solution should be fine in PyPy, too. Hence, reverted in 089f7cc.
  • Anything else? Add more details here. Maybe refer to Python compatibility and Differences between PyPy and CPython.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions