28 ms·
Dis This: Disassemble Python code online
- shpx 4y agoThe user experience could be improved but this already exists: https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename:'1',fontScale:14,fontUsePx:'0',j:1,lang:python,selection:(endColumn:18,endLineNumber:3,positionColumn:18,positionLineNumber:3,selectionStartColumn:18,selectionStartLineNumber:3,startColumn:18,startLineNumber:3),source:'def+feet_to_meters(feet):%0A++++result+%3D+0.3048+*+feet%0A++++return+result'),l:'5',n:'0',o:'Python+source+%231',t:'0')),k:50,l:'4',n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:python311,deviceViewOpen:'1',filters:(b:'0',binary:'1',binaryObject:'1',commentOnly:'0',demangle:'0',directives:'0',execute:'1',intel:'0',libraryCode:'0',trim:'1'),flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:1,lang:python,libs:!(),options:'',selection:(endColumn:1,endLineNumber:1,positionColumn:1,positionLineNumber:1,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1),source:1),l:'5',n:'0',o:'+Python+3.11+(Editor+%231)',t:'0')),k:50,l:'4',n:'0',o:'',s:0,t:'0')),l:'2',n:'0',o:'',t:'0')),version:4 https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename...
- blondin 4y agoby the way, compiler explorer[0] has python support. [0]: https://godbolt.org/ https://godbolt.org/
- hackan 4y agoIt's really neat, I like it! It would be nice to catch exceptions, they are currently blowing up, i.e.: ``` ncaught PythonError: Traceback (most recent call last): File "/lib/python3.11/_pyodide/_base.py", line 460, in eval_code .run(globals, locals) ^^^^^^^^^^^^^^^^^^^^ File "/lib/python3.11/_pyodide/_base.py", line 306, in run coroutine = eval(self.code, globals, locals) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<exec>", line 7, in <module> File "<exec>", line 5, in feet_to_meters ZeroDivisionError: division by zero ```
- pamelafox 4y agoAh yes, good point, I’ll add exception handling. Thanks!
- pamelafox 4y agoFixed, just needed a try/catch: https://github.com/pamelafox/dis-this/pull/5/files#diff-27653c212e1cfe533e4eb2f7d0d3f89604c9de48a09583b4cbbbcbd08a07da79R33 https://github.com/pamelafox/dis-this/pull/5/files#diff-2765...
- xvilka 4y agoRizin[1] (and therefore Cutter[2]) supports interactive disassembly and analysis (but not decompilation) of the Python bytecode[3][4]. Apart from that it also supports Java and Lua bytecode for different versions. [1] https://rizin.re https://rizin.re [2] https://cutter.re https://cutter.re [3] https://github.com/rizinorg/rizin/tree/dev/librz/asm/arch/pyc https://github.com/rizinorg/rizin/tree/dev/librz/asm/arch/py... [4] https://github.com/rizinorg/rizin/blob/dev/librz/analysis/p/analysis_pyc.c https://github.com/rizinorg/rizin/blob/dev/librz/analysis/p/...
- 36933 4y agoYou could have added that you’re part of this project, for transparency reasons.
- mtlmtlmtlmtl 4y agoCommon Lisp has had this for decades, no libraries needed.