No project description provided
Project description
cdis - a consistent Python disassembler
Important
The cdis bytecode format will not be considered stable until the 1.0.0 release.
The 0.x.y releases may have breaking changes in both the bytecode and the API exposed.
What is it?
cdis, pronounced "see this", is a Python disassembler that produce consistent results across Python versions. CPython bytecode is neither forward or backwards compatible, so it outputs bytecode for the "cdis Virtual Machine", which when executed, has the exact same behaviour as CPython's bytecode.
Why would I use it?
- To write a Python compiler to any language of your choice
- To determine what symbols a function uses
- As a compiler target to generate Python code from another language
Known differences with CPython
- Different behaviour of
locals()inside list comprehensions. In particular, we use a synthetic variable for the iterator variable instead of reusing the name. CPython changed the behaviour oflocals()in list comprehension in 3.12, so this is undefined behaviour. - Different behaviour of when match variables are bound.
Technically, Python allows binding even when subpatterns fail.
That being said, CPython does appear to have consistent behaviour of delaying
binding until all subpatterns succeed.
As such, a future version of
cdiswill probably match CPython behaviour.
Missing features
- Using non-constant except types. (Planned)
- Async for (Planned)
- Async with (Planned)
- Generator comprehensions (list, dict and set comprehensions are supported) (Planned)
- Defining classes within functions (Planned)
- User customizable optimization passes (Planned)
- User customizable VM tracer (Planned)
- A guide on how to actually use
cdis(Planned).
Run tests
Install test dependencies
pip install "pytest>8" "coverage" "tox"
pip install -e .
Run tests on current python version
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cdis-0.0.0a0.tar.gz.
File metadata
- Download URL: cdis-0.0.0a0.tar.gz
- Upload date:
- Size: 55.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7036697ffee239e120988cc34fb62cc3e690177614b135a21e1e2ab9614a8ec4
|
|
| MD5 |
720d6e256a72a73d088927ca1720c2e9
|
|
| BLAKE2b-256 |
a7631cbbdd1c0e9416a5408db8f811b9b2bc522fcf19f8240675694d59641c16
|
Provenance
The following attestation bundles were made for cdis-0.0.0a0.tar.gz:
Publisher:
release.yml on cdis-vm/cdis
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cdis-0.0.0a0.tar.gz -
Subject digest:
7036697ffee239e120988cc34fb62cc3e690177614b135a21e1e2ab9614a8ec4 - Sigstore transparency entry: 392164325
- Sigstore integration time:
-
Permalink:
cdis-vm/cdis@9482e462f6af0542d33e6372aa11a16297a4c15c -
Branch / Tag:
refs/tags/0.0.0a0 - Owner: https://github.com/cdis-vm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9482e462f6af0542d33e6372aa11a16297a4c15c -
Trigger Event:
release
-
Statement type:
File details
Details for the file cdis-0.0.0a0-py3-none-any.whl.
File metadata
- Download URL: cdis-0.0.0a0-py3-none-any.whl
- Upload date:
- Size: 40.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3cc5c3409b10706de6a5d8d92bdf321b8c71521f4199db8053ec31131fc44384
|
|
| MD5 |
cd243792ae230224b538c44a3d7c0d7d
|
|
| BLAKE2b-256 |
657a01873fef2d633824f60a8210b43fe8a228899accd93fd87a0d422463bd65
|
Provenance
The following attestation bundles were made for cdis-0.0.0a0-py3-none-any.whl:
Publisher:
release.yml on cdis-vm/cdis
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cdis-0.0.0a0-py3-none-any.whl -
Subject digest:
3cc5c3409b10706de6a5d8d92bdf321b8c71521f4199db8053ec31131fc44384 - Sigstore transparency entry: 392164352
- Sigstore integration time:
-
Permalink:
cdis-vm/cdis@9482e462f6af0542d33e6372aa11a16297a4c15c -
Branch / Tag:
refs/tags/0.0.0a0 - Owner: https://github.com/cdis-vm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9482e462f6af0542d33e6372aa11a16297a4c15c -
Trigger Event:
release
-
Statement type: