From 407e1b5655ecdd754d5c418a75e86a69633ff97b Mon Sep 17 00:00:00 2001 From: Kumar Aditya Date: Fri, 4 Apr 2025 21:03:21 +0530 Subject: [PATCH] use unique ref --- Objects/unicodeobject.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 7c735685e89389..b67cb27344e0b0 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1816,7 +1816,7 @@ static int unicode_modifiable(PyObject *unicode) { assert(_PyUnicode_CHECK(unicode)); - if (Py_REFCNT(unicode) != 1) + if (!_PyObject_IsUniquelyReferenced(unicode)) return 0; if (PyUnicode_HASH(unicode) != -1) return 0; @@ -14577,7 +14577,7 @@ _PyUnicode_FormatLong(PyObject *val, int alt, int prec, int type) assert(PyUnicode_IS_ASCII(result)); /* To modify the string in-place, there can only be one reference. */ - if (Py_REFCNT(result) != 1) { + if (!_PyObject_IsUniquelyReferenced(result)) { Py_DECREF(result); PyErr_BadInternalCall(); return NULL;