Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Doc/deprecations/pending-removal-in-3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 0 additions & 3 deletions Doc/deprecations/pending-removal-in-future.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
11 changes: 9 additions & 2 deletions Lib/sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions Lib/test/test_sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Scheduled the deprecation of the ``check_home`` argument of
:func:`sysconfig.is_python_build` to Python 3.15.
Loading