GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-157407: Use _PyUnicode_AsUTF8NoNUL for AC 's' and 'z' converters by cmaloney · Pull Request #158210 · python/cpython

Conversation

@cmaloney

@cmaloney cmaloney commented Sep 26, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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 Argument 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.

cc: @eendebakpt , @methane . Found this while working on moving str to Argument Clinic generated code. The call + local rather than pointer to stack member, particularly when -fstack-protector-strong is set as some distros do, gets a lot shorter.

  • Issue: Reduce some code sizes #157407

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cmaloney @claude
pythongh-157407: Use _PyUnicode_AsUTF8NoNUL for AC 's' and 'z' conver…
3586d7c
…ters

The code was doing the same as the helper added in pythonGH-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) <[email protected]>
@cmaloney
cmaloney requested review from AA-Turner and erlend-aasland as code owners September 26, 2026 03:01
@bedevere-app bedevere-app Bot mentioned this pull request Sep 26, 2026
Reduce some code sizes #157407
Open
@bedevere-app bedevere-app Bot added the awaiting review label Sep 26, 2026
eendebakpt
eendebakpt approved these changes Sep 26, 2026
View reviewed changes
Comment thread Misc/NEWS.d/next/Tools-Demos/2026-09-25-17-30-00.gh-issue-157407.iOVPov.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Include/internal/pycore_unicodeobject.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Sep 26, 2026
@cmaloney @eendebakpt
Update Include/internal/pycore_unicodeobject.h
6469ac2
Co-authored-by: Pieter Eendebak <[email protected]>
@cmaloney cmaloney added the skip news label Sep 26, 2026
@cmaloney
Remove NEWS, add period
7cf010a
methane
methane approved these changes Sep 27, 2026
View reviewed changes
@cmaloney
Merge remote-tracking branch 'upstream/main' into clinic-s-z-asutf8nonul
98fec06
# Conflicts:
#	Modules/_ctypes/clinic/_ctypes.c.h
#	Modules/_io/clinic/fileio.c.h
#	Modules/_io/clinic/textio.c.h
#	Modules/_io/clinic/winconsoleio.c.h
#	Modules/_sqlite/clinic/connection.c.h
#	Modules/cjkcodecs/clinic/multibytecodec.c.h
#	Modules/clinic/_dbmmodule.c.h
#	Modules/clinic/_elementtree.c.h
#	Modules/clinic/_gdbmmodule.c.h
#	Modules/clinic/_pickle.c.h
#	Modules/clinic/_testclinic.c.h
#	Modules/clinic/_tkinter.c.h
#	Modules/clinic/arraymodule.c.h
#	Modules/clinic/posixmodule.c.h
#	Modules/clinic/pyexpat.c.h
#	Objects/clinic/memoryobject.c.h
#	Python/clinic/bltinmodule.c.h
#	Python/clinic/sysmodule.c.h
@eendebakpt

eendebakpt commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

@cmaloney Merge conflicts again. Can you resolve and maybe set auto-merge?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cmaloney
Merge remote-tracking branch 'upstream/main' into clinic-s-z-asutf8nonul
ac5fce6
# Conflicts:
#	Modules/_testcapi/clinic/exceptions.c.h
@bedevere-app bedevere-app Bot added the type-feature A feature request or enhancement label Oct 5, 2026
@cmaloney

cmaloney commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

@eendebakpt updated branch resolving conflicts. I can't set auto-merge / just a triager moving (hopefully) towards developer :)

eendebakpt reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@eendebakpt
eendebakpt enabled auto-merge (squash) October 5, 2026 16:48
@eendebakpt
eendebakpt merged commit cfd6cf7 into python:main Oct 5, 2026
64 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Oct 5, 2026
@cmaloney
cmaloney deleted the clinic-s-z-asutf8nonul branch October 5, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@methane methane methane approved these changes
@eendebakpt eendebakpt eendebakpt approved these changes
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland erlend-aasland is a code owner
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news type-feature A feature request or enhancement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@cmaloney @eendebakpt @methane
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.