Skip to content

Navigation Menu

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

[RFC] Adding support for CPython bytecode #1815

Copy link
Copy link
Open
@kmaork

Description

@kmaork
Issue body actions

Summary

Adding support for CPython bytecode will open many new possibilities for testing and using the RustPython VM.

Detailed Explanation

There are many, many projects using the CPython bytecode. If RustPython were to support it, we could ship the RustPython VM as an individual tool, integrable into existing projects. This could be very useful to the RustPython project, by generating countless new test cases for the VM, and by attracting new users and contributors.

An interesting use case is mentioned in #1760 - if the RustPython VM were to support CPython bytecode, a relatively compact WASM compilation of the VM could be distributed to allow lightweight frontend scripting with full python syntax.

Another potential use case is integrating the RustPython VM with CPython by using the frame evaluation API introduced in PEP 523. This will allow users to use CPython normally with an underlying RustPython VM. I am not very familiar with the RustPython VM but I'm sure it might offer some performance gains for specific python projects.

Drawbacks, Rationale, and Alternatives

I am not sure what would be a good way to add support for the CPython bytecode, but I think that generally there are two options:

  1. Create a converter. As offered in Create converters from cpython bytecode #6, it might be possible to implement a full translator between the two bytecode sets.
  2. Change the RustPython bytecode to match CPython's. I have no idea how hard it would be. Hopefully you guys do?

Unresolved Questions

  • There are probably more cases in which an independent rusty CPython bytecode VM is useful. Any ideas?
  • What is a good way to add support for CPython bytecode? Is it possible to create a converter? Is changing the current RustPython bytecode even an option?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-compilerArea: compilerArea: compilerC-compatA discrepancy between RustPython and CPythonA discrepancy between RustPython and CPython

    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.