Author: Attila Gobi <attila.g...@gmail.com>
Branch: py3.3
Changeset: r72501:2e121b41a4c3
Date: 2014-07-26 13:47 +0200
http://bitbucket.org/pypy/pypy/changeset/2e121b41a4c3/

Log:    creating the RTLD_* constants in the module posix

diff --git a/pypy/module/posix/__init__.py b/pypy/module/posix/__init__.py
--- a/pypy/module/posix/__init__.py
+++ b/pypy/module/posix/__init__.py
@@ -1,5 +1,6 @@
 from pypy.interpreter.mixedmodule import MixedModule
 from rpython.rtyper.module.ll_os import RegisterOs
+from rpython.rlib import rdynload
 
 import os
 exec 'import %s as posix' % os.name
@@ -173,6 +174,12 @@
         if hasattr(os, name):
             interpleveldefs[name] = 'interp_posix.' + name
 
+    for _name in ["RTLD_LAZY", "RTLD_NOW", "RTLD_GLOBAL", "RTLD_LOCAL",
+                  "RTLD_NODELETE", "RTLD_NOLOAD", "RTLD_DEEPBIND"]:
+        if getattr(rdynload.cConfig, _name) is not None:
+            interpleveldefs[_name] = 'space.wrap(%d)' % (
+                getattr(rdynload.cConfig, _name),)
+
     # os.py uses this list to build os.supports_dir_fd() and os.supports_fd().
     # Fill with e.g. HAVE_FCHDIR, when os.chdir() supports file descriptors.
     interpleveldefs['_have_functions'] = 'space.newlist([])'
diff --git a/pypy/module/posix/test/test_posix2.py 
b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -1042,6 +1042,12 @@
         # just ensure it returns something reasonable
         assert encoding is None or type(encoding) is str
 
+    def test_rtld_constants(self):
+        # check presence of major RTLD_* constants
+        self.posix.RTLD_LAZY
+        self.posix.RTLD_NOW
+        self.posix.RTLD_GLOBAL
+        self.posix.RTLD_LOCAL
 
 class AppTestEnvironment(object):
     def setup_class(cls):
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to