[pypy-commit] pypy unicode-utf8: fix _ssl module
fijal
pypy.commits at gmail.com
Fri Nov 24 04:53:49 EST 2017
Author: fijal
Branch: unicode-utf8
Changeset: r93157:8a24f68050df
Date: 2017-11-24 10:53 +0100
http://bitbucket.org/pypy/pypy/changeset/8a24f68050df/
Log: fix _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
@@ -1566,12 +1566,13 @@
cadata = space.bufferstr_w(w_cadata)
else:
ca_file_type = SSL_FILETYPE_PEM
- try:
- cadata = space.unicode_w(w_cadata).encode('ascii')
- except UnicodeEncodeError:
+ w_uni = space.convert_arg_to_w_unicode(w_cadata)
+ if not w_uni.is_ascii():
raise oefmt(space.w_TypeError,
"cadata should be a ASCII string or a "
"bytes-like object")
+ cadata = space.utf8_w(w_uni)
+
if cafile is None and capath is None and cadata is None:
raise oefmt(space.w_TypeError,
"cafile and capath cannot be both omitted")
More information about the pypy-commit
mailing list