Skip to content

Commit a55a9cd

Browse files
hugovkFFY00
andauthored
[3.12] GH-92897: schedule the check_home deprecation to 3.15 (GH-129102) (#130585)
Co-authored-by: Filipe Laíns 🇵🇸 <[email protected]>
1 parent a678d8e commit a55a9cd

File tree

5 files changed

+37
-5
lines changed

5 files changed

+37
-5
lines changed

Doc/deprecations/pending-removal-in-3.15.rst

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ Pending Removal in Python 3.15
2828
and was only useful for Jython support.
2929
(Contributed by Nikita Sobolev in :gh:`116349`.)
3030

31+
* :mod:`sysconfig`:
32+
33+
* The *check_home* argument of :func:`sysconfig.is_python_build` has been
34+
deprecated since Python 3.12.
35+
3136
* :mod:`threading`:
3237
Passing any arguments to :func:`threading.RLock` is now deprecated.
3338
C version allows any numbers of args and kwargs,

Doc/deprecations/pending-removal-in-future.rst

-3
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ although there is currently no date scheduled for their removal.
102102
* ``ssl.TLSVersion.TLSv1``
103103
* ``ssl.TLSVersion.TLSv1_1``
104104

105-
* :func:`sysconfig.is_python_build` *check_home* parameter is deprecated and
106-
ignored.
107-
108105
* :mod:`threading` methods:
109106

110107
* :meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition.notify_all`.

Lib/sysconfig.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,15 @@ def _safe_realpath(path):
222222
def is_python_build(check_home=None):
223223
if check_home is not None:
224224
import warnings
225-
warnings.warn("check_home argument is deprecated and ignored.",
226-
DeprecationWarning, stacklevel=2)
225+
warnings.warn(
226+
(
227+
'The check_home argument of sysconfig.is_python_build is '
228+
'deprecated and its value is ignored. '
229+
'It will be removed in Python 3.15.'
230+
),
231+
DeprecationWarning,
232+
stacklevel=2,
233+
)
227234
for fn in ("Setup", "Setup.local"):
228235
if os.path.isfile(os.path.join(_PROJECT_BASE, "Modules", fn)):
229236
return True

Lib/test/test_sysconfig.py

+21
Original file line numberDiff line numberDiff line change
@@ -616,5 +616,26 @@ def test_parse_makefile(self):
616616
})
617617

618618

619+
class DeprecationTests(unittest.TestCase):
620+
def deprecated(self, removal_version, deprecation_msg=None, error=Exception, error_msg=None):
621+
if sys.version_info >= removal_version:
622+
return self.assertRaises(error, msg=error_msg)
623+
else:
624+
return self.assertWarns(DeprecationWarning, msg=deprecation_msg)
625+
626+
def test_is_python_build_check_home(self):
627+
with self.deprecated(
628+
removal_version=(3, 15),
629+
deprecation_msg=(
630+
'The check_home argument of sysconfig.is_python_build is '
631+
'deprecated and its value is ignored. '
632+
'It will be removed in Python 3.15.'
633+
),
634+
error=TypeError,
635+
error_msg="is_python_build() takes 0 positional arguments but 1 were given",
636+
):
637+
sysconfig.is_python_build('foo')
638+
639+
619640
if __name__ == "__main__":
620641
unittest.main()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Scheduled the deprecation of the ``check_home`` argument of
2+
:func:`sysconfig.is_python_build` to Python 3.15.

0 commit comments

Comments
 (0)