Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Jul 21, 2024
1 parent 1a3f2b8 commit b0dd7f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 8 additions & 7 deletions uncompyle6/code_fns.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2015-2016, 2818-2022 by Rocky Bernstein
# Copyright (c) 2015-2016, 2818-2022, 2024 by Rocky Bernstein
# Copyright (c) 2005 by Dan Pascu <[email protected]>
# Copyright (c) 2000-2002 by hartmut Goebel <[email protected]>
# Copyright (c) 1999 John Aycock
Expand All @@ -17,10 +17,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""
CPython magic- and version- independent disassembly routines
CPython magic- and version-independent disassembly routines
There are two reasons we can't use Python's built-in routines
from dis. First, the bytecode we are extracting may be from a different
from ``dis``.
First, the bytecode we are extracting may be from a different
version of Python (different magic number) than the version of Python
that is doing the extraction.
Expand All @@ -39,12 +41,12 @@

def disco(version, co, out=None, is_pypy=False):
"""
diassembles and deparses a given code block 'co'
diassembles and deparses a given code block ``co``.
"""

assert iscode(co)

# store final output stream for case of error
# Store final output stream in case there is an error.
real_out = out or sys.stdout
print("# Python %s" % version_tuple_to_str(version), file=real_out)
if co.co_filename:
Expand Down Expand Up @@ -99,7 +101,7 @@ def disco_loop(disasm, queue, real_out):

def disassemble_file(filename, outstream=None):
"""
disassemble Python byte-code file (.pyc)
Disassemble Python byte-code file (.pyc).
If given a Python source file (".py") file, we'll
try to find the corresponding compiled object.
Expand All @@ -113,7 +115,6 @@ def disassemble_file(filename, outstream=None):
disco(version, con, outstream)
else:
disco(version, co, outstream, is_pypy=is_pypy)
co = None


def _test():
Expand Down
2 changes: 2 additions & 0 deletions uncompyle6/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,8 @@ def get_python_parser(

version = version[:2]

p = None

# FIXME: there has to be a better way...
# We could do this as a table lookup, but that would force us
# in import all of the parsers all of the time. Perhaps there is
Expand Down

0 comments on commit b0dd7f5

Please sign in to comment.