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-134179: use sys._clear_internal_caches isntead of deprecated sys._clear_type_cache at test_cmd_line#134180

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

Open
alex-semenyuk wants to merge1 commit intopython:main
base:main
Choose a base branch
Loading
fromalex-semenyuk:use_sys_clear_internal_caches
Open
Changes fromall 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
15 changes: 4 additions & 11 deletionsLib/test/test_cmd_line.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,6 @@
import tempfile
import textwrap
import unittest
import warnings
from test import support
from test.support import os_helper
from test.support import force_not_colorized
Expand DownExpand Up@@ -936,21 +935,15 @@ def test_python_asyncio_debug(self):

@unittest.skipUnless(sysconfig.get_config_var('Py_TRACE_REFS'), "Requires --with-trace-refs build option")
def test_python_dump_refs(self):
code = 'import sys; sys._clear_type_cache()'
# TODO: Remove warnings context manager once sys._clear_type_cache is removed
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
rc, out, err = assert_python_ok('-c', code, PYTHONDUMPREFS='1')
code = 'import sys; sys._clear_internal_caches()'
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")
def test_python_dump_refs_file(self):
with tempfile.NamedTemporaryFile() as dump_file:
code = 'import sys; sys._clear_type_cache()'
# TODO: Remove warnings context manager once sys._clear_type_cache is removed
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
rc, out, err = assert_python_ok('-c', code, PYTHONDUMPREFSFILE=dump_file.name)
code = 'import sys; sys._clear_internal_caches()'
rc, out, err = assert_python_ok('-c', code, PYTHONDUMPREFSFILE=dump_file.name)
self.assertEqual(rc, 0)
with open(dump_file.name, 'r') as file:
contents = file.read()
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp