FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-83714: Set os.statx() members to None if missing from stx_mask by vstinner · Pull Request #140216 · python/cpython · GitHub

Repository navigation

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension .c  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
Prev Previous commit
Next Next commit
Fix pystatx_result_repr()
Change the logic to write the comma.
  • Loading branch information
vstinner committed Oct 16, 2025
commit 52d7ef25f4d81803ae2f7e607e27020a339ddfba
25 changes: 9 additions & 16 deletions Modules/posixmodule.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -3529,31 +3529,24 @@ pystatx_result_repr(PyObject *op)
Py_DECREF(o);
}

if (Py_ARRAY_LENGTH(pystatx_result_members) > 1
&& Py_ARRAY_LENGTH(pystatx_result_getset) > 1) {
WRITE_ASCII(", ");
}

for (size_t i = 0; i < Py_ARRAY_LENGTH(pystatx_result_getset) - 1; ++i) {
PyGetSetDef *d = &pystatx_result_getset[i];
PyObject *o = d->get(op, d->closure);
if (o == NULL) {
goto error;
}
if (o == Py_None) {
continue;
}

if (o != Py_None) {
if (i > 0) {
WRITE_ASCII(", ");
}

WRITE_ASCII(d->name);
WRITE_ASCII("=");
if (PyUnicodeWriter_WriteRepr(writer, o) < 0) {
Py_DECREF(o);
goto error;
}
WRITE_ASCII(", ");
WRITE_ASCII(d->name);
WRITE_ASCII("=");
if (PyUnicodeWriter_WriteRepr(writer, o) < 0) {
Py_DECREF(o);
goto error;
}
Py_DECREF(o);
}

WRITE_ASCII(")");
Expand Down
Loading

Back | FazBrowse Home | New Git URL