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-160962: Fix PyInitConfig_SetStr() with NULL value by vstinner · Pull Request #161258 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Nov 3, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Previously, passing NULL to an optional string option crashed.

Add tests on PyInitConfig_GetInt(), PyInitConfig_GetStr() and PyInitConfig_GetStrList() functions.

  • Issue: Null dereferencing of a pointer in initconfig.c #160962

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner
pythongh-160962: Fix PyInitConfig_SetStr() with NULL value
d9eae76
Previously, passing NULL to an optional string option crashed.

Add tests on PyInitConfig_GetInt(), PyInitConfig_GetStr() and
PyInitConfig_GetStrList() functions.
@vstinner vstinner added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Nov 3, 2026
@vstinner
vstinner requested review from FFY00 and ericsnowcurrently as code owners November 3, 2026 17:29
@bedevere-app bedevere-app Bot added the awaiting core review label Nov 3, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Nov 3, 2026
Null dereferencing of a pointer in initconfig.c #160962
Closed
@vstinner

vstinner commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

cc @sobolevn @NekoAsakura

All reactions

Sorry, something went wrong.

Uh oh!

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

NekoAsakura
NekoAsakura requested changes Nov 3, 2026
View reviewed changes

@NekoAsakura NekoAsakura left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix LGTM.

The tests would be better placed in test_initconfig_get_api(), which already covers the Get* functions. test_initconfig_api is currently skipped on every build (#161270).

Also, the PyInitConfig_SetStr() doc could say that NULL is accepted for optional string options, like PyInitConfig_GetStr() does (link).

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Programs/_testembed.c Resolved

Uh oh!

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

vstinner added 3 commits November 4, 2026 00:30
@vstinner
Remove redundant get tests
3893f25
Instead, add some tests to test_initconfig_get_api().
@vstinner
Mention NULL in SetStr() documentation
2101488
@vstinner
Update also GetStr() doc
b75a5f4
@vstinner

vstinner commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

@NekoAsakura: Please review the updated PR.

The tests would be better placed in test_initconfig_get_api(), which already covers the Get* functions.

Oh, you're right, I completely forgot about test_initconfig_get_api(). I removed redudant tests and completed test_initconfig_get_api() instead.

test_initconfig_api is currently skipped on every build (#161270).

Oops! I approved your PR.

Also, the PyInitConfig_SetStr() doc could say that NULL is accepted for optional string options, like PyInitConfig_GetStr() does (link).

Done: I updated SetStr() doc to mention NULL. I also documented optional strings as str | None type in the Configuration Options table.

All reactions

Sorry, something went wrong.

Uh oh!

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

@read-the-docs-community

read-the-docs-community Bot commented Nov 3, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35630177 | 📁 Comparing 996d0e5 against main (7e3290d)

  🔍 Preview build  

2 files changed
± c-api/init_config.html
± whatsnew/changelog.html
All reactions

Sorry, something went wrong.

Uh oh!

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

NekoAsakura
NekoAsakura approved these changes Nov 4, 2026
View reviewed changes

@NekoAsakura NekoAsakura left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM. Just one comment.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Programs/_testembed.c Resolved

Uh oh!

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

vstinner added 2 commits November 4, 2026 02:01
@vstinner
Fix GetStr() doc; add tests on set errors
b680011
@vstinner
Clarify doc
996d0e5
@vstinner
vstinner enabled auto-merge (squash) November 4, 2026 01:08
@vstinner
vstinner merged commit 6d69297 into python:main Nov 4, 2026
56 checks passed

Uh oh!

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

@vstinner
vstinner deleted the initconfig branch November 4, 2026 01:47
@bedevere-app bedevere-app Bot removed the awaiting core review label Nov 4, 2026
@miss-islington-app

miss-islington-app Bot commented Nov 4, 2026

Copy link
Copy Markdown

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app

bedevere-app Bot commented Nov 4, 2026

Copy link
Copy Markdown

GH-161291 is a backport of this pull request to the 3.15 branch.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Nov 4, 2026
@bedevere-app

bedevere-app Bot commented Nov 4, 2026

Copy link
Copy Markdown

GH-161292 is a backport of this pull request to the 3.14 branch.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Nov 4, 2026
vstinner added a commit that referenced this pull request Nov 4, 2026
@miss-islington @vstinner
[3.15] gh-160962: Fix PyInitConfig_SetStr() with NULL value (GH-161258)…
22bc41d
… (#161291)

gh-160962: Fix PyInitConfig_SetStr() with NULL value (GH-161258)

Previously, passing NULL to an optional string option crashed.

Document optional string options.

Add more tests on the PyInitConfig API.
(cherry picked from commit 6d69297)

Co-authored-by: Victor Stinner <[email protected]>
vstinner added a commit that referenced this pull request Nov 4, 2026
@miss-islington @vstinner
[3.14] gh-160962: Fix PyInitConfig_SetStr() with NULL value (GH-161258)…
d16d33a
… (#161292)

gh-160962: Fix PyInitConfig_SetStr() with NULL value (GH-161258)

Previously, passing NULL to an optional string option crashed.

Document optional string options.

Add more tests on the PyInitConfig API.
(cherry picked from commit 6d69297)

Co-authored-by: Victor Stinner <[email protected]>
@vstinner

vstinner commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

I merged my PR. Thanks @NekoAsakura for your accurate review!

NekoAsakura reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

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

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

Reviewers

@NekoAsakura NekoAsakura NekoAsakura approved these changes
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner
@FFY00 FFY00 Awaiting requested review from FFY00 FFY00 is a code owner

Uh oh!

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

Assignees

No one assigned

Labels

None yet

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.

2 participants

@vstinner @NekoAsakura
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 01402503 — 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.