Workaround to stubtest to handle pyOpenSSL correctly#10663
Workaround to stubtest to handle pyOpenSSL correctly#10663jolaf wants to merge 7 commits intopython:masterfrom
Conversation
… cryptography.utils._ModuleWithDeprecations
|
This seems quite fragile. Personally I would just ignore it in typeshed. In general, stubtest isn't meant to work perfectly in every possible situation, which is why the exclude lists exist. |
|
I agree with @Akuli, I don't think we should add this kind of module-specific logic. |
Well, I understand that, but after I've made this fix, |
|
This will become unnecessary in the future when module-level |
|
That future is here as of Python 3.7, for what it's worth. |
|
But pyopenssl still supports Python 2 (eww) and 3.6. https://github.com/pyca/pyopenssl/blob/main/setup.py |
hauntsaninja
left a comment
There was a problem hiding this comment.
Thanks, the improvements to pyOpenSSL have been great!
Like others here, I'm wary of special casing for specific packages in stubtest. I'd be potentially okay with it if it were a common idiom, but I don't think that's the case. value is a very common attribute name and this could cause some confusing things to happen.
I see this would not be merged, but just in case, I've provided a more explicit check excluding any vagueness. |
…s not going to be merged. See python/mypy#10663.
Description
Currently,
stubtestfails onpyOpenSSLstubs becausepyOpenSSLhas its submodules wrapped intocryptography.utils._ModuleWithDeprecationsinstances and some of the methods wrapped intocryptography.utils._DeprecatedValueinstances.See python/typeshed#5657 (comment) for details.
This PR adds additional checks to
runtimefield that allows unwrapping_ModuleWithDeprecationsand_DeprecatedValueobjects and extracting module and function objects from them.Test Plan
After this PR is applied, tests for python/typeshed#5657 should pass without errors.