| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
This PR has a merge conflict. |
Sorry, something went wrong.
|
@JukkaL Seems some of my PRs are arguing over imports. Its been resolved |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes mypyc/mypyc#1243.
The runtime @deprecated decorator (PEP 702, from warnings or typing_extensions) stores the message in the __deprecated__ attribute of the function that it wraps. Compiled functions don't support setting attributes, so a module that uses the decorator on a function or a method fails at import:
With this PR mypyc no longer calls the decorator. The compiled function issues the warning itself when it's called. A method isn't a decorated method for mypyc any more, so it's still called natively, and these work as for any other method: property getters and setters, class and static methods, and overriding a native method (or being overridden by one). The implementation of an overloaded function works too. A generator or a coroutine warns when it's created, like with the runtime decorator.
Differences from interpreted Python:
where the runtime decorator happened to work. I did this to keep the behavior uniform, but I can leave
those on the runtime path if that's preferred. It would seem adding support for attributes on compiled methods like __deprecated__ might be a bigger change than even this large PR.