Skip to content

[urllib] Add deprecated functions #14457

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

Closed

Conversation

donBarbos
Copy link
Contributor

I think if they haven't been removed then they are still being used

@donBarbos donBarbos changed the title [urllib] Add deprecated function [urllib] Add deprecated functions Jul 26, 2025

This comment has been minimized.

@brianschubert
Copy link
Member

I think these are maybe better left out. From looking at the history, these are all undocumented functions that weren't meant to be exposed in Python 3:

@donBarbos
Copy link
Contributor Author

I think these are maybe better left out. From looking at the history, these are all undocumented functions that weren't meant to be exposed in Python 3:

In my view, these functions are still usable, as I don’t see any clear reason they wouldn’t be compatible with Python 3.x. Additionally, typeshed appears to be more of a reflection of the actual source code than a definitive source of documentation.

Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@brianschubert
Copy link
Member

brianschubert commented Jul 26, 2025

As I understand it, these days typeshed's policy is that its generally open to adding undocumented and/or private symbols if they are requested or known to be useful, but generally doesn't try to add all such symbols just because they're present at runtime. Adding undocumented symbols can lead to IDEs suggesting them in autocomplete suggestions and generally can mislead users of type checkers and other tools into thinking that these symbols are/were part of the public API.

Do you happen to know if these functions are actually being used out in the wild? I tried doing a quick search of open source code for them, but I'm only seeing cases them being defined in vendored copies of urllib.

If these do get added to the stubs, I might suggest removing the @deprecated decorator. @deprecated suggests a change in level of support, but these functions were never documented / supported in Python 3. Python 3.8 is just when they started also raising a warning at runtime.

@JelleZijlstra
Copy link
Member

If these do get added to the stubs, I might suggest removing the @deprecated decorator. @deprecated suggests a change in level of support, but these functions were never documented / supported in Python 3. Python 3.8 is just when they started also raising a warning at runtime.

I don't agree with this: they raise DeprecationWarning at runtime, so adding @deprecated seems reasonable to me. They've just been deprecated for a long time.

@donBarbos
Copy link
Contributor Author

donBarbos commented Jul 26, 2025

I understand your point of view. However, I’m approaching this from the perspective that someone might still be using these functions. So I suggest we wait for the maintainer’s decision.

@JelleZijlstra
Copy link
Member

I'm a maintainer and I agree that we should only add these if someone comes to us and tells us they're actually using these functions.

@AlexWaygood
Copy link
Member

I am also a maintainer and I agree with Jelle. The reason stubtest has never complained about these being missing from the stub is that they've been deliberately omitted from __all__ at runtime. I'm happy to add them if somebody actually has a use for them, but let's not just add them for completeness's sake :-)

@donBarbos
Copy link
Contributor Author

I'm a maintainer and I agree that we should only add these if someone comes to us and tells us they're actually using these functions.

I didn't notice your message when I wrote and sent mine

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.

4 participants