Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[3.14] gh-146056: Fix repr() for lists and tuples containing NULLs (GH-146129) (alt)#146204

Closed
serhiy-storchaka wants to merge 3 commits intopython:3.14from
serhiy-storchaka:list-repr-null-3.14
Closed

[3.14] gh-146056: Fix repr() for lists and tuples containing NULLs (GH-146129) (alt)#146204
serhiy-storchaka wants to merge 3 commits intopython:3.14from
serhiy-storchaka:list-repr-null-3.14

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchakaserhiy-storchaka commentedMar 20, 2026
edited
Loading

(cherry picked from commit0f2246b)

This is an alternative to#146155 which only fixesPyUnicodeWriter_WriteRepr() for internal use, leaving users with the broken variant.


📚 Documentation preview 📚:https://cpython-previews--146204.org.readthedocs.build/

pythonGH-146129)(cherry picked from commit0f2246b)Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>Co-authored-by: Victor Stinner <vstinner@python.org>
@serhiy-storchakaserhiy-storchaka changed the title[3.14] gh-146056: Fix list.__repr__() for lists containing NULLs (GH-146129)[3.14] gh-146056: Fix list.__repr__() for lists containing NULLs (GH-146129) (alt)Mar 20, 2026
Copy link
Member

@vstinnervstinner left a 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.
Copy link
Member

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
Copy link
Member

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.

Copy link
MemberAuthor

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.

@serhiy-storchakaserhiy-storchaka changed the title[3.14] gh-146056: Fix list.__repr__() for lists containing NULLs (GH-146129) (alt)[3.14] gh-146056: Fix repr() for lists and tuples containing NULLs (GH-146129) (alt)Mar 20, 2026
@serhiy-storchakaserhiy-storchaka deleted the list-repr-null-3.14 branchMarch 22, 2026 07:27
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@vstinnervstinnervstinner left review comments

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@serhiy-storchaka@vstinner

[8]ページ先頭

©2009-2026 Movatter.jp