cpython icon indicating copy to clipboard operation
cpython copied to clipboard

Make sure all deprecated items in importlib raise `DeprecationWarning`

Open brettcannon opened this issue 1 year ago • 6 comments

I will try this one at europython :)

rashansmith avatar Jul 13 '24 09:07 rashansmith

@rashansmith

To add deprecation warnings to module-level constants like DEBUG_BYTECODE_SUFFIXES I think you can use something like this: https://github.com/python/cpython/blob/4e36dd7d87eb0f1bd1ecd53e368c16a5f75967a0/Lib/calendar.py#L44-L54

tomasr8 avatar Jul 13 '24 09:07 tomasr8

@tomasr8 thanks, I've been looking at this exact file as a reference! Can you confirm which of the tasks are already done? For example in _abc.py, in the load_module() function I can already see a "# Warning implemented in _load_module_shim()." message.

rashansmith avatar Jul 13 '24 09:07 rashansmith

Hi @brettcannon, I'm sitting at Europython sprints and working with @rashansmith. If you know if any of these have already been done, please let us know. Going to check the history :D

willingc avatar Jul 13 '24 09:07 willingc

GH-121765 is a backport of this pull request to the 3.14 branch.

bedevere-app[bot] avatar Jul 14 '24 11:07 bedevere-app[bot]

@brettcannon @willingc @tomasr8 I've created a PR for this issue. Please let me know if it looks good or any issues I should resolve. It is based on validating which deprecationwarnings have already been implemented from the list, and therefore working on the remainders:

rashansmith avatar Jul 14 '24 11:07 rashansmith

@willingc @rashansmith I made the list from the docs based on a comment on another issue that made it sound like SourceFileLoader.load_module() wasn't raising an exception. I had not taken the time to verify anything. So thanks to @rashansmith for checking! I'll update the list based on what you found.

brettcannon avatar Jul 15 '24 18:07 brettcannon

Do we have it documented somewhere that importlib.abc.Loader is deprecated? The current importlib docs only say that importlib.abc.Loader.load_module is deprecated.

tungol avatar Dec 16 '24 02:12 tungol

I don't think it is. At least there are no deprecation warnings in the code, just for load_module.

tomasr8 avatar Dec 16 '24 10:12 tomasr8

That's what I thought, but I was thinking maybe I missed something given the warnings that the linked MR is adding. I'll bring the conversation over there.

tungol avatar Dec 16 '24 18:12 tungol

All of the items mentioned in the issue now raise warnings, I think we can close this issue?

tomasr8 avatar Feb 08 '25 14:02 tomasr8

@brettcannon Since you opened the original issue, do you want to close this as completed? Thanks!

willingc avatar Feb 10 '25 04:02 willingc

Thanks to everyone who worked on this (especially @tomasr8 for pushing it over the finish line)!

brettcannon avatar Feb 11 '25 19:02 brettcannon