-
-
Notifications
You must be signed in to change notification settings - Fork 3k
The behavior of --no-explicit-reexport
is inconsistent/misleading
#11706
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
Comments
Thanks, can repro the inconsistency on master, the expected behaviour is an error in both cases. This was somewhat recently clarified in PEP 484 (https://github.com/python/peps/pull/1630/files) |
I'd welcome a corresponding update to our docs, if you want to make a PR for it! :-) |
* application: remove unecessary dropped error msg (#186) * socketcan: improve incorrect config error message * transport: can: pythoncan: update can mtu heuristic to support slcan * Fix #193 * Fix #192 * Bump the dependency versions * Deprecate the loop property and constructor parameter * Cover #146 * Fix #176 * Add Python 3.10 * Add a temporary workaround for Python 3.10 segfault during testing -- to be removed later when Python is fixed * Rename installation extras to avoid warnings from pip * Make SocketCAN test resilient against frame reordering * Generate aliases for the newest minor version per major version * Temporarily restrict Windows builds to Python 3.7 and 3.10 (oldest and newest) due to timeout issues * Remove unnecessary minor version references from the application module * MyPy: selectively enable explicit_reexport to work around this problem python/mypy#11706 Co-authored-by: Kalyan Sriram <[email protected]> Co-authored-by: Kalyan Sriram <[email protected]>
This is a bit unexpected. What is the recommended pattern for re-exporting an entity under a different name? The following obvious approach looks verbose: from x import y
z = y |
Yup, that's what we used in typeshed :-) |
Fixes #11706 Co-authored-by: hauntsaninja <>
Fixes python#11706 Co-authored-by: hauntsaninja <>
Explicitly reexports PRNGKeyArray as KeyArray in accordance with PEP 484 See also: python/mypy#11706
Bug Report
The behavior of
--no-explicit-reexport
is inconsistent/misleading, see MWE below.To Reproduce
Define the following package of four files:
a/__init__.py
:a/X.py
c.py
d.py
Expected Behavior
Actual Behavior
The docs state that the form
import ... as ...
is sufficient to mark the imported item for re-export, so this is expected to work. However, the most suspicious part is that if you modifyc.py
(sic!) as follows:then MyPy reports no error.
One would expect both cases to be accepted.
Note that if
a
is not a package, both cases yield a re-export error.Your Environment
--strict --no-implicit-reexport
mypy.ini
(and other config files): noneThe text was updated successfully, but these errors were encountered: