Skip to content
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

[mypyc] Improve support for compiling singledispatch (#10795) #83

Merged
merged 1 commit into from
Jul 13, 2021

Conversation

sthagen
Copy link
Owner

@sthagen sthagen commented Jul 13, 2021

This makes several improvements to the support for compiling singledispatch that was introduced in python#10753 by:

  • Making sure registered implementations defined later in a file take precedence when multiple overlap
  • Using non-native calls to registered implementations to allow for adding other decorators to registered functions (099b047)
  • Creating a separate function that dispatches to the correct implementation instead of adding code to dispatch to one of the registered implementations directly into the main singledispatch function, allowing the main singledispatch function to be a generator (59555e4)
  • Avoiding a compilation error when trying to dispatch on an ABC (2d40421)

Have you read the Contributing Guidelines?

(Once you have, delete this section. If you leave it in, your PR may be closed without action.)

Description

(Explain how this PR changes mypy.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

This makes several improvements to the support for compiling singledispatch that was introduced in #10753 by:

* Making sure registered implementations defined later in a file take precedence when multiple overlap
 * Using non-native calls to registered implementations to allow for adding other decorators to registered functions (099b047)
 * Creating a separate function that dispatches to the correct implementation instead of adding code to dispatch to one of the registered implementations directly into the main singledispatch function, allowing the main singledispatch function to be a generator (59555e4)
 * Avoiding a compilation error when trying to dispatch on an ABC (2d40421)
@sthagen sthagen merged commit 82a8bb2 into sthagen:master Jul 13, 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.

2 participants