Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-35983: improve and test old trashcan macros#12607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
jdemeyer wants to merge1 commit intopython:mainfromjdemeyer:trashcan2

Conversation

jdemeyer
Copy link
Contributor

@jdemeyerjdemeyer commentedMar 28, 2019
edited by bedevere-bot
Loading

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 macrosPy_TRASHCAN_SAFE_BEGIN(op) can be made safe by only using the trashcan if the class inherits directly fromobject. 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

@pitrou
Copy link
Member

You need to merge/rebase and fix conflicts now.

@jdemeyer
Copy link
ContributorAuthor

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

@jdemeyer
Copy link
ContributorAuthor

You need to merge/rebase and fix conflicts now.

Done

@pitrou
Copy link
Member

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

@jdemeyer
Copy link
ContributorAuthor

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.

@pitrou
Copy link
Member

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

@jdemeyer
Copy link
ContributorAuthor

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

This willfix a crash in this case:

  1. classX usesPy_TRASHCAN_SAFE_BEGIN in its deallocator
  2. a classY inherits fromX
  3. a 50 levels deep nested instance ofY is deallocated

This willadd a new crash in this case:

  1. classX usesPy_TRASHCAN_SAFE_BEGIN in its deallocator
  2. classX does not inherit directly fromobject, but from another base class
  3. a very deeply nested instance ofX is deallocated, where this nesting does not involve any other trashcan-using class liketuple orlist

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.

@ambv
Copy link
Contributor

Closing in favor ofGH-27693. SeeBPO-44874 and the linked mailing list thread for details.

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

@1st11st1Awaiting requested review from 1st1

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@jdemeyer@pitrou@ambv@the-knights-who-say-ni@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp