Skip to content

Commit 19dfe00

Browse files
FFY00hugovk
authored andcommitted
[3.12] pythonGH-92897: schedule the check_home deprecation to 3.15 (pythonGH-129102)
(cherry picked from commit e52ab56) Co-authored-by: Filipe Laíns 🇵🇸 <[email protected]>
1 parent 6a268a0 commit 19dfe00

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

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

Lines changed: 5 additions & 0 deletions
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,

Lib/sysconfig.py

Lines changed: 9 additions & 2 deletions
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

Lines changed: 21 additions & 0 deletions
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()
Lines changed: 2 additions & 0 deletions
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)