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-94673: Ensure subtypes are readied only once in math.trunc() by neonene · Pull Request #105465 · python/cpython

Conversation

@neonene

@neonene neonene commented Jun 7, 2023 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Fixes a typo in d2e2e53.
cc: @ericsnowcurrently

  • Issue: [subinterpreters] Static types incorrectly share some objects between interpreters #94673

Sorry, something went wrong.

Uh oh!

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

All reactions
@neonene
add a missing NOT
0d5f9b5
@bedevere-bot bedevere-bot added the awaiting review label Jun 7, 2023
@bedevere-bot bedevere-bot mentioned this pull request May 2, 2023
[subinterpreters] Static types incorrectly share some objects between interpreters #94673
Closed
@neonene neonene changed the title gh-94673: Ensure subtypes are readied once in math.trunc() gh-94673: Ensure subtypes are readied only once in math.trunc() Jun 7, 2023
ericsnowcurrently
ericsnowcurrently approved these changes Jun 7, 2023
View reviewed changes

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

LGTM

(good catch!)

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting review labels Jun 7, 2023
@ericsnowcurrently ericsnowcurrently added the skip news label Jun 7, 2023
@ericsnowcurrently
ericsnowcurrently merged commit 5394bf9 into python:main Jun 7, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label Jun 7, 2023
@ericsnowcurrently ericsnowcurrently added the needs backport to 3.12 only security fixes label Jun 7, 2023
@miss-islington

miss-islington commented Jun 7, 2023

Copy link
Copy Markdown
Contributor

Thanks @neonene for the PR, and @ericsnowcurrently for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot

bedevere-bot commented Jun 7, 2023

Copy link
Copy Markdown

GH-105471 is a backport of this pull request to the 3.12 branch.

All reactions

Sorry, something went wrong.

Uh oh!

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 7, 2023
@neonene @miss-islington
pythongh-94673: Ensure subtypes are readied only once in math.trunc() (…
7a715c2
…pythongh-105465)

Fixes a typo in d2e2e53.
(cherry picked from commit 5394bf9)

Co-authored-by: neonene <[email protected]>
@bedevere-bot bedevere-bot removed the needs backport to 3.12 only security fixes label Jun 7, 2023
@neonene
neonene deleted the math_trunc branch June 7, 2023 20:06
ericsnowcurrently pushed a commit that referenced this pull request Jun 7, 2023
@miss-islington @neonene
[3.12] gh-94673: Ensure subtypes are readied only once in math.trunc() (
1e12877
gh-105465) (gh-105471)

Fixes a typo in d2e2e53.
(cherry picked from commit 5394bf9)

Co-authored-by: neonene <[email protected]>
@mdickinson

mdickinson commented Jun 8, 2023

Copy link
Copy Markdown
Member

Out of curiosity, why is the code for math_trunc different from that for math_floor and math_ceil? Why does math_trunc need the PyType_Ready call, but not math_floor or math_ceil?

All reactions

Sorry, something went wrong.

Uh oh!

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

@ericsnowcurrently

ericsnowcurrently commented Jun 8, 2023

Copy link
Copy Markdown
Member

Hmm, I have a guess. That code was added in 2007 (commit 15d3d04) as a builtin (bltinsmodule.c). In 2008 the function was moved to the math module. So that's probably the difference.

All reactions

Sorry, something went wrong.

Uh oh!

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

@mdickinson

mdickinson commented Jun 10, 2023

Copy link
Copy Markdown
Member

@ericsnowcurrently Nice find; that would make sense. (Well, maybe; I still can't quite figure out why the PyType_Ready would have been necessary, but it's a little more plausible that built-in functions could be being executed before some types are fully initialised.)

Do you see any reason not to just get rid of this code in mathmodule.c?

All reactions

Sorry, something went wrong.

Uh oh!

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

@ericsnowcurrently

ericsnowcurrently commented Jun 12, 2023

Copy link
Copy Markdown
Member

I suspect that code is an artifact of a time when folks were inconsistent about calling PyType_Ready(). However, I'm not sure what the actual status quo is at this point. This might be a good thing to ask about on python-dev.

All reactions

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

@ericsnowcurrently ericsnowcurrently ericsnowcurrently approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

skip news

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

@neonene @miss-islington @bedevere-bot @mdickinson @ericsnowcurrently
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.