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

gh-124872: Replace enter/exit events with "switched"#125532

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

Merged
ambv merged 4 commits intopython:mainfromEclips4:revert-of-revert
Oct 16, 2024

Conversation

@Eclips4
Copy link
Member

@Eclips4Eclips4 commentedOct 15, 2024
edited by bedevere-appbot
Loading

@Eclips4
Copy link
MemberAuthor

With that PR,test_capi is no longer leaking:

admin@Admins-MacBook-Air~/p/cpython (revert-of-revert)> ./python.exe-mtest-R3:3test_capiUsingrandomseed:9920954540:00:00loadavg:26.10Run1testsequentiallyinasingleprocess0:00:00loadavg:26.10 [1/1]test_capibeginning6repetitions.Showingnumberofleaks (.for0orless,Xfor10ormore)123:456XX. ...test_capipassedin43.3sec==Testsresult:SUCCESS==1testOK.Totalduration:43.4secTotaltests:run=985skipped=67Totaltestfiles:run=1/1Result:SUCCESS

@vstinner
Copy link
Member

gh-125512: Revert#125513 and fix reference cycle#125532

It's not a revert, but a revert of a revert :-D The PR title should begh-124872: Replace enter/exit events with "switched.

@vstinner
Copy link
Member

I suggest to wait after Python 3.14.0 alpha1 release to retry this change.

Eclips4 reacted with thumbs up emoji

@Eclips4Eclips4 changed the titlegh-125512: Revert #125513 and fix reference cyclegh-124872: Replace enter/exit events with "switched"Oct 15, 2024
@1st1
Copy link
Member

I suggest to wait after Python 3.14.0 alpha1 release to retry this change.

Why? We can debug and fix the ref leak.

@rhansen Please build CPython with./configure --with-pydebug and run the tests with-R3:3. That will take much longer so I suggest just running asyncio & contextvars & decimal tests with this flag.

@vstinner
Copy link
Member

vstinner commentedOct 15, 2024
edited
Loading

me:

I suggest to wait after Python 3.14.0 alpha1 release to retry this change.

@1st1:

Why?

It's just that there aremany broken buildbots, I think that this change can wait for 3.14.0a2.

@Eclips4
Copy link
MemberAuthor

FYI, I ran the test suite in hunt refleaks mode locally and it succeeded:

==Testsresult:SUCCESS==25testsskipped:test.test_asyncio.test_windows_eventstest.test_asyncio.test_windows_utilstest.test_gdb.test_backtracetest.test_gdb.test_cfunctiontest.test_gdb.test_cfunction_fulltest.test_gdb.test_misctest.test_gdb.test_pretty_printtest.test_multiprocessing_fork.test_managertest.test_multiprocessing_fork.test_misctest.test_multiprocessing_fork.test_processestest.test_multiprocessing_fork.test_threadstest_androidtest_dbm_gnutest_devpolltest_epolltest_free_threadingtest_launchertest_msvcrttest_perf_profilertest_perfmapstest_startfiletest_winapitest_winconsoleiotest_winregtest_wmi11testsskipped (resourcedenied):test_cursestest_peg_generatortest_pyrepltest_smtpnettest_socketservertest_tkintertest_ttktest_urllib2nettest_urllibnettest_winsoundtest_zipfile64442testsOK.Totalduration:20min5secTotaltests:run=44,347skipped=2,182Totaltestfiles:run=467/478skipped=25resource_denied=11Result:SUCCESS
vstinner reacted with thumbs up emoji

@1st1
Copy link
Member

@Eclips4 thanks for fixing the leak!

@vstinner

It's just that there aremany broken buildbots, I think that this change can wait for 3.14.0a2.

I sympathize, really sorry about breaking them and causing pain :/ Can we try landing this PR since it appears it should solve the issue? I'm afraid if we wait on this for a month to get it merged it will go stale and we just forget. I'd try again and if it fails we wait? If however you really don't want to do it, then fine.

@ambv
Copy link
Contributor

Since we're about to release a1 tonight, I'd wait with landing this until right after a1. We won't forget about it.

@ambv
Copy link
Contributor

Actually,@hugovk should make the call.

@hugovk
Copy link
Member

Yeah, same call, thanks :)

Copy link
Contributor

@rhansenrhansen left a comment

Choose a reason for hiding this comment

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

Apologies for the breakage, and thank you for debugging!

Is a blurb required now that there's an API change between v3.14.0a1 and v3.14.0a2?

Also, would you mind fixing up the commit message, authorship info, etc. on the first commit:

git -c sequence.editor='sed -i -e "1s/^pick/edit/"' rebase -i main&&git commit --amend -C 843d28f59d2&&git rebase --continue

@1st1
Copy link
Member

@ambv@vstinner

Since we're about to release a1 tonight, I'd wait with landing this until right after a1. We won't forget about it.

Oh I was reading the schedule wrong. I didn't realize Victor wants to delay it just one day, essentially, I thought we were talking one month to merge this. Absolutely can wait a few days.

vstinner reacted with thumbs up emoji

@hugovk
Copy link
Member

Thanks, a1 is now out, merge whenever you're ready.

@vstinner
Copy link
Member

I applied@rhansen's change, before that, the test did nothing :-)

Also, would you mind fixing up the commit message, authorship info, etc. on the first commit:

That sounds like a good idea :-) Or at least, make sure that@rhansen is mentioned as a co-author of the change.

@Eclips4
Copy link
MemberAuthor

Apologies for the breakage, and thank you for debugging!

Is a blurb required now that there's an API change between v3.14.0a1 and v3.14.0a2?

Also, would you mind fixing up the commit message, authorship info, etc. on the first commit:

git -c sequence.editor='sed -i -e "1s/^pick/edit/"' rebase -i main&&git commit --amend -C 843d28f59d2&&git rebase --continue

Sorry about that! I definitely will do it.

rhansenand others added3 commitsOctober 16, 2024 13:17
…4776)Users want to know when the current context switches to a differentcontext object.  Right now this happens when and only when a contextis entered or exited, so the enter and exit events are synonymous with"switched".  However, if the changes proposed forpythongh-99633 areimplemented, the current context will also switch for reasons otherthan context enter or exit.  Since users actually care about contextswitches and not enter or exit, replace the enter and exit events witha single switched event.The former exit event was emitted just before exiting the context.The new switched event is emitted after the context is exited to matchthe semantics users expect of an event with a past-tense name.  Ifusers need the ability to clean up before the switch takes effect,another event type can be added in the future.  It is not added herebecause YAGNI.I skipped 0 in the enum as a matter of practice.  Skipping 0 makes iteasier to troubleshoot when code forgets to set zeroed memory, and italigns with best practices for other tools (e.g.,https://protobuf.dev/programming-guides/dos-donts/#unspecified-enum).
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Richard Hansen <rhansen@rhansen.org>
@Eclips4
Copy link
MemberAuthor

Eclips4 commentedOct 16, 2024
edited
Loading

@rhansen it seems I have done it. If you agree, I will merge it.

(I'm actually do not understand why forf0b3aa862b629690496d0336904a9bb1ada6dd47 github is treating me as co-author...)

rhansen reacted with thumbs up emoji

@vstinner
Copy link
Member

(I'm actually do not understand why forf0b3aa8 github is treating me as co-author...)

GitHub is correct when saying:

rhansenauthored and Eclips4committed

Eclips4 reacted with thumbs up emoji

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@ZeroIntensity
Copy link
Member

Should this get tested with the refleak buildbots?

@vstinner
Copy link
Member

Should this get tested with the refleak buildbots?

I don't think so. I tested test_capi manually, and@Eclips4ran the whole test suite with-R 3:3.

ZeroIntensity reacted with thumbs up emoji

@ambvambv merged commitbee112a intopython:mainOct 16, 2024
37 checks passed
@Eclips4Eclips4 deleted the revert-of-revert branchOctober 16, 2024 12:07
ebonnal pushed a commit to ebonnal/cpython that referenced this pull requestJan 12, 2025
…5532)Users want to know when the current context switches to a differentcontext object.  Right now this happens when and only when a contextis entered or exited, so the enter and exit events are synonymous with"switched".  However, if the changes proposed forpythongh-99633 areimplemented, the current context will also switch for reasons otherthan context enter or exit.  Since users actually care about contextswitches and not enter or exit, replace the enter and exit events witha single switched event.The former exit event was emitted just before exiting the context.The new switched event is emitted after the context is exited to matchthe semantics users expect of an event with a past-tense name.  Ifusers need the ability to clean up before the switch takes effect,another event type can be added in the future.  It is not added herebecause YAGNI.I skipped 0 in the enum as a matter of practice.  Skipping 0 makes iteasier to troubleshoot when code forgets to set zeroed memory, and italigns with best practices for other tools (e.g.,https://protobuf.dev/programming-guides/dos-donts/#unspecified-enum).Co-authored-by: Richard Hansen <rhansen@rhansen.org>Co-authored-by: Victor Stinner <vstinner@python.org>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@vstinnervstinnervstinner approved these changes

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrentlyericsnowcurrently is a code owner

@1st11st1Awaiting requested review from 1st11st1 is a code owner

+1 more reviewer

@rhansenrhansenrhansen requested changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@Eclips4@vstinner@1st1@ambv@hugovk@ZeroIntensity@rhansen

[8]ページ先頭

©2009-2025 Movatter.jp