Skip to content

Fix to pyOpenSSL stubs to pass stubtest #5657

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 44 commits into from
Jun 17, 2021
Merged

Fix to pyOpenSSL stubs to pass stubtest #5657

merged 44 commits into from
Jun 17, 2021

Conversation

jolaf
Copy link
Contributor

@jolaf jolaf commented Jun 17, 2021

No description provided.

jolaf and others added 30 commits October 7, 2019 17:41
@jolaf jolaf changed the title Trying to fix pyOpenSSL tests Fix to pyOpenSSL stubs to pass stubtest Jun 17, 2021
OpenSSL.SSL.Connection.__init__
OpenSSL.SSL.Context.load_verify_locations
OpenSSL.SSL.Context.set_verify
OpenSSL.crypto
Copy link
Collaborator

Choose a reason for hiding this comment

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

stubtest complains that OpenSSL.crypto doesn't exist. If you don't want to figure out what's going on with that, you can leave OpenSSL.crypto in the allowlist for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems I've figured out what's going on and proposed a fix:
python/mypy#10663

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Looks good, be we need to re-add OpenSSL.crypto back per Akuli's comment.

@jolaf
Copy link
Contributor Author

jolaf commented Jun 17, 2021

Looks good, be we need to re-add OpenSSL.crypto back per Akuli's comment.

I just wonder, why stubtest complains. OpenSSL.crypto definitely exists.

Here's the error output:

error: OpenSSL.crypto is not a module
Stub: at line 1
MypyFile:1(
  /home/runner/work/typeshed/typeshed/stubs/pyOpenSSL/OpenSSL/crypto.pyi)
Runtime:
<cryptography.utils._ModuleWithDeprecations object at 0x7f0217cf0b80>

The root of the problem seems to be here:
https://github.com/python/mypy/blob/master/mypy/stubtest.py#L206

Should that place in stubtest be fixed instead of hiding the error by excluding the test?

@srittau
Copy link
Collaborator

srittau commented Jun 17, 2021

Fixing this would be great, of course.

@jolaf
Copy link
Contributor Author

jolaf commented Jun 17, 2021

Fixing this would be great, of course.

I've just proposed a workaround to mypy.

@srittau
Copy link
Collaborator

srittau commented Jun 17, 2021

Per the feedback on the mypy bug, let's just add the item back in the allowlist.

@srittau srittau merged commit 4d981f8 into python:master Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants