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

RemovedShutdownMode. Now always behaves like originalReload#1638

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
lostmsu merged 4 commits intopythonnet:masterfromlosttech:cleanup/ShutdownModes
Dec 25, 2021

Conversation

lostmsu
Copy link
Member

What does this implement/fix? Explain your changes.

This removes all shutdown modes, exceptReload (which you don't need to specify, because it is the only one left).

This means Python C runtime is never actually shut down when .NET callsPythonEngine.Shutdown(). Instead, anything from .NET exposed to Python beforeShutdown becomes unavailable untilPythonEngine.Initialize() is called again (which can be done from a differentAppDomain).

Any other comments?

Also in this change:

  • dropped Python 3.6 support
  • fixed Python derived types not being decrefed when an instance is deallocated
  • reduced time and amount of storage needed for runtime reload
  • removed circular reference loop between Type <->ConstructorBinding(s)
  • exposedRuntime.TryCollectingGarbage

A review from@amos402 would be welcome

PACE100 reacted with thumbs up emoji
@lostmsulostmsuforce-pushed thecleanup/ShutdownModes branch 3 times, most recently from7ff467a to7ab2bfcCompareDecember 20, 2021 21:11
@lostmsu
Copy link
MemberAuthor

@filmor looks like I got tests to pass, so this is ready.

@lostmsulostmsu marked this pull request as ready for reviewDecember 20, 2021 23:39
@lostmsulostmsu added this to the3.0.0 milestoneDec 21, 2021
@lostmsulostmsuforce-pushed thecleanup/ShutdownModes branch 2 times, most recently from3157cf5 to5113257CompareDecember 21, 2021 07:14
}
else
{
ResetPyMembers();
if (mode != ShutdownMode.Extension)
{
Py_Finalize();
Copy link
Member

Choose a reason for hiding this comment

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

This is my only real gripe with this: Embedders would not be able to finalise the Python runtime at all anymore. Maybe we should provide this (Shutdown() +Py_Finalize()) as a possible footgun with a long name?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

We can always add it if there is a strong request. Instead what happened is people opening bugs about crashes after restarting runtime because NumPy does not support it. I'd rather avoid it.

Moreover, the behavior of the whole thing when either of runtimes is shut down completely is pretty much undefined.

@lostmsulostmsuforce-pushed thecleanup/ShutdownModes branch 2 times, most recently from8081238 to8a093c2CompareDecember 21, 2021 17:41
… is an equivalent of `ShutdownMode.Reload`also in this change:- fixed Python derived types not being decrefed when an instance is deallocated- reduced time and amount of storage needed for runtime reload- removed circular reference loop between Type <-> ConstructorBinding(s)+ exposed Runtime.TryCollectingGarbage
clearing GCHandle from an instance of Python derived type would drop the last reference to it, so it was destroyed without being removed from reflectedObjects collection
@lostmsu
Copy link
MemberAuthor

@filmor I am waiting for an explicit approval or more comments

@lostmsulostmsu merged commitec8b69f intopythonnet:masterDec 25, 2021
@lostmsulostmsu deleted the cleanup/ShutdownModes branchDecember 25, 2021 18:22
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@filmorfilmorfilmor approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
3.0.0
Development

Successfully merging this pull request may close these issues.

2 participants
@lostmsu@filmor

[8]ページ先頭

©2009-2025 Movatter.jp