These are chat archives for dropbox/pyston

14th
Apr 2019
If have a file:
import pyximport
pyximport.install(pyimport=True, build_dir='xx')

import six
Since six is a pure python module, looks like cython can cythonize it totally, but I got an error while run this file:
Traceback (most recent call last):
  File "a.py", line 4, in <module>
    import six
  File "/Users/anlong/Library/Python/2.7/lib/python/site-packages/pyximport/pyximport.py", line 419, in load_module
    return load_module(fullname, source_path, so_path=so_path, is_package=is_package)
  File "/Users/anlong/Library/Python/2.7/lib/python/site-packages/pyximport/pyximport.py", line 233, in load_module
    exec("raise exc, None, tb", {'exc': exc, 'tb': tb})
  File "/Users/anlong/Library/Python/2.7/lib/python/site-packages/pyximport/pyximport.py", line 216, in load_module
    mod = imp.load_dynamic(name, so_path)
  File "six.py", line 805, in init six
    _add_doc(reraise, """Reraise an exception.""")
ImportError: Building module six failed: ["NameError: name 'reraise' is not defined\n"]
An Long
@aisk
Apr 14 12:09
A quick dig is that reraise is defined with exec statement with reraise function as a string, so seems cython don't support this use case.
Another try is just change the import six to import requests, with another error:
Traceback (most recent call last):
  File "a.py", line 4, in <module>
    import requests
  File "/Users/anlong/Library/Python/2.7/lib/python/site-packages/pyximport/pyximport.py", line 419, in load_module
    return load_module(fullname, source_path, so_path=so_path, is_package=is_package)
  File "/Users/anlong/Library/Python/2.7/lib/python/site-packages/pyximport/pyximport.py", line 233, in load_module
    exec("raise exc, None, tb", {'exc': exc, 'tb': tb})
  File "/Users/anlong/Library/Python/2.7/lib/python/site-packages/pyximport/pyximport.py", line 216, in load_module
    mod = imp.load_dynamic(name, so_path)
  File "__init__.py", line 43, in init requests.__init__
  File "/Users/anlong/Library/Python/2.7/lib/python/site-packages/pyximport/pyximport.py", line 419, in load_module
    return load_module(fullname, source_path, so_path=so_path, is_package=is_package)
  File "/Users/anlong/Library/Python/2.7/lib/python/site-packages/pyximport/pyximport.py", line 233, in load_module
    exec("raise exc, None, tb", {'exc': exc, 'tb': tb})
  File "/Users/anlong/Library/Python/2.7/lib/python/site-packages/pyximport/pyximport.py", line 216, in load_module
    mod = imp.load_dynamic(name, so_path)
  File "__init__.py", line 8, in init urllib3.__init__
ImportError: Building module requests failed: ["ImportError: Building module urllib3 failed: ['ValueError: Attempted relative import in non-package\\n']\n"]
An Long
@aisk
Apr 14 12:15
Another try is with flask and jedi, and they all failed.
An Long
@aisk
Apr 14 12:21
Looks like cython have more limitations than the documents said. Improve the compatibility of cython is good, but I don't know how long the gaps were.
Kevin Modzelewski
@kmod
Apr 14 23:48
Interesting! A bit disappointing, but good to know