GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||
GeezerVison is showing github.com — gh-95504: Fix sign placement in PyUnicode_FromFormat by philg314 · Pull Request #95505 · python/cpython Conversation
|
|
I emailed core-mentorship about this on Friday night but didn't wait to hear back before submitting this PR. @encukou is in the process of splitting _testcapimodule.c up into more manageable pieces (#93649) and has asked me to move Unicode related tests into a separate file. I'll convert this PR to a draft while working on that and convert it back once that's done. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@encukou this is ready for review. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general, but I would wait for testcapi refactoring.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| if (negative && !zeropad) { | ||
| if (_PyUnicodeWriter_WriteChar(writer, '-') == -1) | ||
| return NULL; | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It can be simpler. Instead of writing minus explicitly, you can write it as a part of the buffer.
You will get the same result if remove this if and pass &buffer[negative && zeropad] instead of &buffer[negative] to _PyUnicodeWriter_WriteASCIIString().
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
That wouldn't work with precision: %.5d with -123 would be 00-123.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry for making you do more work, but it works best if the test refactoring is done first, in a separate pull request, so that:
Do you want to split this up? I can also do it, and it wouldn't be too much extra work in addition to a review, but I don't want to “steal your contribution”. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
No problem, makes sense.
Sure, and for future reference I'll never have a problem with anything like that. Please ping me when the refactor is merged. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for the reviews @methane and @serhiy-storchaka and thanks for merging @encukou! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.