xdis 6.1.2__py313-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xdis/.gitignore +3 -0
- xdis/__init__.py +290 -0
- xdis/__main__.py +28 -0
- xdis/bin/__init__.py +0 -0
- xdis/bin/pydisasm.py +86 -0
- xdis/bytecode.py +830 -0
- xdis/codetype/.gitignore +2 -0
- xdis/codetype/__init__.py +284 -0
- xdis/codetype/base.py +66 -0
- xdis/codetype/code13.py +113 -0
- xdis/codetype/code15.py +153 -0
- xdis/codetype/code20.py +164 -0
- xdis/codetype/code30.py +167 -0
- xdis/codetype/code310.py +289 -0
- xdis/codetype/code311.py +146 -0
- xdis/codetype/code313.py +274 -0
- xdis/codetype/code38.py +142 -0
- xdis/cross_dis.py +527 -0
- xdis/cross_types.py +91 -0
- xdis/disasm.py +416 -0
- xdis/dropbox/__init__.py +8 -0
- xdis/dropbox/decrypt25.py +401 -0
- xdis/instruction.py +462 -0
- xdis/jvm.py +701 -0
- xdis/lineoffsets.py +181 -0
- xdis/load.py +401 -0
- xdis/magics.py +675 -0
- xdis/marsh.py +1091 -0
- xdis/op_imports.py +329 -0
- xdis/opcodes/__init__.py +20 -0
- xdis/opcodes/base.py +495 -0
- xdis/opcodes/format/__init__.py +19 -0
- xdis/opcodes/format/basic.py +68 -0
- xdis/opcodes/format/extended.py +891 -0
- xdis/opcodes/opcode_10.py +57 -0
- xdis/opcodes/opcode_11.py +47 -0
- xdis/opcodes/opcode_12.py +62 -0
- xdis/opcodes/opcode_13.py +56 -0
- xdis/opcodes/opcode_14.py +81 -0
- xdis/opcodes/opcode_15.py +46 -0
- xdis/opcodes/opcode_16.py +53 -0
- xdis/opcodes/opcode_1x.py +218 -0
- xdis/opcodes/opcode_20.py +52 -0
- xdis/opcodes/opcode_21.py +51 -0
- xdis/opcodes/opcode_22.py +32 -0
- xdis/opcodes/opcode_23.py +28 -0
- xdis/opcodes/opcode_24.py +43 -0
- xdis/opcodes/opcode_25.py +37 -0
- xdis/opcodes/opcode_26.py +59 -0
- xdis/opcodes/opcode_26pypy.py +69 -0
- xdis/opcodes/opcode_27-next.py +94 -0
- xdis/opcodes/opcode_27.py +94 -0
- xdis/opcodes/opcode_27pypy.py +57 -0
- xdis/opcodes/opcode_2x.py +320 -0
- xdis/opcodes/opcode_30.py +61 -0
- xdis/opcodes/opcode_31.py +49 -0
- xdis/opcodes/opcode_310.py +63 -0
- xdis/opcodes/opcode_310graal.py +757 -0
- xdis/opcodes/opcode_310pypy.py +64 -0
- xdis/opcodes/opcode_311.py +419 -0
- xdis/opcodes/opcode_312.py +197 -0
- xdis/opcodes/opcode_313.py +469 -0
- xdis/opcodes/opcode_32.py +29 -0
- xdis/opcodes/opcode_32pypy.py +58 -0
- xdis/opcodes/opcode_33.py +40 -0
- xdis/opcodes/opcode_33pypy.py +57 -0
- xdis/opcodes/opcode_34.py +32 -0
- xdis/opcodes/opcode_35.py +129 -0
- xdis/opcodes/opcode_35pypy.py +70 -0
- xdis/opcodes/opcode_36.py +398 -0
- xdis/opcodes/opcode_36pypy.py +212 -0
- xdis/opcodes/opcode_37.py +176 -0
- xdis/opcodes/opcode_37pypy.py +79 -0
- xdis/opcodes/opcode_38.py +66 -0
- xdis/opcodes/opcode_38pypy.py +54 -0
- xdis/opcodes/opcode_39.py +122 -0
- xdis/opcodes/opcode_39pypy.py +66 -0
- xdis/opcodes/opcode_3x.py +302 -0
- xdis/std.py +303 -0
- xdis/unmarshal.py +640 -0
- xdis/util.py +127 -0
- xdis/verify.py +187 -0
- xdis/version.py +7 -0
- xdis/version_info.py +49 -0
- xdis/wordcode.py +105 -0
- xdis-6.1.2.dist-info/COPYING +339 -0
- xdis-6.1.2.dist-info/METADATA +287 -0
- xdis-6.1.2.dist-info/RECORD +91 -0
- xdis-6.1.2.dist-info/WHEEL +5 -0
- xdis-6.1.2.dist-info/entry_points.txt +2 -0
- xdis-6.1.2.dist-info/top_level.txt +1 -0
xdis/.gitignore
ADDED
xdis/__init__.py
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright (c) 2015-2017, 2020-2024 by Rocky Bernstein
|
|
3
|
+
Copyright (c) 2000 by hartmut Goebel <h.goebel@crazy-compilers.com>
|
|
4
|
+
|
|
5
|
+
This program is free software; you can redistribute it and/or
|
|
6
|
+
modify it under the terms of the GNU General Public License
|
|
7
|
+
as published by the Free Software Foundation; either version 2
|
|
8
|
+
of the License, or (at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License
|
|
16
|
+
along with this program; if not, write to the Free Software
|
|
17
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
18
|
+
|
|
19
|
+
NB. This is not a masterpiece of software, but became more like a hack.
|
|
20
|
+
Probably a complete rewrite would be sensefull. hG/2000-12-27
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
__docformat__ = "restructuredtext"
|
|
24
|
+
|
|
25
|
+
# Export various things from the modules
|
|
26
|
+
|
|
27
|
+
from xdis.bytecode import (
|
|
28
|
+
Bytecode,
|
|
29
|
+
get_instructions_bytes,
|
|
30
|
+
list2bytecode,
|
|
31
|
+
next_offset,
|
|
32
|
+
offset2line,
|
|
33
|
+
op_has_argument,
|
|
34
|
+
)
|
|
35
|
+
from xdis.codetype import (
|
|
36
|
+
Code2,
|
|
37
|
+
Code3,
|
|
38
|
+
Code13,
|
|
39
|
+
Code15,
|
|
40
|
+
Code38,
|
|
41
|
+
Code310,
|
|
42
|
+
Code311,
|
|
43
|
+
Code313,
|
|
44
|
+
codeType2Portable,
|
|
45
|
+
)
|
|
46
|
+
from xdis.codetype.base import code_has_star_arg, code_has_star_star_arg, iscode
|
|
47
|
+
from xdis.cross_dis import (
|
|
48
|
+
code_info,
|
|
49
|
+
extended_arg_val,
|
|
50
|
+
findlabels,
|
|
51
|
+
findlinestarts,
|
|
52
|
+
format_code_info,
|
|
53
|
+
get_code_object,
|
|
54
|
+
get_jump_target_maps,
|
|
55
|
+
instruction_size,
|
|
56
|
+
op_size,
|
|
57
|
+
pretty_flags as pretty_code_flags,
|
|
58
|
+
show_code,
|
|
59
|
+
)
|
|
60
|
+
from xdis.disasm import (
|
|
61
|
+
disassemble_file,
|
|
62
|
+
disco_loop,
|
|
63
|
+
disco_loop_asm_format,
|
|
64
|
+
get_opcode,
|
|
65
|
+
show_module_header,
|
|
66
|
+
)
|
|
67
|
+
from xdis.instruction import Instruction
|
|
68
|
+
from xdis.lineoffsets import (
|
|
69
|
+
LineOffsetInfo,
|
|
70
|
+
LineOffsets,
|
|
71
|
+
LineOffsetsCompact,
|
|
72
|
+
lineoffsets_in_file,
|
|
73
|
+
lineoffsets_in_module,
|
|
74
|
+
)
|
|
75
|
+
from xdis.load import (
|
|
76
|
+
check_object_path,
|
|
77
|
+
is_bytecode_extension,
|
|
78
|
+
is_pypy,
|
|
79
|
+
is_python_source,
|
|
80
|
+
load_file,
|
|
81
|
+
load_module,
|
|
82
|
+
load_module_from_file_object,
|
|
83
|
+
write_bytecode_file,
|
|
84
|
+
)
|
|
85
|
+
from xdis.magics import (
|
|
86
|
+
PYTHON_MAGIC_INT,
|
|
87
|
+
canonic_python_version,
|
|
88
|
+
int2magic,
|
|
89
|
+
magic2int,
|
|
90
|
+
sysinfo2magic,
|
|
91
|
+
)
|
|
92
|
+
from xdis.op_imports import get_opcode_module
|
|
93
|
+
from xdis.opcodes import (
|
|
94
|
+
opcode_13,
|
|
95
|
+
opcode_14,
|
|
96
|
+
opcode_15,
|
|
97
|
+
opcode_22,
|
|
98
|
+
opcode_23,
|
|
99
|
+
opcode_24,
|
|
100
|
+
opcode_25,
|
|
101
|
+
opcode_26,
|
|
102
|
+
opcode_27,
|
|
103
|
+
opcode_30,
|
|
104
|
+
opcode_31,
|
|
105
|
+
opcode_32,
|
|
106
|
+
opcode_33,
|
|
107
|
+
opcode_34,
|
|
108
|
+
opcode_35,
|
|
109
|
+
opcode_36,
|
|
110
|
+
opcode_37,
|
|
111
|
+
opcode_38,
|
|
112
|
+
opcode_39,
|
|
113
|
+
opcode_310,
|
|
114
|
+
opcode_311,
|
|
115
|
+
)
|
|
116
|
+
from xdis.util import (
|
|
117
|
+
CO_ABSOLUTE_IMPORT,
|
|
118
|
+
CO_ASYNC_GENERATOR,
|
|
119
|
+
CO_COROUTINE,
|
|
120
|
+
CO_FUTURE_ANNOTATIONS,
|
|
121
|
+
CO_FUTURE_BARRY_AS_DBFL,
|
|
122
|
+
CO_FUTURE_DIVISION,
|
|
123
|
+
CO_FUTURE_GENERATOR_STOP,
|
|
124
|
+
CO_FUTURE_PRINT_FUNCTION,
|
|
125
|
+
CO_FUTURE_UNICODE_LITERALS,
|
|
126
|
+
CO_FUTURE_WITH_STATEMENT,
|
|
127
|
+
CO_GENERATOR,
|
|
128
|
+
CO_GENERATOR_ALLOWED,
|
|
129
|
+
CO_ITERABLE_COROUTINE,
|
|
130
|
+
CO_NESTED,
|
|
131
|
+
CO_NEWLOCALS,
|
|
132
|
+
CO_NOFREE,
|
|
133
|
+
CO_OPTIMIZED,
|
|
134
|
+
CO_VARARGS,
|
|
135
|
+
CO_VARKEYWORDS,
|
|
136
|
+
COMPILER_FLAG_BIT,
|
|
137
|
+
COMPILER_FLAG_NAMES,
|
|
138
|
+
PYPY_COMPILER_FLAG_NAMES,
|
|
139
|
+
co_flags_is_async,
|
|
140
|
+
code2num,
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
# This ensures __version__ will appear in pydoc
|
|
144
|
+
from xdis.version import __version__ # noqa
|
|
145
|
+
from xdis.version_info import (
|
|
146
|
+
IS_GRAAL,
|
|
147
|
+
IS_PYPY,
|
|
148
|
+
PYTHON3,
|
|
149
|
+
PYTHON_VERSION_STR,
|
|
150
|
+
PYTHON_VERSION_TRIPLE,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
__all__ = [
|
|
154
|
+
# bytecode
|
|
155
|
+
"Bytecode",
|
|
156
|
+
"get_instructions_bytes",
|
|
157
|
+
"list2bytecode",
|
|
158
|
+
"next_offset",
|
|
159
|
+
"offset2line",
|
|
160
|
+
"op_has_argument",
|
|
161
|
+
# codetype
|
|
162
|
+
"CO_ABSOLUTE_IMPORT",
|
|
163
|
+
"CO_ASYNC_GENERATOR",
|
|
164
|
+
"CO_COROUTINE",
|
|
165
|
+
"CO_FUTURE_ANNOTATIONS",
|
|
166
|
+
"CO_FUTURE_BARRY_AS_DBFL",
|
|
167
|
+
"CO_FUTURE_DIVISION",
|
|
168
|
+
"CO_FUTURE_GENERATOR_STOP",
|
|
169
|
+
"CO_FUTURE_PRINT_FUNCTION",
|
|
170
|
+
"CO_FUTURE_UNICODE_LITERALS",
|
|
171
|
+
"CO_FUTURE_WITH_STATEMENT",
|
|
172
|
+
"CO_GENERATOR",
|
|
173
|
+
"CO_GENERATOR_ALLOWED",
|
|
174
|
+
"CO_ITERABLE_COROUTINE",
|
|
175
|
+
"CO_NESTED",
|
|
176
|
+
"CO_NEWLOCALS",
|
|
177
|
+
"CO_NOFREE",
|
|
178
|
+
"CO_OPTIMIZED",
|
|
179
|
+
"CO_VARARGS",
|
|
180
|
+
"CO_VARKEYWORDS",
|
|
181
|
+
"Code13",
|
|
182
|
+
"Code15",
|
|
183
|
+
"Code2",
|
|
184
|
+
"Code3",
|
|
185
|
+
"Code310",
|
|
186
|
+
"Code311",
|
|
187
|
+
"Code313",
|
|
188
|
+
"Code38",
|
|
189
|
+
"code_has_star_star_arg",
|
|
190
|
+
"code_has_star_arg",
|
|
191
|
+
"codeType2Portable",
|
|
192
|
+
"iscode",
|
|
193
|
+
# cross_dis
|
|
194
|
+
"code_info",
|
|
195
|
+
"extended_arg_val",
|
|
196
|
+
"findlinestarts",
|
|
197
|
+
"findlabels",
|
|
198
|
+
"format_code_info",
|
|
199
|
+
"get_code_object",
|
|
200
|
+
"get_jump_target_maps",
|
|
201
|
+
"instruction_size",
|
|
202
|
+
"pretty_code_flags",
|
|
203
|
+
"op_size",
|
|
204
|
+
"show_code",
|
|
205
|
+
# disasm
|
|
206
|
+
"get_opcode",
|
|
207
|
+
"show_module_header",
|
|
208
|
+
"disco_loop",
|
|
209
|
+
"disco_loop_asm_format",
|
|
210
|
+
"disassemble_file",
|
|
211
|
+
# load
|
|
212
|
+
"check_object_path",
|
|
213
|
+
"is_bytecode_extension",
|
|
214
|
+
"is_pypy",
|
|
215
|
+
"is_python_source",
|
|
216
|
+
"load_file",
|
|
217
|
+
"load_module",
|
|
218
|
+
"load_module_from_file_object",
|
|
219
|
+
"write_bytecode_file",
|
|
220
|
+
# lineoffsets
|
|
221
|
+
"LineOffsetInfo",
|
|
222
|
+
"LineOffsets",
|
|
223
|
+
"LineOffsetsCompact",
|
|
224
|
+
"lineoffsets_in_file",
|
|
225
|
+
"lineoffsets_in_module",
|
|
226
|
+
# instruction
|
|
227
|
+
"Instruction",
|
|
228
|
+
# magic
|
|
229
|
+
"canonic_python_version",
|
|
230
|
+
"int2magic",
|
|
231
|
+
"magic2int",
|
|
232
|
+
"PYTHON_MAGIC_INT",
|
|
233
|
+
"sysinfo2magic",
|
|
234
|
+
# opcodes
|
|
235
|
+
"opcode_13",
|
|
236
|
+
"opcode_14",
|
|
237
|
+
"opcode_15",
|
|
238
|
+
"opcode_22",
|
|
239
|
+
"opcode_23",
|
|
240
|
+
"opcode_24",
|
|
241
|
+
"opcode_25",
|
|
242
|
+
"opcode_26",
|
|
243
|
+
"opcode_27",
|
|
244
|
+
"opcode_30",
|
|
245
|
+
"opcode_31",
|
|
246
|
+
"opcode_32",
|
|
247
|
+
"opcode_33",
|
|
248
|
+
"opcode_34",
|
|
249
|
+
"opcode_35",
|
|
250
|
+
"opcode_36",
|
|
251
|
+
"opcode_37",
|
|
252
|
+
"opcode_38",
|
|
253
|
+
"opcode_39",
|
|
254
|
+
"opcode_310",
|
|
255
|
+
"opcode_311",
|
|
256
|
+
# op_imports
|
|
257
|
+
"get_opcode_module",
|
|
258
|
+
# util
|
|
259
|
+
"COMPILER_FLAG_BIT",
|
|
260
|
+
"COMPILER_FLAG_NAMES",
|
|
261
|
+
"CO_ABSOLUTE_IMPORT",
|
|
262
|
+
"CO_ASYNC_GENERATOR",
|
|
263
|
+
"CO_COROUTINE",
|
|
264
|
+
"CO_FUTURE_ANNOTATIONS",
|
|
265
|
+
"CO_FUTURE_BARRY_AS_DBFL",
|
|
266
|
+
"CO_FUTURE_DIVISION",
|
|
267
|
+
"CO_FUTURE_GENERATOR_STOP",
|
|
268
|
+
"CO_FUTURE_PRINT_FUNCTION",
|
|
269
|
+
"CO_FUTURE_UNICODE_LITERALS",
|
|
270
|
+
"CO_FUTURE_WITH_STATEMENT",
|
|
271
|
+
"CO_GENERATOR",
|
|
272
|
+
"CO_GENERATOR_ALLOWED",
|
|
273
|
+
"CO_ITERABLE_COROUTINE",
|
|
274
|
+
"CO_NESTED",
|
|
275
|
+
"CO_NEWLOCALS",
|
|
276
|
+
"CO_NOFREE",
|
|
277
|
+
"CO_OPTIMIZED",
|
|
278
|
+
"CO_VARARGS",
|
|
279
|
+
"CO_VARKEYWORDS",
|
|
280
|
+
"PYPY_COMPILER_FLAG_NAMES",
|
|
281
|
+
"code2num",
|
|
282
|
+
"co_flags_is_async",
|
|
283
|
+
# version_info
|
|
284
|
+
"IS_GRAAL",
|
|
285
|
+
"IS_PYPY",
|
|
286
|
+
"PYTHON3",
|
|
287
|
+
"PYTHON_VERSION_STR",
|
|
288
|
+
"PYTHON_VERSION_TRIPLE",
|
|
289
|
+
"__version__",
|
|
290
|
+
]
|
xdis/__main__.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright (c) 2015-2017, 2020-2021, 2024 by Rocky Bernstein
|
|
3
|
+
Copyright (c) 2000 by hartmut Goebel <h.goebel@crazy-compilers.com>
|
|
4
|
+
|
|
5
|
+
This program is free software; you can redistribute it and/or
|
|
6
|
+
modify it under the terms of the GNU General Public License
|
|
7
|
+
as published by the Free Software Foundation; either version 2
|
|
8
|
+
of the License, or (at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License
|
|
16
|
+
along with this program; if not, write to the Free Software
|
|
17
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
18
|
+
|
|
19
|
+
NB. This is not a masterpiece of software, but became more like a hack.
|
|
20
|
+
Probably a complete rewrite would be sensefull. hG/2000-12-27
|
|
21
|
+
"""
|
|
22
|
+
import sys
|
|
23
|
+
|
|
24
|
+
from xdis.disasm import disassemble_file
|
|
25
|
+
|
|
26
|
+
if __name__ == "__main__" and len(sys.argv) > 1:
|
|
27
|
+
for path in sys.argv[1:]:
|
|
28
|
+
disassemble_file(path, sys.stdout)
|
xdis/bin/__init__.py
ADDED
|
File without changes
|
xdis/bin/pydisasm.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Mode: -*- python -*-
|
|
2
|
+
# Copyright (c) 2015-2021 by Rocky Bernstein <rb@dustyfeet.com>
|
|
3
|
+
#
|
|
4
|
+
# Note: we can't start with #! because setup.py bdist_wheel will look for that
|
|
5
|
+
# and change that into something that's not portable. Thank you, Python!
|
|
6
|
+
#
|
|
7
|
+
#
|
|
8
|
+
from __future__ import print_function
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
import os.path as osp
|
|
12
|
+
import sys
|
|
13
|
+
|
|
14
|
+
import click
|
|
15
|
+
|
|
16
|
+
from xdis import disassemble_file
|
|
17
|
+
from xdis.version import __version__
|
|
18
|
+
from xdis.version_info import PYTHON_VERSION_STR, PYTHON_VERSION_TRIPLE
|
|
19
|
+
|
|
20
|
+
program, ext = os.path.splitext(os.path.basename(__file__))
|
|
21
|
+
|
|
22
|
+
PATTERNS = ("*.pyc", "*.pyo")
|
|
23
|
+
|
|
24
|
+
if click.__version__ >= "7.":
|
|
25
|
+
case_sensitive = {"case_sensitive": False}
|
|
26
|
+
else:
|
|
27
|
+
case_sensitive = {}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@click.command()
|
|
31
|
+
@click.option(
|
|
32
|
+
"--format",
|
|
33
|
+
"-F",
|
|
34
|
+
type=click.Choice(
|
|
35
|
+
["xasm", "bytes", "classic", "dis", "extended", "extended-bytes", "header"],
|
|
36
|
+
**case_sensitive
|
|
37
|
+
),
|
|
38
|
+
help="Select disassembly style",
|
|
39
|
+
)
|
|
40
|
+
@click.option(
|
|
41
|
+
"--show-source/--no-show-source",
|
|
42
|
+
"-S",
|
|
43
|
+
help="Intersperse Python source text from linecache if available.",
|
|
44
|
+
)
|
|
45
|
+
@click.version_option(version=__version__)
|
|
46
|
+
@click.argument("files", nargs=-1, type=click.Path(readable=True), required=True)
|
|
47
|
+
def main(format, show_source: bool, files):
|
|
48
|
+
"""Disassembles a Python bytecode file.
|
|
49
|
+
|
|
50
|
+
We handle bytecode for virtually every release of Python and some releases of PyPy.
|
|
51
|
+
The version of Python in the bytecode doesn't have to be the same version as
|
|
52
|
+
the Python interpreter used to run this program. For example, you can disassemble Python 3.6.9
|
|
53
|
+
bytecode from Python 2.7.15 and vice versa.
|
|
54
|
+
"""
|
|
55
|
+
if not ((2, 7) <= PYTHON_VERSION_TRIPLE < (3, 14)):
|
|
56
|
+
mess = "This code works on 3.6 to 3.13; you have %s."
|
|
57
|
+
if (2, 4) <= PYTHON_VERSION_TRIPLE <= (2, 7):
|
|
58
|
+
mess += " Code that works for %s can be found in the python-2.4 branch\n"
|
|
59
|
+
elif (3, 1) <= PYTHON_VERSION_TRIPLE <= (3, 2):
|
|
60
|
+
mess += " Code that works for %s can be found in the python-3.1 branch\n"
|
|
61
|
+
elif (3, 3) <= PYTHON_VERSION_TRIPLE <= (3, 5):
|
|
62
|
+
mess += " Code that works for %s can be found in the python-3.3 branch\n"
|
|
63
|
+
sys.stderr.write(mess % PYTHON_VERSION_STR)
|
|
64
|
+
sys.exit(2)
|
|
65
|
+
|
|
66
|
+
for path in files:
|
|
67
|
+
# Some sanity checks
|
|
68
|
+
if not osp.exists(path):
|
|
69
|
+
sys.stderr.write("File name: '%s' doesn't exist\n" % path)
|
|
70
|
+
continue
|
|
71
|
+
elif not osp.isfile(path):
|
|
72
|
+
sys.stderr.write("File name: '%s' isn't a file\n" % path)
|
|
73
|
+
continue
|
|
74
|
+
elif osp.getsize(path) < 50 and not path.endswith(".py"):
|
|
75
|
+
sys.stderr.write(
|
|
76
|
+
"File name: '%s (%d bytes)' is too short to be a valid pyc file\n"
|
|
77
|
+
% (path, osp.getsize(path))
|
|
78
|
+
)
|
|
79
|
+
continue
|
|
80
|
+
|
|
81
|
+
disassemble_file(path, sys.stdout, format, show_source=show_source)
|
|
82
|
+
return
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
if __name__ == "__main__":
|
|
86
|
+
main(sys.argv[1:])
|