Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Scanner30 Class instantiate self.version as a tuple (3, 0) but expects a float #414

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
mirkofalchetto opened this issue Nov 3, 2022 · 2 comments

Comments

@mirkofalchetto
Copy link

Description

In version 3.8.0 when trying to decompile python 3.0 code looks like the self.version member of instantiated Scanner30 class expects in its class methods a float value instead of the provided tuple (major, minor) == (3, 0).

How to Reproduce

$ version_info = (3, 0)
$ uncompyle6.main.decompile(version_info, my_code, out_string_stream)

Output Given

      uncompyle6.main.decompile(version_info, code, string_stream)
    File "C:\my-env\lib\site-packages\uncompyle6\main.py", line 133, in decompile
      deparsed = deparse_fn(
    File "C:\my-env\lib\site-packages\uncompyle6\semantics\pysource.py", line 2576, in code_deparse
      tokens, customize = scanner.ingest(
    File "C:\my-env\lib\site-packages\uncompyle6\scanners\scanner3.py", line 292, in ingest
      jump_targets = self.find_jump_targets(show_asm)
    File "C:\my-env\lib\site-packages\uncompyle6\scanners\scanner3.py", line 583, in find_jump_targets
      self.detect_control_flow(offset, targets, i)
    File "C:\my-env\lib\site-packages\uncompyle6\scanners\scanner30.py", line 440, in detect_control_flow
      elif self.version >= 3.5:
  TypeError: '>=' not supported between instances of 'tuple' and 'float'

Expected behavior

The code should be decompiled successfully

Environment

  • python 3.9.13
  • uncompyle 3.8.0
  • Windows OS

Workarounds

None

Priority

Additional Context

@rocky rocky closed this as completed in d6dcaff Nov 3, 2022
@mirkofalchetto
Copy link
Author

Thanks for the quick bugfix in commit d6dcaff.

probably there are still a couple of lines in the same class involving the same reported issue on lines 381 ( if self.version >= 3.5) and line 402 (if self.version == 3.0) of file scanners/scanner30.py. I'm referring to version 3.8.0.

Bests

@rocky
Copy link
Owner

rocky commented Nov 3, 2022

Ok - probably fixed the commit before 9ecdf12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants