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
test_peg_generator.test_c_parser emits DeprecationWarning due to distutils #87591
Comments
distutils was deprecated for removal in Python 3.10. It is used in test_peg_generator.test_c_parser which emits a deprecation warning. It also seems to be used in test_support for missing_compiler_executable that will emit a deprecation warning. ./python -Wall -m test test_peg_generator test_c_parser Other places on grep : rg 'from distutils' | rg -v 'Lib/distutils|rst' |
We just need to suppress the warning unless I am missing somey. Distutils will still be used internally by CPython. |
Thanks for the clarification. As per bpo-41282 I thought disutils will be removed. The accepted PEP-632 states this scenario so I guess silencing the warning is good enough.
|
Steve, PEP-632 lacks a reference to the SC acceptance thereof. Could you add one? The warning is correct as to removal. PEP-632 says, perhaps a bit tersely, that when the 3.11 branch is established for 3.11.0b1 and master/main becomes the 3.12.0a development branch, disutils/* be no longer be installed as part of the stdlib (ie, in /Lib). At that point, 'import disutils' will cease working in installed CPython, outside of a cpython repository. Although this could be worked around by catching the import error and skipping disutils-dependent tests, the dependency should better be removed, if possible, before 3.12.0a. The PEP gives no timetable for doing so, and anticipates separate PRs like this. It further says that when "the CPython build process no longer depends on distutils being in the standard library, the entire Lib/distutils directory and Lib/test/test_distutils.py file will be removed from the repository." Leaving it deprecated but present was rejected. Part of the extensive discussion at https://discuss.python.org/t/pep-632-deprecate-distutils-module/5134/128 was about possibly putting parts of disutiles under /Tools and replacing 'import disutils' with a reference to <python dir>/Tools/distutiles/whatever. If this is done for tests, the access and use has to be conditional. Our Windows installer only installs 4 or 21 Tools subdirectories thought appropriate for uses and others may include less, and maybe omit Tools altogether. Karthikeyan posted the opening of this and another issue 5 days ago on bpo-41281, with no comment so far. |
The link appears to be in the Resolution header of PEP-632? But yes, your analysis is correct. If/when we move distutils elsewhere, we'll probably have to update all of these sections. Ideally we'd have a helper function to do the initial "import distutils", handle failure (because it's not in Tools), and suppress the warning. But I don't know that there's anywhere we could put it reliably anyway, so probably just need to suppress the warnings directly and we'll handle failures if/when we move it into Tools. |
test_peg_generator still emits DeprecationWarning warnings. Example: vstinner@apu$ ./python -m test test_peg_generator -v /home/vstinner/python/main/Lib/test/support/init.py:1713: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP-632 for potential alternatives /home/vstinner/python/main/Lib/test/support/init.py:1713: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead |
Not anymore - it's skipped since 0faa0ba. |
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: