Skip to content

Conversation

@hauntsaninja
Copy link
Collaborator

No description provided.

@github-actions

This comment has been minimized.

@hauntsaninja
Copy link
Collaborator Author

Not sure what pyright wants here, bug?

@AlexWaygood
Copy link
Member

AlexWaygood commented May 25, 2023

Not sure what pyright wants here, bug?

Oh, no idea what's going on there. We're a few pyright releases behind in CI; we could try updating to the latest and see if it still reproduces?

Copy link
Member

@JelleZijlstra JelleZijlstra 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, the enum issue is mysterious to me too.

I would suggest it's an import cycle issue, but nothing in the stdlib relies on calendar.

@AlexWaygood
Copy link
Member

Yeah, seems like the failures persist with the latest pyright

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@hauntsaninja
Copy link
Collaborator Author

cc @erictraut any idea what's going wrong here?

@erictraut
Copy link
Contributor

This is caused by a circular dependency involving the EnumMeta class.

The ReprEnum class derives from Enum which uses the metaclass EnumMeta. The EnumMeta has a __new__ method that describes a keyword parameter boundary of type FlagBoundary. This type derives from StrEnum which derives from ReprEnum, and we're back to the start.

This circularity can be resolved if analysis is done in precisely the right order. Since pyright is a lazy (just-in-time) type analyzer, the standard ordering can easily change. I suspect that the change in this PR perturbed things just enough to change the evaluation ordering. I have logic in place that's designed to detect circularities like this and force them to resolve in a satisfactory order, but the logic is complex, and it appears that it's not handling this case. I'll investigate it further.

I've filed this bug in the pyright issue tracker.

@erictraut
Copy link
Contributor

This will be fixed in the next pyright release (1.1.312).

AlexWaygood added a commit that referenced this pull request Jun 7, 2023
AlexWaygood added a commit that referenced this pull request Jun 7, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 7, 2023

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@hauntsaninja hauntsaninja merged commit e1ab1ad into python:main Jun 7, 2023
@hauntsaninja hauntsaninja deleted the cal branch June 7, 2023 07:52
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.

4 participants