summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapimodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-03-25 15:32:11 (GMT)
committerGitHub <noreply@github.com>2024-03-25 15:32:11 (GMT)
commit0c1a42cf9c8cd0d4534d5c1d58f118ce7c5c446e (patch)
tree929ca228612a2f48b5e7afa86101fcecb04ad29d /Modules/_testcapimodule.c
parent01e7405da400e8997f8964d06cc414045e144681 (diff)
downloadcpython-0c1a42cf9c8cd0d4534d5c1d58f118ce7c5c446e.zip
cpython-0c1a42cf9c8cd0d4534d5c1d58f118ce7c5c446e.tar.gz
cpython-0c1a42cf9c8cd0d4534d5c1d58f118ce7c5c446e.tar.bz2
gh-87193: Support bytes objects with refcount > 1 in _PyBytes_Resize() (GH-117160)
Create a new bytes object and destroy the old one if it has refcount > 1.
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r--Modules/_testcapimodule.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 16b5e1d..3c30381 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -3971,6 +3971,9 @@ PyInit__testcapi(void)
if (_PyTestCapi_Init_Abstract(m) < 0) {
return NULL;
}
+ if (_PyTestCapi_Init_Bytes(m) < 0) {
+ return NULL;
+ }
if (_PyTestCapi_Init_Unicode(m) < 0) {
return NULL;
}