invalid syntax: exec source.compile() in namespace
NeighborhoodCoding opened this issue · 4 comments
I'm win10 64bit user and i run your code as below
from jitpy.wrapper import jittify
@jittify([int, float], float)
def func(count, no):
s = 0
for i in range(count):
s += no
return s
func(1000, 1.2)
but it has an error as follows. why is that? cuz am i using 64bit windows?
Traceback (most recent call last):
File "c:\users\owner\appdata\local\programs\python\python36\lib\site-packages\IPython\core\interactiveshell.py", line 3319, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
from jitpy.wrapper import jittify
File "c:\users\owner\appdata\local\programs\python\python36\lib\site-packages\jitpy\wrapper.py", line 68
exec source.compile() in namespace
^
SyntaxError: invalid syntax
The code supports python2 semantics. This should become exec(source.compile, namespace)
Sorry, the code already has exec(source.compile, namespace)
. What version of PyPy are you using?
@mattip You're confused, there are two levels of exec
in this traceback. The one in File c:\users\owner\appdata\local\programs\python\python36\lib\site-packages\jitpy\wrapper.py
is using Python 2 syntax (and I doubt it would just work on Python 3.x out of the box once this line is fixed, but it's probably not a lot of work overall).
Sorry, I closed this issue thinking there is no plan to officially upgrade this old stuff. Please reopen if I'm wrong.