[pypy-commit] pypy default: test, fix CDLL(None) on win32 should raise TypeError
mattip
pypy.commits at gmail.com
Tue Sep 17 03:46:56 EDT 2019
Author: Matti Picus <matti.picus at gmail.com>
Branch:
Changeset: r97505:5605eba9586b
Date: 2019-09-17 10:04 +0300
http://bitbucket.org/pypy/pypy/changeset/5605eba9586b/
Log: test, fix CDLL(None) on win32 should raise TypeError
diff --git a/pypy/module/_rawffi/interp_rawffi.py b/pypy/module/_rawffi/interp_rawffi.py
--- a/pypy/module/_rawffi/interp_rawffi.py
+++ b/pypy/module/_rawffi/interp_rawffi.py
@@ -239,7 +239,11 @@
except OSError as e:
raise wrap_oserror(space, e)
- at unwrap_spec(name='fsencode_or_none')
+if _MS_WINDOWS:
+ name_spec = 'fsencode'
+else:
+ name_spec = 'fsencode_or_none'
+ at unwrap_spec(name=name_spec)
def descr_new_cdll(space, w_type, name):
cdll = open_cdll(space, name)
return W_CDLL(space, name, cdll)
diff --git a/pypy/module/_rawffi/test/test__rawffi.py b/pypy/module/_rawffi/test/test__rawffi.py
--- a/pypy/module/_rawffi/test/test__rawffi.py
+++ b/pypy/module/_rawffi/test/test__rawffi.py
@@ -262,14 +262,17 @@
raise AssertionError("did not fail??")
def test_libload_None(self):
- if self.iswin32:
- skip("unix specific")
import _rawffi
# this should return *all* loaded libs, dlopen(NULL)
- dll = _rawffi.CDLL(None)
- func = dll.ptr('rand', [], 'i')
- res = func()
- assert res[0] != 0
+ try:
+ dll = _rawffi.CDLL(None)
+ except TypeError:
+ if not self.iswin32:
+ raise
+ else:
+ func = dll.ptr('rand', [], 'i')
+ res = func()
+ assert res[0] != 0
def test_libc_load(self):
import _rawffi
More information about the pypy-commit
mailing list