Skip to content

./rustpython -m dis: No code object available for dis #2889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
frank-king opened this issue Aug 16, 2021 · 5 comments
Closed

./rustpython -m dis: No code object available for dis #2889

frank-king opened this issue Aug 16, 2021 · 5 comments
Labels
good first issue Good for newcomers

Comments

@frank-king
Copy link
Contributor

frank-king commented Aug 16, 2021

Feature

dis: Disassembler for Python bytecode.

I want to should compiled bytecode for a .py script, and I got this error:

$ ./rustpython -m dis xxx.py
./rustpython: No code object available for dis

In cpython, most of the std module will be pre-compiled during build.

Python Documentation

https://docs.python.org/3.8/library/dis.html

@fanninpm
Copy link
Contributor

See also #367

@coolreader18
Copy link
Member

This is because dis is implemented as a native module, not using cpython's dis.py that's specific to their bytecode format.

@youknowone
Copy link
Member

youknowone commented Nov 28, 2021

I think we can move our native dis module to _dis and create our own dis.py with _test in CPython dis.py.
I am going to create dis.py in #3469, so please feel free to add actual function.

@youknowone
Copy link
Member

I expect cargo run -- -m dis x.py works like python -m dis x.py after resolving this issue

@tai271828
Copy link
Contributor

@youknowone thanks for #3469 , for me it is working like

(rustpython-session) [^_^]─[~/work-my-projects/pyconapac-2021-sprint/rustpython-session/RustPython] tai271828@syakaro: 35 file 300Kb
$ cargo run -- -m dis ./demo.py 
   Compiling rustpython-pylib v0.1.0 (/home/tai271828/work-my-projects/pyconapac-2021-sprint/rustpython-session/RustPython/vm/pylib-crate)
   Compiling rustpython-stdlib v0.1.2 (/home/tai271828/work-my-projects/pyconapac-2021-sprint/rustpython-session/RustPython/stdlib)
   Compiling rustpython-vm v0.1.2 (/home/tai271828/work-my-projects/pyconapac-2021-sprint/rustpython-session/RustPython/vm)
   Compiling rustpython v0.1.2 (/home/tai271828/work-my-projects/pyconapac-2021-sprint/rustpython-session/RustPython)
    Finished dev [unoptimized + debuginfo] target(s) in 1m 05s
     Running `target/debug/rustpython -m dis ./demo.py`
(rustpython-session) [^_^]─[~/work-my-projects/pyconapac-2021-sprint/rustpython-session/RustPython] tai271828@syakaro: 35 file 300Kb
$ 

tai271828 added a commit to tai271828/RustPython that referenced this issue Nov 28, 2021
tai271828 added a commit to tai271828/RustPython that referenced this issue Nov 28, 2021
tai271828 added a commit to tai271828/RustPython that referenced this issue Nov 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants