Skip to content

Conversation

@p-sawicki
Copy link
Collaborator

When generating callable classes for async functions, currently mypyc will generate a single CPyFunction wrapper for each callable class type. This results in incorrect behavior when the callable class is used as a wrapper because the @wraps(fn) decorator will set the __name__ attribute of the callable class to name of fn.

If the callable class is instantiated multiple times, the name of previous instances will be overridden because all instances share the same CPyFunction wrapper which contains the name attribute.

To fix this, the CPyFunction wrappers are generated for each instance of the callable class instead of for each type. The wrappers are stored as an attribute of the callable class and instantiated in the setup function.

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.

1 participant