https://github.com/python/cpython/commit/a55a9cd6c2273c5eb6d346d4c281ab0aa72f7221 commit: a55a9cd6c2273c5eb6d346d4c281ab0aa72f7221 branch: 3.12 author: Hugo van Kemenade <1324225+hug...@users.noreply.github.com> committer: FFY00 <filipe.la...@gmail.com> date: 2025-02-27T18:17:08Z summary:
[3.12] GH-92897: schedule the check_home deprecation to 3.15 (GH-129102) (#130585) Co-authored-by: Filipe Laíns 🇵🇸 <la...@riseup.net> files: A Misc/NEWS.d/next/Library/2025-01-20-20-59-26.gh-issue-92897.G0xH8o.rst M Doc/deprecations/pending-removal-in-3.15.rst M Doc/deprecations/pending-removal-in-future.rst M Lib/sysconfig.py M Lib/test/test_sysconfig.py diff --git a/Doc/deprecations/pending-removal-in-3.15.rst b/Doc/deprecations/pending-removal-in-3.15.rst index 4a3014108c4175..ec2ef655241d82 100644 --- a/Doc/deprecations/pending-removal-in-3.15.rst +++ b/Doc/deprecations/pending-removal-in-3.15.rst @@ -28,6 +28,11 @@ Pending Removal in Python 3.15 and was only useful for Jython support. (Contributed by Nikita Sobolev in :gh:`116349`.) +* :mod:`sysconfig`: + + * The *check_home* argument of :func:`sysconfig.is_python_build` has been + deprecated since Python 3.12. + * :mod:`threading`: Passing any arguments to :func:`threading.RLock` is now deprecated. C version allows any numbers of args and kwargs, diff --git a/Doc/deprecations/pending-removal-in-future.rst b/Doc/deprecations/pending-removal-in-future.rst index e1311482312cd8..826dcadf20c5ec 100644 --- a/Doc/deprecations/pending-removal-in-future.rst +++ b/Doc/deprecations/pending-removal-in-future.rst @@ -102,9 +102,6 @@ although there is currently no date scheduled for their removal. * ``ssl.TLSVersion.TLSv1`` * ``ssl.TLSVersion.TLSv1_1`` -* :func:`sysconfig.is_python_build` *check_home* parameter is deprecated and - ignored. - * :mod:`threading` methods: * :meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition.notify_all`. diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py index 7dd63b935543d6..acc8d4d1826b8a 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -222,8 +222,15 @@ def _safe_realpath(path): def is_python_build(check_home=None): if check_home is not None: import warnings - warnings.warn("check_home argument is deprecated and ignored.", - DeprecationWarning, stacklevel=2) + warnings.warn( + ( + 'The check_home argument of sysconfig.is_python_build is ' + 'deprecated and its value is ignored. ' + 'It will be removed in Python 3.15.' + ), + DeprecationWarning, + stacklevel=2, + ) for fn in ("Setup", "Setup.local"): if os.path.isfile(os.path.join(_PROJECT_BASE, "Modules", fn)): return True diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index 3468d0ce022ae0..67647e1b787ce7 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -616,5 +616,26 @@ def test_parse_makefile(self): }) +class DeprecationTests(unittest.TestCase): + def deprecated(self, removal_version, deprecation_msg=None, error=Exception, error_msg=None): + if sys.version_info >= removal_version: + return self.assertRaises(error, msg=error_msg) + else: + return self.assertWarns(DeprecationWarning, msg=deprecation_msg) + + def test_is_python_build_check_home(self): + with self.deprecated( + removal_version=(3, 15), + deprecation_msg=( + 'The check_home argument of sysconfig.is_python_build is ' + 'deprecated and its value is ignored. ' + 'It will be removed in Python 3.15.' + ), + error=TypeError, + error_msg="is_python_build() takes 0 positional arguments but 1 were given", + ): + sysconfig.is_python_build('foo') + + if __name__ == "__main__": unittest.main() diff --git a/Misc/NEWS.d/next/Library/2025-01-20-20-59-26.gh-issue-92897.G0xH8o.rst b/Misc/NEWS.d/next/Library/2025-01-20-20-59-26.gh-issue-92897.G0xH8o.rst new file mode 100644 index 00000000000000..632ca03bbf8dd2 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-01-20-20-59-26.gh-issue-92897.G0xH8o.rst @@ -0,0 +1,2 @@ +Scheduled the deprecation of the ``check_home`` argument of +:func:`sysconfig.is_python_build` to Python 3.15. _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com