Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-129027: Raise DeprecationWarning for sys._clear_type_cache#129043

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
hugovk merged 13 commits intopython:mainfromsrinivasreddy:gh-129027
Apr 25, 2025

Conversation

srinivasreddy
Copy link
Contributor

@srinivasreddysrinivasreddy commentedJan 20, 2025
edited by bedevere-appbot
Loading

Copy link
Member

@tomasr8tomasr8 left a comment

Choose a reason for hiding this comment

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

sys._clear_type_cache is used in other tests as well which will now raise aDeprecationWarning. I think we should suppress the warnings in the relevant tests (or maybe switch tosys._clear_internal_caches()? though that might make backporting tests to 3.12 more difficult since the function was added in 3.13)

@tomasr8
Copy link
Member

This will also require a news entry :)

@srinivasreddy
Copy link
ContributorAuthor

srinivasreddy commentedJan 21, 2025
edited
Loading

@tomasr8 Addressed inc532328

Copy link
Member

@tomasr8tomasr8 left a comment

Choose a reason for hiding this comment

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

Would you also like to add a What's New entry as@picnixz suggested?

@srinivasreddy
Copy link
ContributorAuthor

srinivasreddy commentedJan 30, 2025
edited
Loading

@tomasr8 Thanks 👍🏾 . Please review again?

@picnixz
Copy link
Member

The What's New is still missing (it's something that you need to add in Doc/whatsnew/3.14.rst I think). The NEWS (blurb) entry is only for the full changelog, but deprecation notices are also communicated there so that they have better visibility. You can put this change in the Pending Removal section (as we are now emitting a warning)

@picnixz
Copy link
Member

I'll review it in a few minutes, but I have some comments on some wording. And I think we already mentioned to avoid force pushing, so please do so in the future. Avoid rebasing to merge upstream and prefer using the update button instead. Or if it becomes too messy, just create a new branch to be sure you don't trigger unnecessary review requests

Copy link
Member

@picnixzpicnixz left a comment

Choose a reason for hiding this comment

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

After commenting the files, I think you can create a wrapper around_clear_type_cache that suppresses its deprecation warning use instead of suppressing the warning around the entire test. If other deprecation warnings appear we want them to be printed.

@@ -15,11 +18,13 @@
type_assign_specific_version_unsafe = _testinternalcapi.type_assign_specific_version_unsafe
type_assign_version = _testcapi.type_assign_version
type_modified = _testcapi.type_modified
ignore_deprecation = warnings_helper.ignore_warnings(category=DeprecationWarning)
Copy link
Member

Choose a reason for hiding this comment

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

This should be a dummy decorator if_clear_type_cache is None.

def test_python_dump_refs(self):
code = 'import sys; sys._clear_type_cache()'
rc, out, err = assert_python_ok('-c', code, PYTHONDUMPREFS='1')
self.assertEqual(rc, 0)

@unittest.skipUnless(sysconfig.get_config_var('Py_TRACE_REFS'), "Requires --with-trace-refs build option")
@warnings_helper.ignore_warnings(category=DeprecationWarning)
Copy link
Member

Choose a reason for hiding this comment

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

Can we use this one only when doingassert_python_ok?

@@ -932,12 +932,14 @@ def test_python_asyncio_debug(self):
self.assertIn(b'True', out)

@unittest.skipUnless(sysconfig.get_config_var('Py_TRACE_REFS'), "Requires --with-trace-refs build option")
@warnings_helper.ignore_warnings(category=DeprecationWarning)
Copy link
Member

Choose a reason for hiding this comment

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

Ditto

@@ -61,6 +66,7 @@ class C:
self.assertNotEqual(type_get_version(C), 0)
self.assertNotEqual(type_get_version(C), c_ver)

@ignore_deprecation
Copy link
Member

Choose a reason for hiding this comment

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

Can we only protect the_clear_type_cache call instead of the entire test?

srinivasreddyand others added8 commitsFebruary 7, 2025 16:40
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…0vxzZ.rstCo-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@srinivasreddy
Copy link
ContributorAuthor

@picnixz Please review again.

Comment on lines 42 to 43
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe you can wrapclear_type_cache with a waraning filter:

defclear_type_cache():withwarnings.catch_warnings():       ..._clear_type_cache()

@srinivasreddy
Copy link
ContributorAuthor

@picnixz Done.

@tomasr8
Copy link
Member

@srinivasreddy There are some conflicts with main now, could you fix them please?

@srinivasreddy
Copy link
ContributorAuthor

@tomasr8 Done.

tomasr8 reacted with thumbs up emoji

@hugovkhugovk merged commit8783cec intopython:mainApr 25, 2025
42 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tomasr8tomasr8tomasr8 approved these changes

@picnixzpicnixzpicnixz approved these changes

@sobolevnsobolevnAwaiting requested review from sobolevn

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@srinivasreddy@tomasr8@picnixz@terryjreedy@sobolevn@hugovk

[8]ページ先頭

©2009-2025 Movatter.jp