Skip to content

Conversation

@pranavrajpal
Copy link
Contributor

This PR:

  • moves mypyc's special support for singledispatch functions into a new file so that it's all in one place instead of being spread out between function.py and prepare.py
  • adds documentation of how the support for singledispatch in mypyc works to the module docstring of that file
  • removes the now unused get_registry_identifier function

Test Plan

This is a refactoring PR, so I think making sure the current tests pass should be enough.

Move all of the singledispatch-related functions in
mypyc/irbuild/function.py into a separate file just for
singledispatch-related functionality.

This also adds documentation about how mypyc's support for
singledispatch works.
Move the code for the pass that looks for singledispatch functions and
corresponding register calls into singledispatch.py.

This also adds some documentation about why we need a separate pass for
looking for singledispatch functions instead of just adding this
searching to one of the already existing passes.

This also fixes some circular imports caused by moving functions into
singledispatch.py.
Fix a flake8 "line too long" error
Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is a good idea. Left one comment about avoiding an import cycle, otherwise looks good.

Move the definition of RegisterImplInfo and SingledispatchInfo into
util.py so that we can use those types in builder.py without builder.py
having to import singledispatch.py (which would bring function.py,
builder.py, and singledispatch.py into the same import cycle).
@pranavrajpal pranavrajpal requested a review from JukkaL May 20, 2022 17:09
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