bpo-22559: Implementation of the PEP 546: Backport MemoryBIO#2133
bpo-22559: Implementation of the PEP 546: Backport MemoryBIO#2133vstinner wants to merge 9 commits into
Conversation
alex
left a comment
There was a problem hiding this comment.
It's been a while since I looked at this patch, but from an initial glance it looks like what I expected.
Sorry, something went wrong.
|
Tests appear to be hanging; these suck to debug. Usually there's a hidden exception coming from one of the non-main threads. |
Sorry, something went wrong.
Implementation of the PEP 546: backport ssl.MemoryBIO and ssl.SSLObject from master to the 2.7 branch. Co-Authored-By: Alex Gaynor <alex.gaynor@gmail.com>
|
I rebased my change and addressed @alex and my comments. I removed [WIP] from the PR title, it's now ready for a real review :-) |
Sorry, something went wrong.
|
Tests still appear to be hanging, so that's going to be a blocker, I'll review for everything else. |
Sorry, something went wrong.
alex
left a comment
There was a problem hiding this comment.
Patch looks fine (and largely the same as my original one!). If you'd like help tracking down the hang in test_ssl, let me know.
Sorry, something went wrong.
|
Sigh, it took quite a while, but the answer is that Switching to Here's the diff I used to do all this testing: diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 4e34734662..c99db781c1 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -1757,17 +1757,17 @@ class NetworkedBIOTests(unittest.TestCase):
return ret
def test_handshake(self):
- with support.transient_internet("svn.python.org"):
+ with support.transient_internet(REMOTE_HOST):
sock = socket.socket(socket.AF_INET)
- sock.connect(("svn.python.org", 443))
+ sock.connect((REMOTE_HOST, 443))
incoming = ssl.MemoryBIO()
outgoing = ssl.MemoryBIO()
ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
ctx.verify_mode = ssl.CERT_REQUIRED
- ctx.load_verify_locations(SVN_PYTHON_ORG_ROOT_CERT)
+ ctx.load_verify_locations(REMOTE_ROOT_CERT)
if ssl.HAS_SNI:
ctx.check_hostname = True
- sslobj = ctx.wrap_bio(incoming, outgoing, False, 'svn.python.org')
+ sslobj = ctx.wrap_bio(incoming, outgoing, False, REMOTE_HOST)
else:
ctx.check_hostname = False
sslobj = ctx.wrap_bio(incoming, outgoing, False)
@@ -1786,9 +1786,9 @@ class NetworkedBIOTests(unittest.TestCase):
sock.close()
def test_read_write_data(self):
- with support.transient_internet("svn.python.org"):
+ with support.transient_internet(REMOTE_HOST):
sock = socket.socket(socket.AF_INET)
- sock.connect(("svn.python.org", 443))
+ sock.connect((REMOTE_HOST, 443))
incoming = ssl.MemoryBIO()
outgoing = ssl.MemoryBIO()
ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) |
Sorry, something went wrong.
|
@alex: I'm unable to reproduce the failure on my Fedora 25, so I tried your patch to see if it's going better on the CI. |
Sorry, something went wrong.
|
FWIW, I had no problem reproducing on macOS. What version of OpenSSL does Fedora 25 use? |
Sorry, something went wrong.
|
Fedora 25 uses OpenSSL 1.0.2k. |
Sorry, something went wrong.
|
You have to use |
Sorry, something went wrong.
|
Sadly, MemoryBIO will have to wait for Python 2.7.15 which has no schedule yet :-( |
Sorry, something went wrong.
|
The backport has a bug. |
Sorry, something went wrong.
This command loops on the "SSLSyscallError: Some I/O error occurred (_ssl.c:2097)" error while running SSLObject.unwrap(): "self.ssl_io_loop(sock, incoming, outgoing, sslobj.unwrap)". |
Sorry, something went wrong.
Implementation of the PEP 546: backport ssl.MemoryBIO and ssl.SSLObject from master to the 2.7 branch.
Co-Authored-By: Alex Gaynor alex.gaynor@gmail.com
http://bugs.python.org/issue22559
https://bugs.python.org/issue22559