VcamX added a comment.

I think it's a platform-specific bug for ssl.SSLError, or a misuse of 
ssl.SSLError.
I executed the following commands on different platforms:

  >>> import ssl
  >>> class AError(Exception): pass
  >>> str(ssl.SSLError('a', AError('b')))

and got different results:

2.6.9:

  >>> str(ssl.SSLError('a', AError('b')))
  '[Errno a] b'

2.7.9:

  >>> str(ssl.SSLError('a', AError('b')))
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: __str__ returned non-string (type AError)

3.4.3:

  >>> str(ssl.SSLError('a', AError('b')))
  "('a', AError('b',))"

On 2.7.9, it seems that if the second element of args of ssl.SSLError is not a 
string (str or unicode), TypeError is always raised.
And urllib3 raise a ssl.SSLError with OpenSSL.SSL.Error as its second element 
of args. 
https://github.com/kennethreitz/requests/blob/master/requests/packages/urllib3/contrib/pyopenssl.py#L290

My patch is replace `raise ssl.SSLError('bad handshake', e)` with `raise 
ssl.SSLError('bad handshake', str(e))`


TASK DETAIL
  https://phabricator.wikimedia.org/T105767

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: VcamX
Cc: VcamX, Aklapper, jayvdb, pywikibot-bugs-list, Malyacko, P.Copp



_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to