8000 gh-100062: Remove error code tables from _ssl and err_names_to_codes by davidben · Pull Request #100063 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

8000 gh-100062: Remove error code tables from _ssl and err_names_to_codes #100063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 3, 2023

Conversation

davidben
Copy link
Contributor
@davidben davidben commented Dec 6, 2022

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)

…codes

Prior to python#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)
@netlify
Copy link
netlify bot commented Dec 6, 2022

Deploy Preview for python-cpython-preview ready!

Name Link
🔨 Latest commit 12b9314
🔍 Latest deploy log https://app.netlify.com/sites/python-cpython-preview/deploys/638faf8e61a30000096a8897
😎 Deploy Preview https://deploy-preview-100063--python-cpython-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@@ -6165,7 +6153,6 @@ sslmodule_traverse(PyObject *m, visitproc visit, void *arg)
Py_VISIT(state->PySSLSyscallErrorObject);
Py_VISIT(state->PySSLEOFErrorObject);
Py_VISIT(state->err_codes_to_names);
Py_VISIT(state->err_names_to_codes);
Py_VISIT(state->lib_codes_to_names);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not very familiar with the CPython API, so I wasn't sure if this should be removed now that the objects are no longer exported. I noticed Sock_Type doesn't seem to be exported, but is traversed, while str_library is also unexported but not traversed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for cycle detection. Sock_Type is a type object, which may contain references that could cause cycles, while I assume str_library is a string, which can never participate in a cycle. So we visit the former but not the latter.

@davidben
Copy link
Contributor Author

@tiran This PR look reasonable? Anything missing on my end?

@arhadthedev
Copy link
Member

Adding the skip news label because _ssl.h is located outside Include and thus cannot be used by third parties.

@arhadthedev arhadthedev added skip news extension-modules C modules in the Modules dir topic-SSL labels Apr 1, 2023
@arhadthedev
Copy link
Member

@jackjansen, @dstufft, @alex (as active ssl experts)

@alex
Copy link
Member
alex commented Apr 1, 2023

This looks good to me, but I'm going to wait for a bit before merging in case one of the other maintainers know of a reason these were exposed.

@davidben
Copy link
Contributor Author
davidben commented Apr 1, 2023

My (possibly wrong) guess is that were exposed for the older version of the make_ssl_data.py script. (See PR description.)

Copy link
Member
@zooba zooba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -6165,7 +6153,6 @@ sslmodule_traverse(PyObject *m, visitproc visit, void *arg)
Py_VISIT(state->PySSLSyscallErrorObject);
Py_VISIT(state->PySSLEOFErrorObject);
Py_VISIT(state->err_codes_to_names);
Py_VISIT(state->err_names_to_codes);
Py_VISIT(state->lib_codes_to_names);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for cycle detection. Sock_Type is a type object, which may contain references that could cause cycles, while I assume str_library is a string, which can never participate in a cycle. So we visit the former but not the latter.

@zooba
Copy link
Member
zooba commented Apr 3, 2023

Let's merge this before the next alpha so there's more time for someone to shout if we shouldn't have dropped it.

@zooba zooba merged commit 02f9920 into python:main Apr 3, 2023
gaogaotiantian pushed a commit to gaogaotiantian/cpython that referenced this pull request Apr 8, 2023
…codes (pythonGH-100063)

Prior to python#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)
warsaw pushed a commit to warsaw/cpython that referenced this pull request Apr 11, 2023
…codes (pythonGH-100063)

Prior to python#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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0