Unverified 提交 cb4aca30 authored 作者: Dan Foreman-Mackey's avatar Dan Foreman-Mackey 提交者: GitHub

Update extension suffix config var name

This should remove the deprecation warning on Python 3 where the configuration variable has been renamed to `EXT_SUFFIX` from `SO`.
上级 813faf6a
...@@ -248,6 +248,14 @@ static struct PyModuleDef moduledef = {{ ...@@ -248,6 +248,14 @@ static struct PyModuleDef moduledef = {{
# TODO: add_type # TODO: add_type
def _get_ext_suffix():
"""Get the suffix for compiled extensions"""
dist_suffix = distutils.sysconfig.get_config_var("EXT_SUFFIX")
if dist_suffix is None:
dist_suffix = distutils.sysconfig.get_config_var("SO")
return dist_suffix
def dlimport(fullpath, suffix=None): def dlimport(fullpath, suffix=None):
""" """
Dynamically load a .so, .pyd, .dll, or .py file. Dynamically load a .so, .pyd, .dll, or .py file.
...@@ -271,7 +279,7 @@ def dlimport(fullpath, suffix=None): ...@@ -271,7 +279,7 @@ def dlimport(fullpath, suffix=None):
if suffix is None: if suffix is None:
suffix = '' suffix = ''
dist_suffix = distutils.sysconfig.get_config_var("SO") dist_suffix = _get_ext_suffix()
if dist_suffix is not None and dist_suffix != '': if dist_suffix is not None and dist_suffix != '':
if fullpath.endswith(dist_suffix): if fullpath.endswith(dist_suffix):
suffix = dist_suffix suffix = dist_suffix
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论