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)#146155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1842,8 +1842,6 @@ object. | ||
| On success, return ``0``. | ||
| On error, set an exception, leave the writer unchanged, and return ``-1``. | ||
| .. c:function:: int PyUnicodeWriter_WriteWideChar(PyUnicodeWriter *writer, const wchar_t *str, Py_ssize_t size) | ||
| Write the wide string *str* into *writer*. | ||
| @@ -1874,9 +1872,15 @@ object. | ||
| Call :c:func:`PyObject_Repr` on *obj* and write the output into *writer*. | ||
| If *obj* is ``NULL``, write the string ``"<NULL>"`` into *writer*. | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I would prefer to not change PyUnicodeWriter_WriteRepr() in a Python 3.14.x bugfix release. Can you leave it unchanged? Instead, modify list_repr() and tuple_repr() to write MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. We need to modify not only list_repr() and tuple_repr(), but all code that uses Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. In the Python code base, if I read the code correctly, only
My concern is that if you develop on (the future) Python 3.14.4 with MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Python 3.14.0 is broken. It crashes when you call The documentation says that Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. If you insist to change PyUnicodeWriter_WriteRepr() API, please add a MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. If we don't fix it in 3.14, we will need a versionchanged for 3.15. But we rarely add versionchanged for bugfixes, especially if the feature was added in the same version. Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I'm suggesting to add a MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Done. Created also a PR for adding in in main. | ||
| On success, return ``0``. | ||
| On error, set an exception, leave the writer unchanged, and return ``-1``. | ||
| .. versionchanged:: 3.14.4 | ||
| Added support for ``NULL``. | ||
| .. c:function:: int PyUnicodeWriter_WriteSubstring(PyUnicodeWriter *writer, PyObject *str, Py_ssize_t start, Py_ssize_t end) | ||
| Write the substring ``str[start:end]`` into *writer*. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| :c:func:`PyUnicodeWriter_WriteRepr` now supports ``NULL`` argument. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fix :func:`repr` for lists and tuples containing ``NULL``\ s. |
Uh oh!
There was an error while loading.Please reload this page.