Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r74339:a1f50860377d
Date: 2014-11-04 16:11 -0800
http://bitbucket.org/pypy/pypy/changeset/a1f50860377d/
Log: issue1915: fix peercert(True) to return bytes
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
@@ -622,7 +622,8 @@
raise _ssl_seterror(space, self, length)
try:
# this is actually an immutable bytes sequence
- return space.wrap(rffi.charpsize2str(buf_ptr[0], length))
+ return space.wrapbytes(
+ rffi.charpsize2str(buf_ptr[0], length))
finally:
libssl_OPENSSL_free(buf_ptr[0])
else:
diff --git a/pypy/module/_ssl/test/test_ssl.py
b/pypy/module/_ssl/test/test_ssl.py
--- a/pypy/module/_ssl/test/test_ssl.py
+++ b/pypy/module/_ssl/test/test_ssl.py
@@ -181,6 +181,13 @@
self.s.close()
del ss; gc.collect()
+ def test_peer_certificate(self):
+ import gc, ssl
+ ss = ssl.wrap_socket(self.s)
+ assert ss.getpeercert() == {}
+ assert type(ss.getpeercert(True)) is bytes
+ self.s.close()
+ del ss; gc.collect()
class AppTestConnectedSSL_Timeout(AppTestConnectedSSL):
# Same tests, with a socket timeout
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit