`return` in Python 3.8 in `try` ... `except`

Open
#369 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python

Research direction

Start by running uncompyle6 on the attached Uncompyle6.zip or battleroyale.cpython-38.pyc with Python 3.8.10 and confirm the parse error near the LOAD_CONST instruction. Trace the decompiler path handling the reported return in try/except code. Done means this artifact decompiles past the current failure without the reported parse error.

Written by the indexing model from the issue text.

Description

Python 3.8 Works on decompyle3

Description

Hi! I'm trying to decompile a cog from my Discord bot which I overwrote by error. When using uncompyle, all classes except one (the longest one) were recovered. In the last one, I get the following output (I also attached the full output, and the full .pyc):

             3708  POP_TOP          

Parse error at or near `LOAD_CONST' instruction at offset 220


    def setup(bot):
        bot.add_cog(BRCog(bot))

The script raises an error exactly on the last two lines of the code, so there isn't anything after that.

How to Reproduce

$ uncompyle6 battleroyale.cpython-38.pyc > output.txt
# file battleroyale.cpython-38.pyc
# Deparsing stopped due to parse error

Environment

  • OS: Ubuntu Server 20.04 LTS (focal)
  • Python: Python 3.8.10 (default, Sep 28 2021, 16:10:42)
  • Uncompyle6 version: version 3.8.1.dev0

Uncompyle6.zip

Dominant language
Python
Stars
4.3k
Forks
463
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rocky/python-uncompyle6

All issues in rocky/python-uncompyle6

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.