Giter VIP home page Giter VIP logo

Comments (6)

mfwass avatar mfwass commented on August 25, 2024

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.

rocky avatar rocky commented on August 25, 2024

@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.

mfwass avatar mfwass commented on August 25, 2024

@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.

rocky avatar rocky commented on August 25, 2024

@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.

asmunder avatar asmunder commented on August 25, 2024

@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.

rocky avatar rocky commented on August 25, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.