This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: importing ssl can fail with NameError: name 'PROTOCOL_TLS' is not defined
Type: behavior Stage: resolved
Components: SSL Versions: Python 2.7
process
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 2022-04-11 14:58 by admin. 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/ssl.py", line 133, in <module>
    PROTOCOL_SSLv23 = PROTOCOL_TLS
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 ssl.py with an old _ssl.so. Please verify that _ssl is correct and defines the name.
History
Date User Action Args
2022-04-11 14:58:43adminsetgithub: 73774
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