Skip to content

Commit 02f9920

Browse files
authored
gh-100062: Remove error code tables from _ssl and err_names_to_codes (GH-100063)
Prior to #25300, the make_ssl_data.py script used various tables, exposed in _ssl, to update the error list. After that PR, this is no longer used. Moreover, the err_names_to_codes map isn't used at all. Clean those up. This gets them out of the way if, in the future, OpenSSL provides an API to do what the code here is doing directly. (openssl/openssl#19848)
1 parent 5ffc1e5 commit 02f9920

File tree

2 files changed

+0
-15
lines changed

2 files changed

+0
-15
lines changed

Modules/_ssl.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5991,9 +5991,6 @@ sslmodule_init_errorcodes(PyObject *module)
59915991
state->err_codes_to_names = PyDict_New();
59925992
if (state->err_codes_to_names == NULL)
59935993
return -1;
5994-
state->err_names_to_codes = PyDict_New();
5995-
if (state->err_names_to_codes == NULL)
5996-
return -1;
59975994
state->lib_codes_to_names = PyDict_New();
59985995
if (state->lib_codes_to_names == NULL)
59995996
return -1;
@@ -6007,8 +6004,6 @@ sslmodule_init_errorcodes(PyObject *module)
60076004
return -1;
60086005
if (PyDict_SetItem(state->err_codes_to_names, key, mnemo))
60096006
return -1;
6010-
if (PyDict_SetItem(state->err_names_to_codes, mnemo, key))
6011-
return -1;
60126007
Py_DECREF(key);
60136008
Py_DECREF(mnemo);
60146009
errcode++;
@@ -6028,13 +6023,6 @@ sslmodule_init_errorcodes(PyObject *module)
60286023
libcode++;
60296024
}
60306025

6031-
if (PyModule_AddObjectRef(module, "err_codes_to_names", state->err_codes_to_names))
6032-
return -1;
6033-
if (PyModule_AddObjectRef(module, "err_names_to_codes", state->err_names_to_codes))
6034-
return -1;
6035-
if (PyModule_AddObjectRef(module, "lib_codes_to_names", state->lib_codes_to_names))
6036-
return -1;
6037-
60386026
return 0;
60396027
}
60406028

@@ -6189,7 +6177,6 @@ sslmodule_traverse(PyObject *m, visitproc visit, void *arg)
61896177
Py_VISIT(state->PySSLSyscallErrorObject);
61906178
Py_VISIT(state->PySSLEOFErrorObject);
61916179
Py_VISIT(state->err_codes_to_names);
6192-
Py_VISIT(state->err_names_to_codes);
61936180
Py_VISIT(state->lib_codes_to_names);
61946181
Py_VISIT(state->Sock_Type);
61956182

@@ -6214,7 +6201,6 @@ sslmodule_clear(PyObject *m)
62146201
Py_CLEAR(state->PySSLSyscallErrorObject);
62156202
Py_CLEAR(state->PySSLEOFErrorObject);
62166203
Py_CLEAR(state->err_codes_to_names);
6217-
Py_CLEAR(state->err_names_to_codes);
62186204
Py_CLEAR(state->lib_codes_to_names);
62196205
Py_CLEAR(state->Sock_Type);
62206206
Py_CLEAR(state->str_library);

Modules/_ssl.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ typedef struct {
2525
PyObject *PySSLEOFErrorObject;
2626
/* Error mappings */
2727
PyObject *err_codes_to_names;
28-
PyObject *err_names_to_codes;
2928
PyObject *lib_codes_to_names;
3029
/* socket type from module CAPI */
3130
PyTypeObject *Sock_Type;

0 commit comments

Comments
 (0)