mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
gh-111089: PyUnicode_AsUTF8AndSize() sets size on error (#111106)
On error, PyUnicode_AsUTF8AndSize() now sets the size argument to -1, to avoid undefined value.
This commit is contained in:
parent
d8f32be5b6
commit
f1e751e933
3 changed files with 11 additions and 4 deletions
|
@ -634,7 +634,7 @@ unicode_asutf8andsize(PyObject *self, PyObject *args)
|
|||
NULLABLE(unicode);
|
||||
s = PyUnicode_AsUTF8AndSize(unicode, &size);
|
||||
if (s == NULL) {
|
||||
assert(size == UNINITIALIZED_SIZE);
|
||||
assert(size == -1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue