Skip to content

Commit cfd6cf7

Browse files
cmaloneyclaudeeendebakpt
authored
gh-157407: Use _PyUnicode_AsUTF8NoNUL for AC 's' and 'z' converters (#158210)
* gh-157407: Use _PyUnicode_AsUTF8NoNUL for AC 's' and 'z' converters The code was doing the same as the helper added in GH-111957 but inline. That resulted in significantly more `.text` for most functions. Refactor the Arguemnt Clinic converters code to deduplicate a bit while keeping generated code close to original. On my Linux x64 box this reduces `.text` by ~6200 bytes in a clang release build (no PGO or LTO). Performance is flat. The helper was already exported for `_sqlite3`, update the comment that it is used in AC generated code as well. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * Update Include/internal/pycore_unicodeobject.h Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com> * Remove NEWS, add period --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
1 parent 64bad23 commit cfd6cf7

47 files changed

Lines changed: 309 additions & 1115 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Include/internal/pycore_unicodeobject.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ extern void _PyUnicode_InternStatic(PyInterpreterState *interp, PyObject **);
468468
extern void _PyUnicode_ClearInterned(PyInterpreterState *interp);
469469

470470
// Like PyUnicode_AsUTF8(), but check for embedded null characters.
471-
// Export for '_sqlite3' shared extension.
471+
// Export for '_sqlite3' shared extension, and for Argument Clinic code.
472472
PyAPI_FUNC(const char *) _PyUnicode_AsUTF8NoNUL(PyObject *);
473473

474474

‎Modules/_ctypes/clinic/_ctypes.c.h‎

Lines changed: 3 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Modules/_ctypes/clinic/callproc.c.h‎

Lines changed: 3 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Modules/_io/clinic/_iomodule.c.h‎

Lines changed: 6 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Modules/_io/clinic/fileio.c.h‎

Lines changed: 3 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Modules/_io/clinic/textio.c.h‎

Lines changed: 5 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Modules/_io/clinic/winconsoleio.c.h‎

Lines changed: 3 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Modules/_multiprocessing/clinic/multiprocessing.c.h‎

Lines changed: 3 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Modules/_multiprocessing/clinic/semaphore.c.h‎

Lines changed: 3 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Modules/_sqlite/clinic/_sqlite3.connect.c.h‎

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)