[pypy-commit] pypy py3k: Oops, fix translation of _ssl module.

amauryfa noreply at buildbot.pypy.org
Sun Oct 7 21:33:38 CEST 2012


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r57868:5702ff1929a4
Date: 2012-10-07 10:49 +0200
http://bitbucket.org/pypy/pypy/changeset/5702ff1929a4/

Log:	Oops, fix translation of _ssl module.

diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py
--- a/pypy/module/_ssl/interp_ssl.py
+++ b/pypy/module/_ssl/interp_ssl.py
@@ -160,10 +160,11 @@
     def get_options_w(self, space):
         return space.wrap(libssl_SSL_CTX_get_options(self.ctx))
 
-    def set_options_w(self, space, value):
+    def set_options_w(self, space, w_value):
+        value = space.int_w(w_value)
         opts = libssl_SSL_CTX_get_options(self.ctx)
-        clear = opts & ~new_opts
-        set = ~opts & new_opts
+        clear = opts & ~value
+        set = ~opts & value
         if clear:
             if HAVE_SSL_CTX_CLEAR_OPTIONS:
                 libssl_SSL_CTX_clear_options(self.ctx, clear)
diff --git a/pypy/rlib/ropenssl.py b/pypy/rlib/ropenssl.py
--- a/pypy/rlib/ropenssl.py
+++ b/pypy/rlib/ropenssl.py
@@ -183,6 +183,7 @@
 OBJ_NAME = rffi.CArrayPtr(OBJ_NAME_st)
 
 HAVE_OPENSSL_RAND = OPENSSL_VERSION_NUMBER >= 0x0090500f
+HAVE_SSL_CTX_CLEAR_OPTIONS = OPENSSL_VERSION_NUMBER >= 0x009080df
 
 def external(name, argtypes, restype, **kw):
     kw['compilation_info'] = eci
@@ -218,7 +219,9 @@
 ssl_external('SSLv23_method', [], SSL_METHOD)
 ssl_external('SSL_CTX_use_PrivateKey_file', [SSL_CTX, rffi.CCHARP, rffi.INT], rffi.INT)
 ssl_external('SSL_CTX_use_certificate_chain_file', [SSL_CTX, rffi.CCHARP], rffi.INT)
+ssl_external('SSL_CTX_get_options', [SSL_CTX], rffi.INT, macro=True)
 ssl_external('SSL_CTX_set_options', [SSL_CTX, rffi.INT], rffi.INT, macro=True)
+ssl_external('SSL_CTX_clear_options', [SSL_CTX, rffi.INT], rffi.INT, macro=True)
 ssl_external('SSL_CTX_ctrl', [SSL_CTX, rffi.INT, rffi.INT, rffi.VOIDP], rffi.INT)
 ssl_external('SSL_CTX_set_verify', [SSL_CTX, rffi.INT, rffi.VOIDP], lltype.Void)
 ssl_external('SSL_CTX_get_verify_mode', [SSL_CTX], rffi.INT)


More information about the pypy-commit mailing list