[pypy-issue] Issue #3040: ssl module in pypy3.6 does not have ssl.OP_NO_SSLv2 (pypy/pypy)

Amit Ripshtos issues-reply at bitbucket.org
Mon Jul 8 08:56:14 EDT 2019

New issue 3040: ssl module in pypy3.6 does not have ssl.OP_NO_SSLv2

Amit Ripshtos:

Hey guys, thanks for working on pypy!

I found an issue when using aiohttp with pypy3.6 and doing verify=False , the aiohttp code creates SSLContext by doing:

sslcontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
sslcontext.options |= ssl.OP_NO_SSLv2
sslcontext.options |= ssl.OP_NO_SSLv3
sslcontext.options |= ssl.OP_NO_COMPRESSION
return sslcontext


However, this code fails with the following exception:

AttributeError: module 'ssl' has no attribute 'OP_NO_SSLv2'


I tried to take a look and I saw that in pypy3.6, the attribute/option “OP\_NO\_SSLv2”, therefore the aiohttp package fails when using the verify\_ssl=False setting.


**How to mimic the issue:**

Using pypy3.6, try to run this code:

import aiohttp

async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(verify_ssl=False)) as session:
    async with session.request(method='get', url='https://google.com') as response:
        await response.read()


This code will fail with the exception:

`AttributeError: module 'ssl' has no attribute 'OP_NO_SSLv2'`


**How it should be:**

There should be be OP\_NO\_SSLv2 attribute under ssl module.


I will try to fix the issue on my own, however I’m a newbie to pypy code , therefore I might need help.


Thanks and have a great week,


More information about the pypy-issue mailing list