can't find method
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
Research direction
Start by reproducing pyc-xasm --pyc-file test .\compiled_code.pyasm with the supplied Python 3.9 bytecode and inspect how the method and constant entries are handled. Done means the greet method is recognized rather than reported as bogus and the sample disassembly is processed successfully.
Written by the indexing model from the issue text.
Description
I got this problem: can't find method greet
appending bogus greet to list of constants
when running pyc-xasm --pyc-file test .\compiled_code.pyasm
this is the code that generated compiled_code.pyasm
source_code = """
def greet():
print("Hello, world!")
"""
compiled_code = compile(source_code, "<string>", "exec")
pyc_file = "compiled_code.pyasm"
with open(pyc_file, "w") as file:
xdis.std.disassemble(compiled_code, file=file)
and this is the compiled_code:
# pydisasm version 6.0.5
# Python bytecode 3.9 ()
# Disassembled from Python 3.9.9 (tags/v3.9.9:ccb0e6a, Nov 15 2021, 18:08:50) [MSC v.1929 64 bit (AMD64)]
# Method Name: <module>
# Filename: <string>
# Argument count: 0
# Position-only argument count: 0
# Keyword-only arguments: 0
# Number of locals: 0
# Stack size: 2
# Flags: 0x00000040 (NOFREE)
# First Line: 2
# Constants:
# 0: <code object greet at 0x000002028CC845B0, file "<string>", line 2>
# 1: 'greet'
# 2: None
# Names:
# 0: greet
2: 0 LOAD_CONST (<code object greet at 0x000002028CC845B0, file "<string>", line 2>)
2 LOAD_CONST ('greet')
4 MAKE_FUNCTION (Neither defaults, keyword-only args, annotations, nor closures)
6 STORE_NAME (greet)
8 LOAD_CONST (None)
10 RETURN_VALUE
# Method Name: greet
# Filename: <string>
# Argument count: 0
# Position-only argument count: 0
# Keyword-only arguments: 0
# Number of locals: 0
# Stack size: 2
# Flags: 0x00000043 (NOFREE | NEWLOCALS | OPTIMIZED)
# First Line: 2
# Constants:
# 0: None
# 1: 'Hello, world!'
# Names:
# 0: print
3: 0 LOAD_GLOBAL (print)
2 LOAD_CONST ('Hello, world!')
4 CALL_FUNCTION 1
6 POP_TOP
8 LOAD_CONST (None)
10 RETURN_VALUE
- Dominant language
- Python
- Stars
- 119
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rocky/python-xasm
-
Volunteer wanted to fix
Difficulty 4/5 3-5 days Newbie friendliness 20/100
rocky/python-xasm#5 ·
All issues in rocky/python-xasm
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
zostera/django-bootstrap4#894 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
use-agent-os/agent-os#3276 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
NousResearch/hermes-agent#117848 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
zilliztech/memsearch#759 ·