MCPcopy Index your code
hub / github.com/RustPython/RustPython / get_load_const

Method get_load_const

Lib/test/test_ast/test_ast.py:2665–2673  ·  view source on GitHub ↗
(self, tree)

Source from the content-addressed store, hash-verified

2663 self.assertEqual(ast.get_docstring(tree), 'docstring')
2664
2665 def get_load_const(self, tree):
2666 # Compile to bytecode, disassemble and get parameter of LOAD_CONST
2667 # instructions
2668 co = compile(tree, '<string>', 'exec')
2669 consts = []
2670 for instr in dis.get_instructions(co):
2671 if instr.opcode in dis.hasconst:
2672 consts.append(instr.argval)
2673 return consts
2674
2675 @support.cpython_only
2676 def test_load_const(self):

Callers 1

test_load_constMethod · 0.95

Calls 3

get_instructionsMethod · 0.80
compileFunction · 0.50
appendMethod · 0.45

Tested by

no test coverage detected