Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.3k
[3.14] gh-146056: Fix repr() for lists and tuples containing NULLs (GH-146129) (alt)#146204
[3.14] gh-146056: Fix repr() for lists and tuples containing NULLs (GH-146129) (alt)#146204serhiy-storchaka wants to merge 3 commits intopython:3.14from
Conversation
pythonGH-146129)(cherry picked from commit0f2246b)Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>Co-authored-by: Victor Stinner <vstinner@python.org>
vstinner left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't think that this hack is needed. I would prefer to only change tuple_repr() and list_repr().
| @@ -0,0 +1 @@ | |||
| :c:func:`PyUnicodeWriter_WriteRepr` now supports ``NULL`` argument. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is no longer true.
| PyObject *obj); | ||
| #if defined(Py_BUILD_CORE) || defined(Py_BUILD_CORE_MODULE) | ||
| #define PyUnicodeWriter_WriteRepr _PyUnicodeWriter_WriteReprTrue | ||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It looks like a bad hack to me. I don't think that it's needed: only tuple_repr() and list_repr() should be modified to accept NULL:#146155 (comment), other functions cannot call PyUnicodeWriter_WriteRepr() with NULL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I tried to minimize the diff. If you prefer, we can simply replacePyUnicodeWriter_WriteRepr with_PyUnicodeWriter_WriteReprTrue. This will make future backports more difficult.
We cannot be sure that this is not needed until we analyze every use ofPyUnicodeWriter_WriteRepr. This will take a time. Even if it is not needed right now, it can be needed after future backports.
Uh oh!
There was an error while loading.Please reload this page.
(cherry picked from commit0f2246b)
This is an alternative to#146155 which only fixes
PyUnicodeWriter_WriteRepr()for internal use, leaving users with the broken variant.📚 Documentation preview 📚:https://cpython-previews--146204.org.readthedocs.build/