summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-07-24 18:48:06 (GMT)
committerGitHub <noreply@github.com>2023-07-24 18:48:06 (GMT)
commit307186704d8327d6c67b0650e49b125758a25bbc (patch)
treebc16b1afa6e77c8d5f9c9b276a4f0f6483c950de /Lib/test
parentd27eb1e406a8789d9eaba6dbfed5c2e5abe294fd (diff)
downloadcpython-307186704d8327d6c67b0650e49b125758a25bbc.zip
cpython-307186704d8327d6c67b0650e49b125758a25bbc.tar.gz
cpython-307186704d8327d6c67b0650e49b125758a25bbc.tar.bz2
gh-106320: Remove private _PyMem API (#107187)
Move private _PyMem functions to the internal C API (pycore_pymem.h): * _PyMem_GetCurrentAllocatorName() * _PyMem_RawStrdup() * _PyMem_RawWcsdup() * _PyMem_Strdup() No longer export these functions. Move pymem_getallocatorsname() function from _testcapi to _testinternalcapi, since the API moved to the internal C API.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/pythoninfo.py4
-rw-r--r--Lib/test/test_cmd_line.py6
-rw-r--r--Lib/test/test_sys.py4
3 files changed, 7 insertions, 7 deletions
diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py
index b84c144..e4e098d 100644
--- a/Lib/test/pythoninfo.py
+++ b/Lib/test/pythoninfo.py
@@ -637,11 +637,11 @@ def collect_decimal(info_add):
def collect_testcapi(info_add):
try:
- import _testcapi
+ import _testinternalcapi
except ImportError:
return
- call_func(info_add, 'pymem.allocator', _testcapi, 'pymem_getallocatorsname')
+ call_func(info_add, 'pymem.allocator', _testinternalcapi, 'pymem_getallocatorsname')
def collect_resource(info_add):
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
index 9429800..e88b7c8 100644
--- a/Lib/test/test_cmd_line.py
+++ b/Lib/test/test_cmd_line.py
@@ -717,11 +717,11 @@ class CmdLineTest(unittest.TestCase):
# Memory allocator debug hooks
try:
- import _testcapi
+ import _testinternalcapi
except ImportError:
pass
else:
- code = "import _testcapi; print(_testcapi.pymem_getallocatorsname())"
+ code = "import _testinternalcapi; print(_testinternalcapi.pymem_getallocatorsname())"
with support.SuppressCrashReport():
out = self.run_xdev("-c", code, check_exitcode=False)
if support.with_pymalloc():
@@ -783,7 +783,7 @@ class CmdLineTest(unittest.TestCase):
self.assertEqual(out, expected_filters)
def check_pythonmalloc(self, env_var, name):
- code = 'import _testcapi; print(_testcapi.pymem_getallocatorsname())'
+ code = 'import _testinternalcapi; print(_testinternalcapi.pymem_getallocatorsname())'
env = dict(os.environ)
env.pop('PYTHONDEVMODE', None)
if env_var is not None:
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 37f75ad..7861fa2 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -960,12 +960,12 @@ class SysModuleTest(unittest.TestCase):
"sys.getallocatedblocks unavailable on this build")
def test_getallocatedblocks(self):
try:
- import _testcapi
+ import _testinternalcapi
except ImportError:
with_pymalloc = support.with_pymalloc()
else:
try:
- alloc_name = _testcapi.pymem_getallocatorsname()
+ alloc_name = _testinternalcapi.pymem_getallocatorsname()
except RuntimeError as exc:
# "cannot get allocators name" (ex: tracemalloc is used)
with_pymalloc = True