Skip to content

gh-101703: Use bounded formatting in mmap.set_name() - #162917

Open
conao3 wants to merge 1 commit into
python:mainfrom
conao3:gh-101703-mmap-set-name
Open

conao3 wants to merge 1 commit into
python:mainfrom
conao3:gh-101703-mmap-set-name

Conversation

@conao3

@conao3 conao3 commented Dec 1, 2026 •

Copy link
Copy Markdown

Use PyOS_snprintf() to write the Linux mmap name into the 80-byte buffer. Pass the buffer size to the formatter and use its return value to reject names that do not fit. This removes the separate length limit from the C code.

The existing test_mmap suite passes before and after the change on 64-bit and 32-bit Linux. The test_set_name test confirms that a 66-byte ASCII name succeeds, a 67-byte name raises ValueError, and file-backed mappings still reject names.

Part of #101703.


Assisted-by: Codex:gpt-6.2-sol

@python-cla-bot

python-cla-bot Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app

bedevere-app Bot commented Dec 1, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants