can't find method

Aperta
#20 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python
Ambito
cli, compilers

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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


Lingua principale
Python
Stelle
119
Fork
13
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rocky/python-xasm

Tutte le issue di rocky/python-xasm

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.