Skip to content

Commit

Permalink
Use different method for getting ext_suffix
Browse files Browse the repository at this point in the history
```
ext_suffix = get_config_var("EXT_SUFFIX") or get_config_var("SO")
```

because `get_config_var("SO")` returns None in Python 3.4.0a4 because the "SO"
variable is deprecated and "EXT_SUFFIX" is the new way to get this information
(see: http://bugs.python.org/issue19555)

This fixes `TypeError: Can't convert 'NoneType' object to str implicitly`
errors when running the tests on Python 3.4.0a4.
  • Loading branch information
msabramo authored and dlitz committed Feb 22, 2014
1 parent da8b673 commit 5dc0db2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/Crypto/SelfTest/PublicKey/test_DSA.py
Expand Up @@ -227,9 +227,10 @@ def get_tests(config={}):
except ImportError:
from distutils.sysconfig import get_config_var
import inspect
ext_suffix = get_config_var("EXT_SUFFIX") or get_config_var("SO")
_fm_path = os.path.normpath(os.path.dirname(os.path.abspath(
inspect.getfile(inspect.currentframe())))
+"/../../PublicKey/_fastmath"+get_config_var("SO"))
+"/../../PublicKey/_fastmath"+ext_suffix)
if os.path.exists(_fm_path):
raise ImportError("While the _fastmath module exists, importing "+
"it failed. This may point to the gmp or mpir shared library "+
Expand Down
3 changes: 2 additions & 1 deletion lib/Crypto/SelfTest/PublicKey/test_RSA.py
Expand Up @@ -463,9 +463,10 @@ def get_tests(config={}):
except ImportError:
from distutils.sysconfig import get_config_var
import inspect
ext_suffix = get_config_var("EXT_SUFFIX") or get_config_var("SO")
_fm_path = os.path.normpath(os.path.dirname(os.path.abspath(
inspect.getfile(inspect.currentframe())))
+"/../../PublicKey/_fastmath"+get_config_var("SO"))
+"/../../PublicKey/_fastmath"+ext_suffix)
if os.path.exists(_fm_path):
raise ImportError("While the _fastmath module exists, importing "+
"it failed. This may point to the gmp or mpir shared library "+
Expand Down
3 changes: 2 additions & 1 deletion lib/Crypto/SelfTest/Util/test_number.py
Expand Up @@ -327,9 +327,10 @@ def get_tests(config={}):
except ImportError:
from distutils.sysconfig import get_config_var
import inspect, os.path
ext_suffix = get_config_var("EXT_SUFFIX") or get_config_var("SO")
_fm_path = os.path.normpath(os.path.dirname(os.path.abspath(
inspect.getfile(inspect.currentframe())))
+"/../../PublicKey/_fastmath"+get_config_var("SO"))
+"/../../PublicKey/_fastmath"+ext_suffix)
if os.path.exists(_fm_path):
raise ImportError("While the _fastmath module exists, importing "+
"it failed. This may point to the gmp or mpir shared library "+
Expand Down

0 comments on commit 5dc0db2

Please sign in to comment.