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

gh-97850: remove find_loader and get_loader from pkgutil #119656

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

picnixz
Copy link
Contributor

@picnixz picnixz commented May 28, 2024

@picnixz picnixz changed the title Remove find_loader and get_loader from pkgutil gh-#97850: remove find_loader and get_loader from pkgutil May 28, 2024
@picnixz picnixz changed the title gh-#97850: remove find_loader and get_loader from pkgutil gh-97850: remove find_loader and get_loader from pkgutil May 28, 2024
@picnixz picnixz changed the title gh-97850: remove find_loader and get_loader from pkgutil [3.14] gh-97850: remove find_loader and get_loader from pkgutil May 28, 2024
@picnixz
Copy link
Contributor Author

picnixz commented May 28, 2024

Quick question but how do you manage the whatsnews sections when a feature is being removed? I cannot really change it to :func:`!pkgutil.find_loader` since these are available in previous versions.

@picnixz picnixz changed the title [3.14] gh-97850: remove find_loader and get_loader from pkgutil gh-97850: remove find_loader and get_loader from pkgutil May 28, 2024
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Please, update

:func:`pkgutil.find_loader`
:func:`pkgutil.get_loader`

to be

:func:`!pkgutil.find_loader`
:func:`!pkgutil.get_loader`

Since all python versions have their own versions of 3.13.rst / 3.12.rst / etc.

@bedevere-app
Copy link

bedevere-app bot commented May 29, 2024

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@picnixz
Copy link
Contributor Author

picnixz commented May 29, 2024

Yes, that's what I was actually asking. Should I just suppress every possible links in the others 3.x.rst files even though they exist? (if so, I can do it but I wanted to be sure that all references should be suppressed even for old versions for which the reference would exist).

@sobolevn
Copy link
Member

Again, older versions won't be affected, because they live in their own branches. And we won't backport this change.

@picnixz
Copy link
Contributor Author

picnixz commented May 29, 2024

Oh yes, it was dumb of me. I incorrectly assumed that the 3.12 page was for the corresponding branch (seems I'm still not entirely awake). Anyway, I have made the requested changes; please review again.

@bedevere-app
Copy link

bedevere-app bot commented May 29, 2024

Thanks for making the requested changes!

@sobolevn: please review the changes made to this pull request.

@bedevere-app bedevere-app bot requested a review from sobolevn May 29, 2024 08:17
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Sorry, I somehow did not send this comment.

Lib/test/test_doctest/test_doctest.py Outdated Show resolved Hide resolved
@sobolevn sobolevn requested a review from brettcannon May 29, 2024 14:27
@sobolevn sobolevn requested a review from warsaw May 29, 2024 14:27
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

I am also not sure that we still need this part:

cpython/Lib/pkgutil.py

Lines 383 to 385 in 78d697b

# Is this finder PEP 420 compliant?
elif hasattr(finder, 'find_loader'):
_, portions = finder.find_loader(final_name)

Domain experts need to verify that.

@warsaw
Copy link
Member

warsaw commented May 29, 2024

Domain experts need to verify that.

I think we don't but I haven't tested or investigated deeply.

@picnixz
Copy link
Contributor Author

picnixz commented May 30, 2024

I'm not an expert in this since this predates the time when I started coding in Python (technically speaking, I've coded in 2.7 but never in 3.0 -- 3.5).

AFAIK, the pkgutil.extend_path function is not marked as deprecated even though namespace packages should not be declared through it anymore. However, if needs arise, I'd recommend removing extend_path in one go rather than removing a single portion of the code.

The main reason is: extend_path should not really be used since it's for declaring legacy namespace packages; but if someone really wants to use it, then it should do whatever it was meant to do.

In particular, having removed find_loader from pkgutil does not mean that a custom Finder object should not be used for extend_path.

Doc/whatsnew/3.13.rst Outdated Show resolved Hide resolved
Co-authored-by: Hugo van Kemenade <[email protected]>
@hugovk
Copy link
Member

hugovk commented Aug 2, 2024

This has a conflict after the #122085 re-org.

@picnixz
Copy link
Contributor Author

picnixz commented Aug 2, 2024

Oh, I forgot about this one :') I'll fix the conflicts err... I don't know when (I'm a bit busy writing something currently and don't know if I'll have tomorrow)

@hugovk
Copy link
Member

hugovk commented Aug 2, 2024

Thanks, absolutely no rush with this :)

@Wulian233
Copy link
Contributor

#123036
Need change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants