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
[Python 3.10] Remove APIs deprecated long enough #85337
Comments
I don't think we need to remove them all at onece. But we can remove some of them for code health. c-api/module.rst .. c:function:: const char* PyModule_GetFilename(PyObject *module) c-api/init.rst .. c:function:: void PyEval_AcquireLock() .. c:function:: void PyEval_ReleaseLock() unittest: .. deprecated:: 3.1 urllib.request: .. class:: URLopener(proxies=None, **x509) turtle: imp: configparser: email.errors:
pkgutil: zipfile: Alias of :exc:`BadZipFile`, for compatibility with older Python versions. .. deprecated:: 3.2 inspect: asyncore: importlib:
|
PyModule_GetFilename, PyEval_AcquireLock, PyEval_ReleaseLock. |
Unittest aliases are deprecated in bpo-9424. |
I'm all in favor to remove deprecated things, but please set a tangible deadline first. A lot of these functions have been deprecated for like a decade. Users tend to forget about deprecations or assume that removal was never going to happen. For example the removal of xml.etree.cElementTree broke a bunch of stuff although it had been deprecated since 3.0. At a bare minimum you should list removed features in the 3.9 changelog and porting guide as "will be removed in 3.10". I would even argue to add deprecation warnings to the code in 3.9 (with permission from the RM). If the RM is against deprecation warnings, then it might be good idea to postpone removal to 3.11. |
I don't propose adding DeprecationWarning in 3.9 in this issue. My first message is just a starting point. I don't propose to remove them all. |
For the record, I noticed DeprecationWarning is not shown by unittest.runner by default. For example, https://travis-ci.org/github/necaris/python3-openid/jobs/703119609 So deprecated aliases should be not removed in 3.10. |
I found most of deprecated items in my first comment are aliving by difficult reasons. I grepped top 4000 packages and found some candidates to deprecate. ## turtle
TODO(easy): Update the document and emit DeprecationWarning ## email.errors MalformedHeaderDefect is not used anywhere in top4000 packages. But it is simple alias, and DeprecationWarning is not emit. TODO(easy): Emit DeprecationWarning using module __getattr__. ## importlib abc.SourceLoader.path_mtime is not used anywhere. TODO: Remove path_mtime from the ABC and raise DeprecationWarning if path_mtime is defined in subclass in path_stats. --- importlib should be checked by experts. I keep TODO(easy) for new contributors. |
There is an open issue for this but I think it's enabled by default https://bugs.python.org/issue39892 $ cat /tmp/test_bar.py
import unittest
import warnings class TestFoo(unittest.TestCase):
def test_foo(self):
self.assertEquals(1, 1)
if __name__ == "__main__":
unittest.main() $ python3.8 -m unittest test_bar
/private/tmp/test_bar.py:8: DeprecationWarning: Please use assertEqual instead.
self.assertEquals(1, 1)
. Ran 1 test in 0.000s OK |
Hmm. You are right. The warnings are shown by default. On the other hand, some project uses custom https://github.com/warner/python-ed25519/blob/master/setup.py How about emitting FutureWarning instead of DeprecationWarning? DeprecationWarning is hidden to avoid end users see noisy warnings. |
As we discussed in ML, PyEval_ReleaseLock is still used and removing may be not simple. Keep it as-is until Python 4.0. |
Adding Miro since Fedora will be testing Python 3.10 and deprecated API removals here might potentially affect libraries like Python 3.9 testing. |
## unittest What's needed to move forward with removing the deprecated aliases? A deprecation warning is shown for No deprecation warning is shown for pypa/setuptools#1878 Docs already mention they are deprecated: https://docs.python.org/3/library/unittest.html#deprecated-aliases
So at this stage (3.10 in RC), do we need to list them in the 3.11 changelog and porting guide as "will be removed in 3.12"? |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: