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
heapq: re-export, add __about__ #7308
Conversation
|
Looks like Line 12 in 879b617
|
This comment has been hidden.
This comment has been hidden.
|
Why does |
|
Right, seems like a pyright bug. |
This comment has been hidden.
This comment has been hidden.
1 similar comment
This comment has been hidden.
This comment has been hidden.
|
For now we can just rename one of the TypeVars though, right? |
|
It'd take me more time to rename the TypeVar than to tag @erictraut and have him make a pyright release :D |
|
I'm on vacation this week, so replies may be slower than normal. Pyright's current behavior is:
It sounds like you're suggesting that rule 3 is wrong? Is there a special-case exemption for wildcard imports from a stub file with regard to names that start with an underscore? If so, why? Is this special case documented somewhere? |
|
This is not specific to stubs. If there is no |
|
(And enjoy your vacation! This bug can wait; it's easy to work around anyway.) |
|
According to mypy_primer, this change has no effect on the checked open source code. |
| def merge(*iterables: Iterable[_T], key: Callable[[_T], Any] | None = ..., reverse: bool = ...) -> Iterable[_T]: ... | ||
| def nlargest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsRichComparison] | None = ...) -> list[_T]: ... | ||
| def nsmallest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsRichComparison] | None = ...) -> list[_T]: ... | ||
| __about__: str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? Usually __foo__ names are treated as public, not private like _foo names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is, or at least when I checked earlier it appears dunders are not imported using from x import * (also technically, in the impl it is defined, not exported)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lol, cpython developers have decided to copy/paste the same text into both modules
>>> from _heapq import __about__ as a
>>> from heapq import __about__ as b
>>> a == b
True
>>> a is b
False
|
Thanks for the clarification. Here's a bug report to track the issue in pyright: microsoft/pyright#3087. |
No description provided.