aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Python/import.c
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-12-23 19:39:02 +0300
committershadchin <shadchin@yandex-team.com>2024-12-23 19:54:20 +0300
commit65a5bf9d37a3b29eb394f560b9a09318196c40e8 (patch)
treee5cd68fb0682b2388e52d9806bb87adc348e21a8 /contrib/tools/python3/Python/import.c
parenta1dd87a52878ab3e46e5fd2dba5ecbba6113d7e0 (diff)
downloadydb-65a5bf9d37a3b29eb394f560b9a09318196c40e8.tar.gz
Update Python 3 to 3.12.8
commit_hash:c20045b8a987d8720e1f3328270357491d5530f3
Diffstat (limited to 'contrib/tools/python3/Python/import.c')
-rw-r--r--contrib/tools/python3/Python/import.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/contrib/tools/python3/Python/import.c b/contrib/tools/python3/Python/import.c
index 76b418840e..daac00593d 100644
--- a/contrib/tools/python3/Python/import.c
+++ b/contrib/tools/python3/Python/import.c
@@ -917,12 +917,14 @@ extensions_lock_release(void)
static void *
hashtable_key_from_2_strings(PyObject *str1, PyObject *str2, const char sep)
{
- Py_ssize_t str1_len, str2_len;
- const char *str1_data = PyUnicode_AsUTF8AndSize(str1, &str1_len);
- const char *str2_data = PyUnicode_AsUTF8AndSize(str2, &str2_len);
+ const char *str1_data = _PyUnicode_AsUTF8NoNUL(str1);
+ const char *str2_data = _PyUnicode_AsUTF8NoNUL(str2);
if (str1_data == NULL || str2_data == NULL) {
return NULL;
}
+ Py_ssize_t str1_len = strlen(str1_data);
+ Py_ssize_t str2_len = strlen(str2_data);
+
/* Make sure sep and the NULL byte won't cause an overflow. */
assert(SIZE_MAX - str1_len - str2_len > 2);
size_t size = str1_len + 1 + str2_len + 1;
@@ -3548,7 +3550,7 @@ _imp_find_frozen_impl(PyObject *module, PyObject *name, int withdata)
if (info.origname != NULL && info.origname[0] != '\0') {
origname = PyUnicode_FromString(info.origname);
if (origname == NULL) {
- Py_DECREF(data);
+ Py_XDECREF(data);
return NULL;
}
}