Skip to content

Does not support list comprehension #30

Open
@Axure

Description

@Axure

It does not support list comprehension in Python 3.5. Other versions untested.

Trying to run """[x for x in [1,2,3]]"""

<code object <listcomp> at 0x7fba81ddfed0, file "<python.py>", line 1>
  1           0 BUILD_LIST               0
              3 LOAD_FAST                0 (.0)
        >>    6 FOR_ITER                12 (to 21)
              9 STORE_FAST               1 (x)
             12 LOAD_FAST                1 (x)
             15 LIST_APPEND              2
             18 JUMP_ABSOLUTE            6
        >>   21 RETURN_VALUE

<code object <module> at 0x7fba80024660, file "<python.py>", line 1>
  1           0 LOAD_CONST               0 (<code object <listcomp> at 0x7fba81ddfed0, file "<python.py>", line 1>)
              3 LOAD_CONST               1 ('<listcomp>')
              6 MAKE_FUNCTION            0
              9 LOAD_CONST               2 (1)
             12 LOAD_CONST               3 (2)
             15 LOAD_CONST               4 (3)
             18 BUILD_LIST               3
             21 GET_ITER
             22 CALL_FUNCTION            1 (1 positional, 0 keyword pair)
             25 POP_TOP
             26 LOAD_CONST               5 (None)
             29 RETURN_VALUE
dissed, running
Caught exception during execution
Traceback (most recent call last):
  File "/usr/lib/python3.5/inspect.py", line 1088, in getfullargspec
    sigcls=Signature)
  File "/usr/lib/python3.5/inspect.py", line 2227, in _signature_from_callable
    return _signature_from_function(sigcls, obj)
  File "/usr/lib/python3.5/inspect.py", line 2103, in _signature_from_function
    kind=_POSITIONAL_OR_KEYWORD))
  File "/usr/lib/python3.5/inspect.py", line 2421, in __init__
    raise ValueError('{!r} is not a valid parameter name'.format(name))
ValueError: '.0' is not a valid parameter name

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/byterun/byterun/pyvm2.py", line 236, in dispatch
    why = bytecode_fn(*arguments)
  File "/usr/lib/python3.5/site-packages/byterun/byterun/pyvm2.py", line 930, in byte_CALL_FUNCTION
    return self.call_function(arg, [], {})
  File "/usr/lib/python3.5/site-packages/byterun/byterun/pyvm2.py", line 971, in call_function
    retval = func(*posargs, **namedargs)
  File "/usr/lib/python3.5/site-packages/byterun/byterun/pyobj.py", line 72, in __call__
    callargs = inspect.getcallargs(self._func, *args, **kwargs)
  File "/usr/lib/python3.5/inspect.py", line 1284, in getcallargs
    spec = getfullargspec(func)
  File "/usr/lib/python3.5/inspect.py", line 1094, in getfullargspec
    raise TypeError('unsupported callable') from ex
TypeError: unsupported callable
Traceback (most recent call last):
  File "/usr/lib/python3.5/inspect.py", line 1088, in getfullargspec
    sigcls=Signature)
  File "/usr/lib/python3.5/inspect.py", line 2227, in _signature_from_callable
    return _signature_from_function(sigcls, obj)
  File "/usr/lib/python3.5/inspect.py", line 2103, in _signature_from_function
    kind=_POSITIONAL_OR_KEYWORD))
  File "/usr/lib/python3.5/inspect.py", line 2421, in __init__
    raise ValueError('{!r} is not a valid parameter name'.format(name))
ValueError: '.0' is not a valid parameter name

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "python.py", line 173, in <module>
    """)
  File "python.py", line 166, in exec_python
    vm_value = vm.run_code(code)
  File "/usr/lib/python3.5/site-packages/byterun/byterun/pyvm2.py", line 145, in run_code
    val = self.run_frame(frame)
  File "/usr/lib/python3.5/site-packages/byterun/byterun/pyvm2.py", line 345, in run_frame
    six.reraise(*self.last_exception)
  File "/usr/lib/python3.5/site-packages/six.py", line 685, in reraise
    raise value.with_traceback(tb)
TypeError: unsupported callable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions