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 — bpo-35983: improve and test old trashcan macros by jdemeyer · Pull Request #12607 · python/cpython

Conversation

@jdemeyer

@jdemeyer jdemeyer commented Mar 28, 2019 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

This is a follow-up to #11841. I made a separate PR since that one has been reviewed already.

I realized that the backwards-compatibility macros Py_TRASHCAN_SAFE_BEGIN(op) can be made safe by only using the trashcan if the class inherits directly from object. That case is safe and it's also a very common case (few builtin types have a non-trivial subtype).

https://bugs.python.org/issue35983

Sorry, something went wrong.

Uh oh!

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

All reactions
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Mar 28, 2019
@bedevere-bot bedevere-bot added the awaiting review label Mar 28, 2019
@jdemeyer
jdemeyer force-pushed the trashcan2 branch from b1618f4 to a7b4fef Compare March 29, 2019 14:35
@jdemeyer
jdemeyer marked this pull request as ready for review March 29, 2019 14:39
@jdemeyer
jdemeyer requested a review from 1st1 as a code owner March 29, 2019 14:39
@pitrou

pitrou commented May 10, 2019

Copy link
Copy Markdown
Member

You need to merge/rebase and fix conflicts now.

All reactions

Sorry, something went wrong.

Uh oh!

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

@jdemeyer
bpo-35983: improve and test old trashcan macros
4898109
@jdemeyer
jdemeyer force-pushed the trashcan2 branch from a7b4fef to 4898109 Compare May 14, 2019 08:13
@jdemeyer

jdemeyer commented May 14, 2019

Copy link
Copy Markdown
Contributor Author

skip news because this really goes together with #11841, it's not a separate issue.

All reactions

Sorry, something went wrong.

Uh oh!

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

@jdemeyer

jdemeyer commented May 14, 2019

Copy link
Copy Markdown
Contributor Author

You need to merge/rebase and fix conflicts now.

Done

All reactions

Sorry, something went wrong.

Uh oh!

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

@pitrou pitrou added the skip news label May 14, 2019
@pitrou

pitrou commented May 14, 2019

Copy link
Copy Markdown
Member

I'm not sure it's safe to change the meaning of the old macros. @benjaminp @serhiy-storchaka What do you think?

All reactions

Sorry, something went wrong.

Uh oh!

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

@jdemeyer

jdemeyer commented May 14, 2019

Copy link
Copy Markdown
Contributor Author

I'm not sure it's safe to change the meaning of the old macros.

They are already changed as part of #11841. This is just changing them in a safer way.

All reactions

Sorry, something went wrong.

Uh oh!

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

@pitrou

pitrou commented May 14, 2019

Copy link
Copy Markdown
Member

AFAICT, Py_TRASHCAN_SAFE_BEGIN wasn't changed in #11841 (though it was implemented differently).

All reactions

Sorry, something went wrong.

Uh oh!

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

@jdemeyer

jdemeyer commented May 14, 2019

Copy link
Copy Markdown
Contributor Author

I see what you mean. Let me be very precise what this PR will fix and what it will break, hopefully clarifying things:

This will fix a crash in this case:

  1. class X uses Py_TRASHCAN_SAFE_BEGIN in its deallocator
  2. a class Y inherits from X
  3. a 50 levels deep nested instance of Y is deallocated

This will add a new crash in this case:

  1. class X uses Py_TRASHCAN_SAFE_BEGIN in its deallocator
  2. class X does not inherit directly from object, but from another base class
  3. a very deeply nested instance of X is deallocated, where this nesting does not involve any other trashcan-using class like tuple or list

I consider the first set of conditions more likely than the second, so this will fix more crashes than it introduces. But I cannot deny the possibility that it will break stuff.

All reactions

Sorry, something went wrong.

Uh oh!

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

@ambv

ambv commented Aug 27, 2021

Copy link
Copy Markdown
Contributor

Closing in favor of GH-27693. See BPO-44874 and the linked mailing list thread for details.

All reactions

Sorry, something went wrong.

Uh oh!

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

@ambv ambv closed this Aug 27, 2021
@jdemeyer jdemeyer mentioned this pull request Jun 19, 2022
tp_dealloc trashcan shouldn't be called for subclasses #80164
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@1st1 1st1 Awaiting requested review from 1st1

Uh oh!

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

Assignees

No one assigned

Labels

awaiting review 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

@jdemeyer @pitrou @ambv @the-knights-who-say-ni @bedevere-bot
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.