{"action":"opened","number":757,"pull_request":{"url":"https://api.github.com/repos/pythonnet/pythonnet/pulls/757","id":227078183,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI3MDc4MTgz","html_url":"https://github.com/pythonnet/pythonnet/pull/757","diff_url":"https://github.com/pythonnet/pythonnet/pull/757.diff","patch_url":"https://github.com/pythonnet/pythonnet/pull/757.patch","issue_url":"https://api.github.com/repos/pythonnet/pythonnet/issues/757","number":757,"state":"open","locked":false,"title":"Allow user code to register for a callback on shutdown.","user":{"login":"benoithudson","id":15807877,"node_id":"MDQ6VXNlcjE1ODA3ODc3","avatar_url":"https://avatars3.githubusercontent.com/u/15807877?v=4","gravatar_id":"","url":"https://api.github.com/users/benoithudson","html_url":"https://github.com/benoithudson","followers_url":"https://api.github.com/users/benoithudson/followers","following_url":"https://api.github.com/users/benoithudson/following{/other_user}","gists_url":"https://api.github.com/users/benoithudson/gists{/gist_id}","starred_url":"https://api.github.com/users/benoithudson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benoithudson/subscriptions","organizations_url":"https://api.github.com/users/benoithudson/orgs","repos_url":"https://api.github.com/users/benoithudson/repos","events_url":"https://api.github.com/users/benoithudson/events{/privacy}","received_events_url":"https://api.github.com/users/benoithudson/received_events","type":"User","site_admin":false},"body":"### What does this implement/fix? Explain your changes.\r\n\r\nNew feature: allow user code to clean up before python.net shuts down. We use it in a client-server architecture, with python.net on the server and a pyside UI on the client. This callback lets us clean up gracefully.\r\n\r\nI decided to also use the feature in order to help PythonEngine itself set up / shut down correctly, because dog food is tasty. And there's a unit test.\r\n\r\n### Does this close any currently open issues?\r\n\r\nNot on pythonnet.\r\n\r\n### Any other comments?\r\n\r\nI'm not clear on the division of labour between PythonEngine and Runtime. User code tells the PythonEngine to initialize, not the runtime, so that seemed the place to put the shutdown handler.\r\n\r\nBut it could just as well be in the runtime, and the runtime also needs the same pattern of building up / tearing down in the opposite order. User code could still think it's PythonEngine handling it (just make PythonEngine.AddShutdownHandler call Runtime.AddShutdownHandler).\r\n\r\nThoughts?\r\n\r\n### Checklist\r\n\r\nCheck all those that are applicable and complete.\r\n\r\n-   [x] Make sure to include one or more tests for your change\r\n-   [ ] If an enhancement PR, please create docs and at best an example\r\n===> where? On the wiki?\r\n-   [x] Add yourself to [`AUTHORS`](../blob/master/AUTHORS.md)\r\n-   [x] Updated the [`CHANGELOG`](../blob/master/CHANGELOG.md)\r\n","created_at":"2018-10-30T20:55:16Z","updated_at":"2018-10-30T20:55:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pythonnet/pythonnet/pulls/757/commits","review_comments_url":"https://api.github.com/repos/pythonnet/pythonnet/pulls/757/comments","review_comment_url":"https://api.github.com/repos/pythonnet/pythonnet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pythonnet/pythonnet/issues/757/comments","statuses_url":"https://api.github.com/repos/pythonnet/pythonnet/statuses/7e2fcd46a4103b3213b7c2b36212f01cbcf28245","head":{"label":"Unity-Technologies:custom-shutdown","ref":"custom-shutdown","sha":"7e2fcd46a4103b3213b7c2b36212f01cbcf28245","user":{"login":"Unity-Technologies","id":426196,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQyNjE5Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/426196?v=4","gravatar_id":"","url":"https://api.github.com/users/Unity-Technologies","html_url":"https://github.com/Unity-Technologies","followers_url":"https://api.github.com/users/Unity-Technologies/followers","following_url":"https://api.github.com/users/Unity-Technologies/following{/other_user}","gists_url":"https://api.github.com/users/Unity-Technologies/gists{/gist_id}","starred_url":"https://api.github.com/users/Unity-Technologies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unity-Technologies/subscriptions","organizations_url":"https://api.github.com/users/Unity-Technologies/orgs","repos_url":"https://api.github.com/users/Unity-Technologies/repos","events_url":"https://api.github.com/users/Unity-Technologies/events{/privacy}","received_events_url":"https://api.github.com/users/Unity-Technologies/received_events","type":"Organization","site_admin":false},"repo":{"id":139746984,"node_id":"MDEwOlJlcG9zaXRvcnkxMzk3NDY5ODQ=","name":"pythonnet","full_name":"Unity-Technologies/pythonnet","private":false,"owner":{"login":"Unity-Technologies","id":426196,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQyNjE5Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/426196?v=4","gravatar_id":"","url":"https://api.github.com/users/Unity-Technologies","html_url":"https://github.com/Unity-Technologies","followers_url":"https://api.github.com/users/Unity-Technologies/followers","following_url":"https://api.github.com/users/Unity-Technologies/following{/other_user}","gists_url":"https://api.github.com/users/Unity-Technologies/gists{/gist_id}","starred_url":"https://api.github.com/users/Unity-Technologies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unity-Technologies/subscriptions","organizations_url":"https://api.github.com/users/Unity-Technologies/orgs","repos_url":"https://api.github.com/users/Unity-Technologies/repos","events_url":"https://api.github.com/users/Unity-Technologies/events{/privacy}","received_events_url":"https://api.github.com/users/Unity-Technologies/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Unity-Technologies/pythonnet","description":"Python for .NET is a package that gives Python programmers nearly seamless integration with the .NET Common Language Runtime (CLR) and provides a powerful application scripting tool for .NET developers.","fork":true,"url":"https://api.github.com/repos/Unity-Technologies/pythonnet","forks_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/forks","keys_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/teams","hooks_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/hooks","issue_events_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/issues/events{/number}","events_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/events","assignees_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/assignees{/user}","branches_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/branches{/branch}","tags_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/tags","blobs_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/statuses/{sha}","languages_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/languages","stargazers_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/stargazers","contributors_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/contributors","subscribers_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/subscribers","subscription_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/subscription","commits_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/contents/{+path}","compare_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/merges","archive_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/downloads","issues_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/issues{/number}","pulls_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/pulls{/number}","milestones_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/milestones{/number}","notifications_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/labels{/name}","releases_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/releases{/id}","deployments_url":"https://api.github.com/repos/Unity-Technologies/pythonnet/deployments","created_at":"2018-07-04T16:49:50Z","updated_at":"2018-10-30T20:18:59Z","pushed_at":"2018-10-30T20:33:24Z","git_url":"git://github.com/Unity-Technologies/pythonnet.git","ssh_url":"git@github.com:Unity-Technologies/pythonnet.git","clone_url":"https://github.com/Unity-Technologies/pythonnet.git","svn_url":"https://github.com/Unity-Technologies/pythonnet","homepage":"http://pythonnet.github.io","size":6503,"stargazers_count":26,"watchers_count":26,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":5,"open_issues":0,"watchers":26,"default_branch":"dev"}},"base":{"label":"pythonnet:master","ref":"master","sha":"2857071a4bd68a3e52347dd3a3cc1fca373a4771","user":{"login":"pythonnet","id":6050430,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYwNTA0MzA=","avatar_url":"https://avatars2.githubusercontent.com/u/6050430?v=4","gravatar_id":"","url":"https://api.github.com/users/pythonnet","html_url":"https://github.com/pythonnet","followers_url":"https://api.github.com/users/pythonnet/followers","following_url":"https://api.github.com/users/pythonnet/following{/other_user}","gists_url":"https://api.github.com/users/pythonnet/gists{/gist_id}","starred_url":"https://api.github.com/users/pythonnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pythonnet/subscriptions","organizations_url":"https://api.github.com/users/pythonnet/orgs","repos_url":"https://api.github.com/users/pythonnet/repos","events_url":"https://api.github.com/users/pythonnet/events{/privacy}","received_events_url":"https://api.github.com/users/pythonnet/received_events","type":"Organization","site_admin":false},"repo":{"id":14748123,"node_id":"MDEwOlJlcG9zaXRvcnkxNDc0ODEyMw==","name":"pythonnet","full_name":"pythonnet/pythonnet","private":false,"owner":{"login":"pythonnet","id":6050430,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYwNTA0MzA=","avatar_url":"https://avatars2.githubusercontent.com/u/6050430?v=4","gravatar_id":"","url":"https://api.github.com/users/pythonnet","html_url":"https://github.com/pythonnet","followers_url":"https://api.github.com/users/pythonnet/followers","following_url":"https://api.github.com/users/pythonnet/following{/other_user}","gists_url":"https://api.github.com/users/pythonnet/gists{/gist_id}","starred_url":"https://api.github.com/users/pythonnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pythonnet/subscriptions","organizations_url":"https://api.github.com/users/pythonnet/orgs","repos_url":"https://api.github.com/users/pythonnet/repos","events_url":"https://api.github.com/users/pythonnet/events{/privacy}","received_events_url":"https://api.github.com/users/pythonnet/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/pythonnet/pythonnet","description":"Python for .NET is a package that gives Python programmers nearly seamless integration with the .NET Common Language Runtime (CLR) and provides a powerful application scripting tool for .NET developers.","fork":false,"url":"https://api.github.com/repos/pythonnet/pythonnet","forks_url":"https://api.github.com/repos/pythonnet/pythonnet/forks","keys_url":"https://api.github.com/repos/pythonnet/pythonnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pythonnet/pythonnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pythonnet/pythonnet/teams","hooks_url":"https://api.github.com/repos/pythonnet/pythonnet/hooks","issue_events_url":"https://api.github.com/repos/pythonnet/pythonnet/issues/events{/number}","events_url":"https://api.github.com/repos/pythonnet/pythonnet/events","assignees_url":"https://api.github.com/repos/pythonnet/pythonnet/assignees{/user}","branches_url":"https://api.github.com/repos/pythonnet/pythonnet/branches{/branch}","tags_url":"https://api.github.com/repos/pythonnet/pythonnet/tags","blobs_url":"https://api.github.com/repos/pythonnet/pythonnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pythonnet/pythonnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pythonnet/pythonnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/pythonnet/pythonnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pythonnet/pythonnet/statuses/{sha}","languages_url":"https://api.github.com/repos/pythonnet/pythonnet/languages","stargazers_url":"https://api.github.com/repos/pythonnet/pythonnet/stargazers","contributors_url":"https://api.github.com/repos/pythonnet/pythonnet/contributors","subscribers_url":"https://api.github.com/repos/pythonnet/pythonnet/subscribers","subscription_url":"https://api.github.com/repos/pythonnet/pythonnet/subscription","commits_url":"https://api.github.com/repos/pythonnet/pythonnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/pythonnet/pythonnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/pythonnet/pythonnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/pythonnet/pythonnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/pythonnet/pythonnet/contents/{+path}","compare_url":"https://api.github.com/repos/pythonnet/pythonnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pythonnet/pythonnet/merges","archive_url":"https://api.github.com/repos/pythonnet/pythonnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pythonnet/pythonnet/downloads","issues_url":"https://api.github.com/repos/pythonnet/pythonnet/issues{/number}","pulls_url":"https://api.github.com/repos/pythonnet/pythonnet/pulls{/number}","milestones_url":"https://api.github.com/repos/pythonnet/pythonnet/milestones{/number}","notifications_url":"https://api.github.com/repos/pythonnet/pythonnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pythonnet/pythonnet/labels{/name}","releases_url":"https://api.github.com/repos/pythonnet/pythonnet/releases{/id}","deployments_url":"https://api.github.com/repos/pythonnet/pythonnet/deployments","created_at":"2013-11-27T13:42:20Z","updated_at":"2018-10-30T17:27:08Z","pushed_at":"2018-10-29T14:32:43Z","git_url":"git://github.com/pythonnet/pythonnet.git","ssh_url":"git@github.com:pythonnet/pythonnet.git","clone_url":"https://github.com/pythonnet/pythonnet.git","svn_url":"https://github.com/pythonnet/pythonnet","homepage":"http://pythonnet.github.io","size":7754,"stargazers_count":1312,"watchers_count":1312,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":239,"mirror_url":null,"archived":false,"open_issues_count":166,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":239,"open_issues":166,"watchers":1312,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pythonnet/pythonnet/pulls/757"},"html":{"href":"https://github.com/pythonnet/pythonnet/pull/757"},"issue":{"href":"https://api.github.com/repos/pythonnet/pythonnet/issues/757"},"comments":{"href":"https://api.github.com/repos/pythonnet/pythonnet/issues/757/comments"},"review_comments":{"href":"https://api.github.com/repos/pythonnet/pythonnet/pulls/757/comments"},"review_comment":{"href":"https://api.github.com/repos/pythonnet/pythonnet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pythonnet/pythonnet/pulls/757/commits"},"statuses":{"href":"https://api.github.com/repos/pythonnet/pythonnet/statuses/7e2fcd46a4103b3213b7c2b36212f01cbcf28245"}},"author_association":"NONE","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":2,"additions":141,"deletions":7,"changed_files":3}}
{"actor":{"display_login":"benoithudson"}}