]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] GH-92897: schedule the check_home deprecation to 3.15 (GH-129102) (#130583)
authorHugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Thu, 27 Feb 2025 18:16:33 +0000 (20:16 +0200)
committerGitHub <noreply@github.com>
Thu, 27 Feb 2025 18:16:33 +0000 (18:16 +0000)
Co-authored-by: Filipe Laíns 🇵🇸 <lains@riseup.net>
Doc/deprecations/pending-removal-in-3.15.rst
Doc/deprecations/pending-removal-in-future.rst
Lib/sysconfig/__init__.py
Lib/test/test_sysconfig.py
Misc/NEWS.d/next/Library/2025-01-20-20-59-26.gh-issue-92897.G0xH8o.rst [new file with mode: 0644]

index 7e63567ce2ec0fd914f6ccb7a84b7220fff92ba8..b607703b30bfff158b01c7f5d9711f507b3609d9 100644 (file)
@@ -55,6 +55,11 @@ Pending Removal in Python 3.15
     This function is only useful for Jython support, has a confusing API,
     and is largely untested.
 
+* :mod:`sysconfig`:
+
+  * The *check_home* argument of :func:`sysconfig.is_python_build` has been
+    deprecated since Python 3.12.
+
 * :mod:`threading`:
 
   * :func:`~threading.RLock` will take no arguments in Python 3.15.
index fdca65c341209dd2b9925af5c66e5aa130531a18..e3922d24fc6dd774c392f5fc99f86c0346c8e823 100644 (file)
@@ -105,9 +105,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`.
index 7bcb737ff2cca34e96c02ce68ee7025d201358c9..510c7b9568a808e5737053dc5d80e5d25b18a7ff 100644 (file)
@@ -220,8 +220,15 @@ if "_PYTHON_PROJECT_BASE" in os.environ:
 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
index bf534130212482b058f7f05c18fe2c26346714fa..aca02c06bc043878f6bb73e6a6acc58f0735a22f 100644 (file)
@@ -689,5 +689,26 @@ class MakefileTests(unittest.TestCase):
         })
 
 
+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 (file)
index 0000000..632ca03
--- /dev/null
@@ -0,0 +1,2 @@
+Scheduled the deprecation of the ``check_home`` argument of
+:func:`sysconfig.is_python_build` to Python 3.15.