We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4b8c6ea commit 1fdae12Copy full SHA for 1fdae12
Lib/dis.py
@@ -251,3 +251,30 @@ def jabs_op(name, op):
251
def_op('CALL_FUNCTION', 131)
252
def_op('MAKE_FUNCTION', 132)
253
def_op('BUILD_SLICE', 133)
254
+
255
256
+def _test():
257
+ """Simple test program to disassemble a file."""
258
+ if sys.argv[1:]:
259
+ if sys.argv[2:]:
260
+ sys.stderr.write("usage: python dis.py [-|file]\n")
261
+ sys.exit(2)
262
+ fn = sys.argv[1]
263
+ if not fn or fn == "-":
264
+ fn = None
265
+ else:
266
267
+ if not fn:
268
+ f = sys.stdin
269
270
+ f = open(fn)
271
+ source = f.read()
272
+ if fn:
273
+ f.close()
274
275
+ fn = "<stdin>"
276
+ code = compile(source, fn, "exec")
277
+ dis(code)
278
279
+if __name__ == "__main__":
280
+ _test()
0 commit comments