Skip to content

Callback crashes in emulation mode #2208

Closed
@emoise-gsi

Description

@emoise-gsi

callback_bug.zip
no_bug.zip

lpython version 0.18.4

Both callback_bug and no_bug (attached) contain three similar files:

  • main.py, which drives the program
  • emulation.py which contains the emulation implementation
  • the_callback.py / some_func.py

We can run both programs in emulation mode, taking care to update the PYTHONPATH with the location of lpython.py:
$ PYTHONPATH=/home/emoise/lpython/src/runtime/lpython/ python main.py

no_bug works just fine:
3

the_callback fails:
Traceback (most recent call last):
File "/home/emoise/lpython/callback_bug/main.py", line 8, in
from the_callback import entry_point
File "/home/emoise/lpython/callback_bug/the_callback.py", line 8, in
def bar(func : Callable[[i32], i32], arg : i32) -> i32:
File "/home/emoise/lpython/src/runtime/lpython/lpython.py", line 471, in ccall
return CTypes(f)
File "/home/emoise/lpython/src/runtime/lpython/lpython.py", line 371, in init
arg_ctype = convert_type_to_ctype(arg_type)
File "/home/emoise/lpython/src/runtime/lpython/lpython.py", line 294, in convert_type_to_ctype
type = convert_type_to_ctype(arg._type)
File "/home/emoise/lpython/src/runtime/lpython/lpython.py", line 298, in convert_type_to_ctype
elif issubclass(arg, Enum):
TypeError: issubclass() arg 1 must be a class

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions