cython/cython

cython.inline() fails in Windows with Py3.8+

Open

#3,450 opened on Mar 21, 2020

View on GitHub
 (3 comments) (0 reactions) (0 assignees)Python (1,517 forks)batch import
Build Systemdefecthelp wanted

Repository metrics

Stars
 (8,663 stars)
PR merge metrics
 (Avg merge 45d 12h) (52 merged PRs in 30d)

Description

ERROR: test_globals (Cython.Build.Tests.TestInline.TestInline)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\cython\Cython\Build\Tests\TestInline.py", line 41, in test_globals
    self.assertEqual(inline("return global_value + 1", **self.test_kwds), global_value + 1)
  File "C:\projects\cython\Cython\Shadow.py", line 135, in inline
    return _cython_inline(f, *args, **kwds)
  File "C:\projects\cython\Cython\Build\Inline.py", line 259, in cython_inline
    module = load_dynamic(module_name, module_path)
  File "C:\projects\cython\Cython\Build\Inline.py", line 42, in load_dynamic
    return ExtensionFileLoader(name, module_path).load_module()
  File "<frozen importlib._bootstrap_external>", line 462, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 962, in load_module
  File "<frozen importlib._bootstrap_external>", line 787, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 702, in _load
  File "<frozen importlib._bootstrap>", line 657, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 556, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1101, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed while importing _cython_inline_0579421af28a1cb71f2d91fd2ff77f6045df6228: The parameter is incorrect.

Probably related: https://bugs.python.org/issue36085 I think we need to call os.add_dll_directory() for the target path of the generated extension modules.

Contributor guide