Repository navigation
Conversation
ead4b04 to
6122dec
Compare
sergey-miryanov
left a comment
There was a problem hiding this comment.
LGTM.
Small nitpick: WDYT about moving assert(1 <= len && len < (Py_ssize_t)sizeof(buffer)); to the macro too?
| make_freplacement(PyObject *object) | ||
| { | ||
| char freplacement[64]; | ||
| int len; |
There was a problem hiding this comment.
This is churn IMO (the asserts guard nothing even if they did fail), and will probably also result in unused variable warnings.
There was a problem hiding this comment.
Sorry, I did not understand this part: "the asserts guard nothing even if they did fail" :)
What do you mean?
There was a problem hiding this comment.
PyOS_snprintf already truncates and NUL-terminates, so PyUnicode_FromString(freplacement) is safe regardless.
There was a problem hiding this comment.
asserts here are just checking that the buffer write produced the expected result. But, ok, I removed it :)
Not really important.
|
Rather than migrating from I did an experiment (cmaloney@e50228c) and on macOS it comes out faster because snprintf has to build and look at var args + python long objects don't have to allocate a lot of the time. |
Uh oh!
There was an error while loading. Please reload this page.