-
-
Notifications
You must be signed in to change notification settings - Fork 35.2k
gh-154387: Fix structseq_repr mislabeling of unnamed PyStructSequence fields
#154434
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6f010d0
757f9d3
d2c81d9
1f573ad
c587424
7eb8c27
52c00eb
d94858c
98f8f34
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,15 @@ def test_repr(self): | |
| self.assertIn("st_ino=", rep) | ||
| self.assertIn("st_dev=", rep) | ||
|
|
||
| # Issue #154387: unnamed fields should not be mislabeled with named field names. | ||
| st = os.stat_result(range(10)) | ||
| rep = repr(st) | ||
| self.assertEqual( | ||
| rep, | ||
| "os.stat_result(st_mode=0, st_ino=1, st_dev=2, st_nlink=3, " | ||
| "st_uid=4, st_gid=5, st_size=6, 7, 8, 9)" | ||
|
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 do not think extra items should actually ne considered if they are un-named, or at least they should be formatted differently. We jeed to discuss the format first because here, this repr would not work (you cannot just use it again as an input). I do not know whether it is better to simply ignore unnamed fields or do something else. |
||
| ) | ||
|
|
||
| def test_concat(self): | ||
| t1 = time.gmtime() | ||
| t2 = t1 + tuple(t1) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fix :c:func:`structseq_repr` mislabeling unnamed :c:type:`PyStructSequence` fields. Patch by Pranav Choudhary. |
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 does not test the same things as the issue. Please be more thorough here.