Skip to content

GH-92897: schedule the check_home deprecation to 3.15 #129102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -51,6 +51,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.
Comment on lines +56 to +57
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also remove the old deprecation from "Pending removal in future versions":

* :func:`sysconfig.is_python_build` *check_home* parameter is deprecated and
ignored.

I'll open a new PR to remove it from main, and include it in the backports of this PR.


* :mod:`threading`:

* :func:`~threading.RLock` will take no arguments in Python 3.15.
Expand Down
11 changes: 9 additions & 2 deletions Lib/sysconfig/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,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
20 changes: 17 additions & 3 deletions Lib/test/test_sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,9 +712,9 @@ def test_parse_makefile(self):


class DeprecationTests(unittest.TestCase):
def deprecated(self, removal_version, deprecation_msg=None, attribute_msg=None):
def deprecated(self, removal_version, deprecation_msg=None, error=Exception, error_msg=None):
if sys.version_info >= removal_version:
return self.assertRaises(AttributeError, msg=attribute_msg)
return self.assertRaises(error, msg=error_msg)
else:
return self.assertWarns(DeprecationWarning, msg=deprecation_msg)

Expand All @@ -725,10 +725,24 @@ def test_expand_makefile_vars(self):
'sysconfig.expand_makefile_vars is deprecated and will be removed in '
'Python 3.16. Use sysconfig.get_paths(vars=...) instead.',
),
attribute_msg="module 'sysconfig' has no attribute 'expand_makefile_vars'",
error=AttributeError,
error_msg="module 'sysconfig' has no attribute 'expand_makefile_vars'",
):
sysconfig.expand_makefile_vars('', {})

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