Skip to content

Double return is printed #459

Description

@Et7f3

Description

double return get printed

How to Reproduce

def main():
  if input() == 0:
    print("0")
    return
  if input() == 1:
    print("1")
  else:
    printf("other")

#458

I used add-test.py with python3.8 with the latest commit on the respective branch

Output Given

# uncompyle6 version 3.9.1.dev0
# Python bytecode version base 3.8.0 (3413)
# Decompiled from: Python 3.8.10 (default, Mar 13 2023, 10:26:41) 
# [GCC 9.4.0]
# Embedded file name: 00_double_return.py
# Compiled at: 2023-05-31 12:07:25
# Size of source mod 2**32: 118 bytes


def main():
    if input() == 0:
        print('0')
        return         return None
    elif input() == 1:
        print('1')
    else:
        printf('other')
# okay decompiling bytecode_3.8/00_double_return.pyc

Expected behavior

def main():
    if input() == 0:
        print('0')
+        return
-        return         return None
    elif input() == 1:
        print('1')
    else:
        printf('other')

Environment

  • Uncompyle6 version: output from uncompyle6 --version uncompyle6 3.9.1.dev0
  • Python version for the version of Python the byte-compiled the file: python -c "import sys; print(sys.version)" where python is the correct CPython or PyPy binary.
    3.8.10 (default, Mar 13 2023, 10:26:41)
    [GCC 9.4.0]
  • OS and Version: Linux codespaces-6db051 5.15.0-1038-azure Revert "Cache pip installation in travis" #45-Ubuntu SMP Mon Apr 24 15:40:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Workarounds

Remove the second run by hand

Priority

I found it while trying to reduce another bug

Additional Context

N/A

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions