Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in python 3.8.3 ,how to fix? #4

Closed
Datez-Kun opened this issue Jun 7, 2020 · 2 comments
Closed

Error in python 3.8.3 ,how to fix? #4

Datez-Kun opened this issue Jun 7, 2020 · 2 comments

Comments

@Datez-Kun
Copy link

Datez-Kun commented Jun 7, 2020

why do i get an error like this when trying it in python 3.8.3? Is this a bug? The following is the error code

$ pydisasm --version
pydisasm, version 4.6.1

$ pydisasm --asm tes.pyc
# pydisasm version 4.6.1
# Python bytecode 3.8 (3413)
# Disassembled from Python 3.8.3 (default, May 14 2020, 14:40:57)
# [Clang 8.0.7 (https://android.googlesource.com/toolchain/clang b55f2d4ebfd35bf6
# Timestamp in code: 1591520548 (2020-06-07 16:02:28)
# Source code size mod 2**32: 101 bytes

# Method Name:       helo
# Filename:          tes.py
# Argument count:    1
# Position-only argument count: 0
# Keyword-only arguments: 0
# Number of locals:  1
# Stack size:        6
# Flags:             0x00000043 (NOFREE | NEWLOCALS | OPTIMIZED)
# First Line:        1
# Constants:
#    0: None
# Names:
#    0: print
# Varnames:
#       teks
# Positional arguments:
#       teks
  2:
            SETUP_FINALLY        L14 (to 14)

  3:
            LOAD_GLOBAL          (print)
            LOAD_FAST            (teks)
            CALL_FUNCTION        1
            POP_TOP
            POP_BLOCK
            JUMP_FORWARD         L26 (to 26)

L14:
   4:
            POP_TOP
            POP_TOP
            POP_TOP

  5:
            POP_EXCEPT
            JUMP_FORWARD         L26 (to 26)
            END_FINALLY
L26:
            LOAD_CONST           (None)
            RETURN_VALUE


# Method Name:       <module>
# Filename:          tes.py
# Argument count:    0
# Position-only argument count: 0
# Keyword-only arguments: 0
# Number of locals:  0
# Stack size:        2
# Flags:             0x00000040 (NOFREE)
# First Line:        1
# Constants:
#    0: <Code38 code object helo at 0xae631688, file tes.py>, line 1
#    1: 'helo'
#    2: '__main__'
#    3: 'Hello ,World!'
#    4: None
# Names:
#    0: helo
#    1: __name__
  1:
            LOAD_CONST           0 (<Code38 code object helo at 0xae631688, file tes.py>, line 1)
            LOAD_CONST           ('helo')
            MAKE_FUNCTION        0 (Neither defaults, keyword-only args, annotations, nor closures)
            STORE_NAME           (helo)

  7:
            LOAD_NAME            (__name__)
            LOAD_CONST           ('__main__')
            COMPARE_OP           (==)
            POP_JUMP_IF_FALSE    L24 (to 24)

  8:
            LOAD_NAME            (helo)
            LOAD_CONST           3 ('Hello ,World!')
            CALL_FUNCTION        1
            POP_TOP
L24:
            LOAD_CONST           (None)
            RETURN_VALUE

then I save it in the test.pyasm file
and when i run python xasm an error pops up like this

$ pyc-xasm tes.pyasm
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/bin/pyc-xasm", line 11, in <module>
    load_entry_point('xasm==1.1.0', 'console_scripts', 'pyc-xasm')()
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/xasm/xasm_cli.py", line 28, in main
    asm = asm_file(asm_path)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/xasm/assemble.py", line 124, in asm_file
    asm = Assembler(python_version)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/xasm/assemble.py", line 52, in __init__
    self.opc = get_opcode(python_version)
TypeError: get_opcode() missing 1 required positional argument: 'is_pypy'

it looks like the real error is in the main.py file in the xdis package in this get_opcode function

def get_opcode(version, is_pypy):
 49     # Set up disassembler with the right opcodes
 50     if type(version) in (list, tuple):
 51         version = ".".join([str(x) for x in version])
 52     lookup = str(version)
 53     if is_pypy:
 54         lookup += "pypy"
 55     if lookup in op_imports.keys():
 56         return op_imports[lookup]
 57     if is_pypy:
 58         pypy_str = " for pypy"
 59     else:
 60         pypy_str = ""
 61     raise TypeError("%s is not a Python version%s I know about" % (version, pypy_str))

if you have a little time please fix it right away, because this tool is really really good sir, I've tried it in python2.7.18 and didn't get any errors, but I'm a little disappointed because I thought this tool could only be used in python2

if you are too busy, just tell me what to fix!
Thanks

@rocky rocky closed this as completed in 7b3c01f Jun 7, 2020
@rocky
Copy link
Owner

rocky commented Jun 7, 2020

The particular problem you encountered has been addressed, although I've disabled creating 3.8 bytecode for now since that's broken.

Right now, it's not of interest to me, the rating on this project is low, and funding for any of the may projects is neglible. So I'd rather be doing other things.

That said, feel free to investigate further and fix if that is of interest to you.

@Datez-Kun
Copy link
Author

The particular problem you encountered has been addressed, although I've disabled creating 3.8 bytecode for now since that's broken.

Right now, it's not of interest to me, the rating on this project is low, and funding for any of the may projects is neglible. So I'd rather be doing other things.

That said, feel free to investigate further and fix if that is of interest to you.

I always investigate your project, sir, and it's really good, thank you very much for fixing it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants