Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove _dis module
  • Loading branch information
ShaharNaveh committed Jan 10, 2026
commit 376d5ba8355ec881c95d5e57efebbd8a6d9659d6
8 changes: 1 addition & 7 deletions Lib/dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

from _opcode import get_executor


__all__ = ["code_info", "dis", "disassemble", "distb", "disco",
"findlinestarts", "findlabels", "show_code",
"get_instructions", "Instruction", "Bytecode"] + _opcodes_all
Expand Down Expand Up @@ -1052,9 +1051,6 @@ def dis(self):
return output.getvalue()


from _dis import * # TODO: RUSTPYTHON; Remove this import (and module)


def main(args=None):
import argparse

Expand All @@ -1073,9 +1069,7 @@ def main(args=None):
with open(args.infile, 'rb') as infile:
source = infile.read()
code = compile(source, name, "exec")
# TODO: RUSTPYTHON; Add support for `show_caches` & `show_offsets` arguments
# dis(code, show_caches=args.show_caches, show_offsets=args.show_offsets)
dis(code)
dis(code, show_caches=args.show_caches, show_offsets=args.show_offsets)

if __name__ == "__main__":
main()
10 changes: 0 additions & 10 deletions Lib/test/test_dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,11 +971,9 @@ def test_bug_1333982(self):

self.do_disassembly_test(bug1333982, dis_bug1333982)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_bug_42562(self):
self.do_disassembly_test(bug42562, dis_bug42562)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_bug_45757(self):
# Extended arg followed by NOP
self.do_disassembly_test(code_bug_45757, dis_bug_45757)
Expand All @@ -997,7 +995,6 @@ def test_intrinsic_1(self):
self.do_disassembly_test("+a", dis_intrinsic_1_5)
self.do_disassembly_test("(*a,)", dis_intrinsic_1_6)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_intrinsic_2(self):
self.assertIn("CALL_INTRINSIC_2 1 (INTRINSIC_PREP_RERAISE_STAR)",
self.get_disassembly("try: pass\nexcept* Exception: x"))
Expand Down Expand Up @@ -1059,19 +1056,16 @@ def test_disassemble_static_method(self):
def test_disassemble_class_method(self):
self.do_disassembly_test(_C.cm, dis_c_class_method)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_disassemble_generator(self):
gen_func_disas = self.get_disassembly(_g) # Generator function
gen_disas = self.get_disassembly(_g(1)) # Generator iterator
self.assertEqual(gen_disas, gen_func_disas)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_disassemble_async_generator(self):
agen_func_disas = self.get_disassembly(_ag) # Async generator function
agen_disas = self.get_disassembly(_ag(1)) # Async generator iterator
self.assertEqual(agen_disas, agen_func_disas)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_disassemble_coroutine(self):
coro_func_disas = self.get_disassembly(_co) # Coroutine function
coro = _co(1) # Coroutine object
Expand All @@ -1096,7 +1090,6 @@ def test_disassemble_try_finally(self):
self.do_disassembly_test(_tryfinally, dis_tryfinally)
self.do_disassembly_test(_tryfinallyconst, dis_tryfinallyconst)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_dis_none(self):
try:
del sys.last_exc
Expand All @@ -1108,7 +1101,6 @@ def test_dis_none(self):
pass
self.assertRaises(RuntimeError, dis.dis, None)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_dis_traceback(self):
self.maxDiff = None
try:
Expand Down Expand Up @@ -2198,14 +2190,12 @@ def test_assert_not_in_with_op_not_in_bytecode(self):
self.assertNotInBytecode(code, "LOAD_NAME")
self.assertNotInBytecode(code, "LOAD_NAME", "a")

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_assert_not_in_with_arg_not_in_bytecode(self):
code = compile("a = 1", "<string>", "exec")
self.assertInBytecode(code, "LOAD_CONST")
self.assertInBytecode(code, "LOAD_CONST", 1)
self.assertNotInBytecode(code, "LOAD_CONST", 2)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_assert_not_in_with_arg_in_bytecode(self):
code = compile("a = 1", "<string>", "exec")
with self.assertRaises(AssertionError):
Expand Down
58 changes: 0 additions & 58 deletions crates/stdlib/src/dis.rs

This file was deleted.

2 changes: 0 additions & 2 deletions crates/stdlib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ mod bisect;
mod cmath;
mod contextvars;
mod csv;
mod dis;
mod gc;

mod bz2;
Expand Down Expand Up @@ -132,7 +131,6 @@ pub fn get_module_inits() -> impl Iterator<Item = (Cow<'static, str>, StdlibInit
"cmath" => cmath::make_module,
"_contextvars" => contextvars::make_module,
"_csv" => csv::make_module,
"_dis" => dis::make_module,
"faulthandler" => faulthandler::make_module,
"gc" => gc::make_module,
"_hashlib" => hashlib::make_module,
Expand Down