Title: importing ssl can fail with NameError: name 'PROTOCOL_TLS' is not defined
Type: behavior Stage: resolved
Components: SSL Versions: Python 2.7
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: christian.heimes Nosy List: christian.heimes, jdemeyer
Priority: normal Keywords:

Created on 2017-02-17 11:35 by jdemeyer, last changed 2017-09-06 19:50 by christian.heimes. This issue is now closed.

Messages (2)
msg287989 - (view) Author: Jeroen Demeyer (jdemeyer) * (Python triager) Date: 2017-02-17 11:35
This is a regression introduced in Python 2.7.13:

Importing the ssl module can fail with

>>> import ssl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jdemeyer/sage/local/lib/python/", line 133, in <module>
NameError: name 'PROTOCOL_TLS' is not defined

While getting an ImportError from the ssl module is expected if SSL is not available (httplib for example handles that fine), a NameError is not.
msg287991 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2017-02-17 11:46
The _ssl extension module always defines and exports PROTOCOL_TLS. The name is always available. I guess you somehow mixed a new with an old Please verify that _ssl is correct and defines the name.
Date User Action Args
2017-09-06 19:50:40christian.heimessetstatus: open -> closed
type: behavior
resolution: works for me
stage: resolved
2017-02-17 11:46:32christian.heimessetmessages: + msg287991
2017-02-17 11:35:23jdemeyercreate