8000 gh-100062: Remove error code tables from _ssl and err_names_to_codes · python/cpython@12b9314 · GitHub
[go: up one dir, main page]

Skip to content

Commit 12b9314

Browse files
committed
gh-100062: Remove error code tables from _ssl and err_names_to_codes
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 b72014c commit 12b9314

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
@@ -5967,9 +5967,6 @@ sslmodule_init_errorcodes(PyObject *module)
59675967
state->err_codes_to_names = PyDict_New();
59685968
if (state->err_codes_to_names == NULL)
59695969
return -1;
5970-
state->err_names_to_codes = PyDict_New();
5971-
if (state->err_names_to_codes == NULL)
5972-
return -1;
59735970
state->lib_codes_to_names = PyDict_New();
59745971
if (state->lib_codes_to_names == NULL)
59755972
return -1;
@@ -5983,8 +5980,6 @@ sslmodule_init_errorcodes(PyObject *module)
59835980
return -1;
59845981
if (PyDict_SetItem(state->err_codes_to_names, key, mnemo))
59855982
return -1;
5986-
if (PyDict_SetItem(state->err_names_to_codes, mnemo, key))
5987-
return -1;
59885983
Py_DECREF(key);
59895984
Py_DECREF(mnemo);
59905985
errcode++;
@@ -6004,13 +5999,6 @@ sslmodule_init_errorcodes(PyObject *module)
60045999
libcode++;
60056000
}
60066001

6007-
if (PyModule_AddObjectRef(module, "err_codes_to_names", state->err_codes_to_names))
6008-
return -1;
6009-
if (PyModule_AddObjectRef(module, "err_names_to_codes", state->err_names_to_codes))
6010-
return -1;
6011-
if (PyModule_AddObjectRef(module, "lib_codes_to_names", state->lib_codes_to_names))
6012-
return -1;
6013-
60146002
return 0;
60156003
}
60166004

@@ -6165,7 +6153,6 @@ sslmodule_traverse(PyObject *m, visitproc visit, void *arg)
61656153
Py_VISIT(state->PySSLSyscallErrorObject);
61666154
Py_VISIT(state->PySSLEOFErrorObject);
61676155
Py_VISIT(state->err_codes_to_names);
6168-
Py_VISIT(state->err_names_to_codes);
61696156
Py_VISIT(state->lib_codes_to_names);
61706157
Py_VISIT(state->Sock_Type);
61716158

@@ -6190,7 +6177,6 @@ sslmodule_clear(PyObject *m)
61906177
Py_CLEAR(state->PySSLSyscallErrorObject);
61916178
Py_CLEAR(state->PySSLEOFErrorObject);
61926179
Py_CLEAR(state->err_codes_to_names);
6193-
Py_CLEAR(state->err_names_to_codes);
61946180
Py_CLEAR(state->lib_codes_to_names);
61956181
Py_CLEAR(state->Sock_Type);
61966182
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)
0