[pypy-commit] pypy default: Pass mode around, everyone supports it, it's just about passing it
fijal
noreply at buildbot.pypy.org
Wed Dec 7 20:37:21 CET 2011
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch:
Changeset: r50287:b4badea8f26f
Date: 2011-12-07 21:35 +0200
http://bitbucket.org/pypy/pypy/changeset/b4badea8f26f/
Log: Pass mode around, everyone supports it, it's just about passing it
diff --git a/pypy/rlib/clibffi.py b/pypy/rlib/clibffi.py
--- a/pypy/rlib/clibffi.py
+++ b/pypy/rlib/clibffi.py
@@ -639,11 +639,11 @@
return dlsym(self.lib, name)
class CDLL(RawCDLL):
- def __init__(self, libname):
+ def __init__(self, libname, mode=-1):
"""Load the library, or raises DLOpenError."""
RawCDLL.__init__(self, rffi.cast(DLLHANDLE, -1))
with rffi.scoped_str2charp(libname) as ll_libname:
- self.lib = dlopen(ll_libname)
+ self.lib = dlopen(ll_libname, mode)
def __del__(self):
if self.lib != rffi.cast(DLLHANDLE, -1):
diff --git a/pypy/rlib/libffi.py b/pypy/rlib/libffi.py
--- a/pypy/rlib/libffi.py
+++ b/pypy/rlib/libffi.py
@@ -393,11 +393,11 @@
# XXX: it partially duplicate the code in clibffi.py
class CDLL(object):
- def __init__(self, libname):
+ def __init__(self, libname, mode=-1):
"""Load the library, or raises DLOpenError."""
self.lib = rffi.cast(DLLHANDLE, 0)
with rffi.scoped_str2charp(libname) as ll_libname:
- self.lib = dlopen(ll_libname)
+ self.lib = dlopen(ll_libname, mode)
def __del__(self):
if self.lib:
diff --git a/pypy/rlib/test/test_libffi.py b/pypy/rlib/test/test_libffi.py
--- a/pypy/rlib/test/test_libffi.py
+++ b/pypy/rlib/test/test_libffi.py
@@ -443,3 +443,4 @@
assert p[1] == 34
lltype.free(p, flavor='raw')
lltype.free(ffi_point_struct, flavor='raw')
+
More information about the pypy-commit
mailing list