Skip to content

Commit f2d9558

Browse files
committed
add comment
1 parent 0b1553f commit f2d9558

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Objects/memoryobject.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2349,6 +2349,9 @@ memoryview_hex_impl(PyMemoryViewObject *self, PyObject *sep,
23492349
CHECK_RELEASED(self);
23502350

23512351
if (MV_C_CONTIGUOUS(self->flags)) {
2352+
// Prevent 'self' from being freed if computing len(sep) mutates 'self'
2353+
// in _Py_strhex_with_sep().
2354+
// See: https://github.com/python/cpython/issues/143195.
23522355
self->exports++;
23532356
PyObject *ret = _Py_strhex_with_sep(src->buf, src->len, sep, bytes_per_sep);
23542357
self->exports--;

0 commit comments

Comments
 (0)