Skip to content

Commit 4100fb0

Browse files
hugovkFFY00
andauthored
[3.13] GH-92897: schedule the check_home deprecation to 3.15 (GH-129102) (#130583)
Co-authored-by: Filipe Laíns 🇵🇸 <[email protected]>
1 parent 676ceca commit 4100fb0

File tree

5 files changed

+37
-5
lines changed

5 files changed

+37
-5
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ Pending Removal in Python 3.15
5555
This function is only useful for Jython support, has a confusing API,
5656
and is largely untested.
5757

58+
* :mod:`sysconfig`:
59+
60+
* The *check_home* argument of :func:`sysconfig.is_python_build` has been
61+
deprecated since Python 3.12.
62+
5863
* :mod:`threading`:
5964

6065
* :func:`~threading.RLock` will take no arguments in Python 3.15.

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@ although there is currently no date scheduled for their removal.
105105
* ``ssl.TLSVersion.TLSv1``
106106
* ``ssl.TLSVersion.TLSv1_1``
107107

108-
* :func:`sysconfig.is_python_build` *check_home* parameter is deprecated and
109-
ignored.
110-
111108
* :mod:`threading` methods:
112109

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

Lib/sysconfig/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,15 @@ def _safe_realpath(path):
220220
def is_python_build(check_home=None):
221221
if check_home is not None:
222222
import warnings
223-
warnings.warn("check_home argument is deprecated and ignored.",
224-
DeprecationWarning, stacklevel=2)
223+
warnings.warn(
224+
(
225+
'The check_home argument of sysconfig.is_python_build is '
226+
'deprecated and its value is ignored. '
227+
'It will be removed in Python 3.15.'
228+
),
229+
DeprecationWarning,
230+
stacklevel=2,
231+
)
225232
for fn in ("Setup", "Setup.local"):
226233
if os.path.isfile(os.path.join(_PROJECT_BASE, "Modules", fn)):
227234
return True

Lib/test/test_sysconfig.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,5 +689,26 @@ def test_parse_makefile(self):
689689
})
690690

691691

692+
class DeprecationTests(unittest.TestCase):
693+
def deprecated(self, removal_version, deprecation_msg=None, error=Exception, error_msg=None):
694+
if sys.version_info >= removal_version:
695+
return self.assertRaises(error, msg=error_msg)
696+
else:
697+
return self.assertWarns(DeprecationWarning, msg=deprecation_msg)
698+
699+
def test_is_python_build_check_home(self):
700+
with self.deprecated(
701+
removal_version=(3, 15),
702+
deprecation_msg=(
703+
'The check_home argument of sysconfig.is_python_build is '
704+
'deprecated and its value is ignored. '
705+
'It will be removed in Python 3.15.'
706+
),
707+
error=TypeError,
708+
error_msg="is_python_build() takes 0 positional arguments but 1 were given",
709+
):
710+
sysconfig.is_python_build('foo')
711+
712+
692713
if __name__ == "__main__":
693714
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)