8000 gh-112301: Add -Wformat=2 compiler option to NODIST by nohlson · Pull Request #122474 · python/cpython · GitHub < 10000 link rel="icon" class="js-site-favicon" type="image/svg+xml" href="https://github.githubassets.com/favicons/favicon.svg" data-base-href="https://github.githubassets.com/favicons/favicon">
[go: up one dir, main page]

Skip to content

gh-112301: Add -Wformat=2 compiler option to NODIST #122474

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

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Pull unicodeobject changes
  • Loading branch information
nohlson committed Sep 30, 2024
commit 88fbc656e83a158beeb0d7892c915be38c84b998
5 changes: 4 additions & 1 deletion Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2897,7 +2897,6 @@ unicode_fromformat_arg(_PyUnicodeWriter *writer,
case F_INTMAX: DO_SPRINTS("j", intmax_t, uintmax_t); break;
default: DO_SPRINTS("", int, unsigned int); break;
}

#undef SPRINT
#undef DO_SPRINTS

Expand All @@ -2912,9 +2911,13 @@ unicode_fromformat_arg(_PyUnicodeWriter *writer,
precision = width - sign;
}

Py_ssize_t spacepad = Py_MAX(width - precision - sign, 0);
Py_ssize_t zeropad = Py_MAX(precision - len, 0);

if (_PyUnicodeWriter_Prepare(writer, width, 127) == -1)
return NULL;

if (spacepad && !(flags & F_LJUST)) {
if (PyUnicode_Fill(writer->buffer, writer->pos, spacepad, ' ') == -1)
return NULL;
writer->pos += spacepad;
Expand Down
Loading
0