Comments (6)
This happens a lot on 2.4 bytecode too.
Some for loops have some trailing continues that weren't in the original code as well.
from pycdc.
@asmunder I am not seeing the behavior you describe on the current pycdc source code.
@mfwass although I have seen this in earlier versions in the pydc test cases I don't see it now. In of itself an additional continue
that wasn't in the source code isn't wrong. For example you might have and I have seen things like
:
while True:
if x = 1:
break
else:
continue
So details matter when reporting a problem.
from pycdc.
@rocky I haven't used unpyc in a little while, however when I was using it the most common decompilation error I would encounter was this:
Original pseudo code:
for i in xrange(20):
blas = bla(i)
Decompiled code:
for i in xrange(20):
blas = bla(i)
continue
It'd just randomly add continues that aren't needed to the end of nearly every for
loop.
from pycdc.
@mfwass If you want to add comments to issues to report random observations you've encountered, sure go ahead. I've run into weirdnesses too when running software. Boy it sucks.
If however, if you'd like to increase the likelihood of those specific problems you encountered getting fixed, then usually the fixers need to reproduce the problem and generally they don't have the time nor inclination to try to reproduce what you have seen at some point in your environment. Details like the specific programs like the above with the python version you ran under is important here.
So yeah, I think I've seen something like what you report above at some point in time. When I tried running the above using the version around Jan 1 2017, I'm not seeing any problem described above. pycdc seems to even get correctly whether continue
was added when it was.
Also, I wouldn't call adding that continue
a bug because it's semantically the same. Hey, wouldn't it also be nice if it also added comments you put in and even reproduced the statements on the same line number? And how about matching the spacing exactly?
Although there are things a decompile program can try to do to get some of this, the program is limited by the information in the bytecode file. Hmm, that's also a useful thing to include in a bug report.
The reality though is that in some cases it is impossible to reconstruct the source code text exactly as written. The Python compiler in some cases improves the code ways that is irreversible.. Specifically, if you write x = 1 + 3
python 3.5.2 produces code x = 4
. A decompiler can't know then from the bytecode whether that's what you really wrote or an infinite number of expressions that evaluate to 4.
from pycdc.
@rocky I haven't used pycdc since reporting this a year ago, when I had to recover from a git footgunning. If you are unable to reproduce with current pycdc version, feel free to close this.
Happy new year and thanks for pycdc!
from pycdc.
@asmunder : same to you. I share your thanks. However I don't work on pycdcc and can't close this issue.
from pycdc.
Related Issues (20)
- failing to build pycdc HOT 6
- pycdc error HOT 7
- Build error with modern gcc HOT 1
- Unsupported argument found for LIST_EXTEND HOT 7
- when did you post,3.11 bro HOT 2
- CreateObject: Got unsupported type 0x27 HOT 2
- Very strange decompiled code. HOT 2
- tos return 0x0 value HOT 2
- Support Python 3.13 decompilation HOT 3
- Bad MAGIC (0x0A0D0DA8) HOT 22
- Python3.11.2 Unsupported opcode: JUMP_BACKWARD HOT 2
- what about using AI to generate py source codes for analysing? HOT 4
- will it support decompiling .pyd file where i build that using c/c++ HOT 2
- Python3.12 CreateObject error HOT 3
- Code flags issue
- Wrong default function parameters decompilation
- missing op maps for 3.11 and 3.12, comments for "initial 3.13 support" misidentify some 3.11/3.12 ops as "3.13 ->" ops HOT 3
- Unsupported opcode: MAKE_CELL HOT 2
- Error when using keyword argument and try structure
- Support for walrus operator
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pycdc.