Skip to content

Commit 323d675

Browse files
committed
Raise errors when using dis module
1 parent 1ac1047 commit 323d675

File tree

1 file changed

+13
-0
lines changed
  • graalpython/lib-python/3

1 file changed

+13
-0
lines changed

graalpython/lib-python/3/dis.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
7474
objects, and coroutine objects, all of which store their code object
7575
in a special attribute.
7676
"""
77+
# GraalPy change
78+
raise NotImplementedError("dis module is not supported on GraalPy")
7779
if x is None:
7880
distb(file=file, show_caches=show_caches, adaptive=adaptive)
7981
return
@@ -338,6 +340,8 @@ def get_instructions(x, *, first_line=None, show_caches=False, adaptive=False):
338340
Otherwise, the source line information (if any) is taken directly from
339341
the disassembled code object.
340342
"""
343+
# GraalPy change
344+
raise NotImplementedError("dis module is not supported on GraalPy")
341345
co = _get_code_object(x)
342346
linestarts = dict(findlinestarts(co))
343347
if first_line is not None:
@@ -519,6 +523,8 @@ def _get_instructions_bytes(code, varname_from_oparg=None,
519523

520524
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
521525
"""Disassemble a code object."""
526+
# GraalPy change
527+
raise NotImplementedError("dis module is not supported on GraalPy")
522528
linestarts = dict(findlinestarts(co))
523529
exception_entries = _parse_exception_table(co)
524530
_disassemble_bytes(_get_code_array(co, adaptive),
@@ -697,6 +703,8 @@ class Bytecode:
697703
Iterating over this yields the bytecode operations as Instruction instances.
698704
"""
699705
def __init__(self, x, *, first_line=None, current_offset=None, show_caches=False, adaptive=False):
706+
# GraalPy change
707+
raise NotImplementedError("'dis' module is not supported on GraalPy")
700708
self.codeobj = co = _get_code_object(x)
701709
if first_line is None:
702710
self.first_line = co.co_firstlineno
@@ -760,6 +768,11 @@ def dis(self):
760768
return output.getvalue()
761769

762770

771+
# GraalPy stubs
772+
def stack_effect(opcode, oparg=None, /, *, jump=None):
773+
raise NotImplementedError("'dis' module is not supported on GraalPy")
774+
775+
763776
def main():
764777
import argparse
765778

0 commit comments

Comments
 (0)