1- # Copyright (c) 2015-2016, 2818-2022 by Rocky Bernstein
1+ # Copyright (c) 2015-2016, 2818-2022, 2024 by Rocky Bernstein
22# Copyright (c) 2005 by Dan Pascu <dan@windowmaker.org>
33# Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
44# Copyright (c) 1999 John Aycock
1717# along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
1919"""
20- CPython magic- and version- independent disassembly routines
20+ CPython magic- and version-independent disassembly routines
2121
2222There are two reasons we can't use Python's built-in routines
23- from dis. First, the bytecode we are extracting may be from a different
23+ from ``dis``.
24+
25+ First, the bytecode we are extracting may be from a different
2426version of Python (different magic number) than the version of Python
2527that is doing the extraction.
2628
3941
4042def disco (version , co , out = None , is_pypy = False ):
4143 """
42- diassembles and deparses a given code block 'co'
44+ diassembles and deparses a given code block ``co``.
4345 """
4446
4547 assert iscode (co )
4648
47- # store final output stream for case of error
49+ # Store final output stream in case there is an error.
4850 real_out = out or sys .stdout
4951 print ("# Python %s" % version_tuple_to_str (version ), file = real_out )
5052 if co .co_filename :
@@ -99,7 +101,7 @@ def disco_loop(disasm, queue, real_out):
99101
100102def disassemble_file (filename , outstream = None ):
101103 """
102- disassemble Python byte-code file (.pyc)
104+ Disassemble Python byte-code file (.pyc).
103105
104106 If given a Python source file (".py") file, we'll
105107 try to find the corresponding compiled object.
@@ -113,7 +115,6 @@ def disassemble_file(filename, outstream=None):
113115 disco (version , con , outstream )
114116 else :
115117 disco (version , co , outstream , is_pypy = is_pypy )
116- co = None
117118
118119
119120def _test ():
0 commit comments