You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm the author of Nimporter and I'm trying to debug a multithreading issue (as described here for completeness but also happens without using Nimporter).
Put simply, calling any Nim function in another thread causes Python to crash.
Reproduction Steps
calc.nim:
import nimpy
procadd(a: int, b: int): int {.exportpy.} =return a + b
Compiled with: nim c --threads:on --app:lib --out:calc.pyd calc
Just ran it on linux, and it doesn't crash. There seems to be a typo in your code target=calc which causes python exception
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
TypeError: 'module' object is not callable
But if corrected, the program runs just fine. So it might be something windows specific.
Ah, yes sorry for the copy paste error.
That sounds familiar, now that you say that it works on Linux, I believe that there may be a Nim flag I can set for this.
Thanks for looking into it!
Hello, I'm the author of Nimporter and I'm trying to debug a multithreading issue (as described here for completeness but also happens without using Nimporter).
Put simply, calling any Nim function in another thread causes Python to crash.
Reproduction Steps
calc.nim:
Compiled with:
nim c --threads:on --app:lib --out:calc.pyd calc
Import and use in Python file:
Starting the second thread is what causes the crash.
The text was updated successfully, but these errors were encountered: