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-112066: Use `PyDict_SetDefaultRef` in place of `PyDict_SetDefault`. by colesbury · Pull Request #112211 · python/cpython

Conversation

@colesbury

@colesbury colesbury commented Nov 17, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

This changes a number of internal usages of PyDict_SetDefault to use PyDict_SetDefaultRef.

  • Issue: Provide a variant of PyDict_SetDefault that returns a new reference (instead of a borrowed reference) #112066

Sorry, something went wrong.

Uh oh!

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

serhiy-storchaka reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@colesbury colesbury added the skip news label Nov 17, 2023
@bedevere-app bedevere-app Bot mentioned this pull request Nov 17, 2023
Provide a variant of PyDict_SetDefault that returns a new reference (instead of a borrowed reference) #112066
Closed
@colesbury colesbury added the topic-free-threading label Nov 17, 2023
@colesbury colesbury mentioned this pull request Nov 17, 2023
gh-112066: Add PyDict_SetDefaultRef function. #112123
Merged
encukou
encukou approved these changes Nov 27, 2023
View reviewed changes

@encukou encukou 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.

+1 from me; IMO the chance of C-API WG having objections is low enough, let's be optimistic and merge this.

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-app bedevere-app Bot added the awaiting merge label Nov 27, 2023
serhiy-storchaka
serhiy-storchaka reviewed Nov 27, 2023
View reviewed changes
Comment thread Python/compile.c Outdated
Comment on lines +986 to +990
if (res < 0) {
Py_DECREF(key);
return NULL;
}
if (res == 1) {

@serhiy-storchaka serhiy-storchaka Nov 27, 2023

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.

Maybe merge them in single test != 0?

Sorry, something went wrong.

Uh oh!

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

All reactions

@colesbury colesbury Nov 27, 2023

Copy link
Copy Markdown
Contributor Author

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 - I combined the cases.

Sorry, something went wrong.

Uh oh!

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

All reactions
@colesbury colesbury added the DO-NOT-MERGE label Nov 27, 2023
@colesbury
pythongh-112066: Use PyDict_SetDefaultRef in place of `PyDict_SetDe…
14a00f4
…fault`.

This changes a number of internal usages of `PyDict_SetDefault` to
use `PyDict_SetDefaultRef`.
@colesbury
colesbury force-pushed the PyDict_SetDefaultRef-usage branch from 3899746 to 14a00f4 Compare February 6, 2024 16:38
@colesbury colesbury removed the DO-NOT-MERGE label Feb 6, 2024
@colesbury
colesbury marked this pull request as ready for review February 6, 2024 16:39
@colesbury
colesbury requested review from iritkatriel, markshannon and methane as code owners February 6, 2024 16:39
@colesbury
colesbury requested a review from serhiy-storchaka February 6, 2024 16:47
@colesbury

colesbury commented Feb 6, 2024

Copy link
Copy Markdown
Contributor Author

I've rebased this PR now that #112123 is merged. @serhiy-storchaka, would you please look over this?

All reactions

Sorry, something went wrong.

Uh oh!

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

@colesbury
Merge branch 'main' into PyDict_SetDefaultRef-usage
654347a
erlend-aasland
erlend-aasland approved these changes Feb 7, 2024
View reviewed changes
Comment thread Python/compile.c Resolved

Uh oh!

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

serhiy-storchaka
serhiy-storchaka approved these changes Feb 7, 2024
View reviewed changes
@colesbury @erlend-aasland
Update Python/compile.c
db6f518
Co-authored-by: Erlend E. Aasland <[email protected]>
@colesbury
colesbury merged commit ef3ceab into python:main Feb 7, 2024
@bedevere-app bedevere-app Bot removed the awaiting merge label Feb 7, 2024
@colesbury
colesbury deleted the PyDict_SetDefaultRef-usage branch February 7, 2024 18:43
@vstinner

vstinner commented Feb 8, 2024

Copy link
Copy Markdown
Member

Nice change, it makes the code more readable.

erlend-aasland 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.

fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull request Feb 14, 2024
@colesbury @erlend-aasland @fsc-eriker
pythongh-112066: Use PyDict_SetDefaultRef in place of `PyDict_SetDe…
891db02
…fault`. (python#112211)

This changes a number of internal usages of `PyDict_SetDefault` to use `PyDict_SetDefaultRef`.

Co-authored-by: Erlend E. Aasland <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@encukou encukou encukou approved these changes
@serhiy-storchaka serhiy-storchaka serhiy-storchaka approved these changes
@erlend-aasland erlend-aasland erlend-aasland approved these changes
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner
@iritkatriel iritkatriel Awaiting requested review from iritkatriel iritkatriel is a code owner
@methane methane Awaiting requested review from methane

Uh oh!

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

Assignees

No one assigned

Labels

skip news topic-free-threading

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.

5 participants

@colesbury @vstinner @encukou @serhiy-storchaka @erlend-aasland
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.