René's URL Explorer Experiment


Title: Enable pythonnet to survive in the Unity3d editor environment. by benoithudson · Pull Request #752 · pythonnet/pythonnet · GitHub

Open Graph Title: Enable pythonnet to survive in the Unity3d editor environment. by benoithudson · Pull Request #752 · pythonnet/pythonnet

X Title: Enable pythonnet to survive in the Unity3d editor environment. by benoithudson · Pull Request #752 · pythonnet/pythonnet

Description: The Unity editor unloads the C# domain and creates a new domain every time it recompiles C# sources. This caused two crashes. After a domain unload, python is now pointing to a bunch of objects whose C# side is now garbage. Solution: Shutdown() the engine on domain reload, which calls Py_Finalize. After a domain unload, Py_Finalize, and a new Py_Intialize, python still keeps pointers in gc for any python objects that were leaked. And pythonnet leaks. This means that python's gc will be calling tp_traverse, tp_clear, and tp_is_gc on types that are implemented in C#. This crashes because the implementation was freed. Solution: implement those calls in code that is not released on domain unload. Side effect: we leak a page on every domain unload. I suspect but didn't test that python gc performance will be slightly faster. Changes required to implement and test: 3. Use python's platform package to determine what we're running on, so we can use the right mmap/mprotect or VirtualAlloc/VirtualProtect routines, the right flags for mmap, and (theoretically) the right native code. Side effect: to port to a new platform requires updating some additional code now. New unit tests. (a) A new test for domain reload. It doesn't run under .NET Core because you can't create and unload a domain in .NET Core. (b) New unit tests to help us find where to add support for new platforms. Does this close any currently open issues? #714 ; see also #745 and #751.

Open Graph Description: The Unity editor unloads the C# domain and creates a new domain every time it recompiles C# sources. This caused two crashes. After a domain unload, python is now pointing to a bunch of objects w...

X Description: The Unity editor unloads the C# domain and creates a new domain every time it recompiles C# sources. This caused two crashes. After a domain unload, python is now pointing to a bunch of objects w...

Opengraph URL: https://github.com/pythonnet/pythonnet/pull/752

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:582215b8-7315-ebd9-0e0e-617384b7768f
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idBB62:3E883C:2C41C4:3A7346:6972DBE5
html-safe-noncefa6e8844ce6862123d5c087388ad1cd25200174b11e67129e0853ef85bd7ac87
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQjYyOjNFODgzQzoyQzQxQzQ6M0E3MzQ2OjY5NzJEQkU1IiwidmlzaXRvcl9pZCI6IjExMzk4ODI4NDAzNjM4MTc5NTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac6130cb13161a2e251327362c08f1e7dc58abd1fe312f48b90d04a88f488b992c
hovercard-subject-tagpull_request:222575536
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/pythonnet/pythonnet/pull/752/files
twitter:imagehttps://avatars.githubusercontent.com/u/15807877?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/15807877?s=400&v=4
og:image:altThe Unity editor unloads the C# domain and creates a new domain every time it recompiles C# sources. This caused two crashes. After a domain unload, python is now pointing to a bunch of objects w...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None0b28c359b13f980b4fbede8da4d68e72b8e69a4837e7a70f5b5bd33f08875133
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git
octolytics-dimension-user_id6050430
octolytics-dimension-user_loginpythonnet
octolytics-dimension-repository_id14748123
octolytics-dimension-repository_nwopythonnet/pythonnet
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id14748123
octolytics-dimension-repository_network_root_nwopythonnet/pythonnet
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee59d75213c810b4a9ea72ce3aa89d45f5b2feb48
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/pythonnet/pythonnet/pull/752/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpythonnet%2Fpythonnet%2Fpull%2F752%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpythonnet%2Fpythonnet%2Fpull%2F752%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=pythonnet%2Fpythonnet
Reloadhttps://github.com/pythonnet/pythonnet/pull/752/files
Reloadhttps://github.com/pythonnet/pythonnet/pull/752/files
Reloadhttps://github.com/pythonnet/pythonnet/pull/752/files
pythonnet https://github.com/pythonnet
pythonnethttps://github.com/pythonnet/pythonnet
Notifications https://github.com/login?return_to=%2Fpythonnet%2Fpythonnet
Fork 769 https://github.com/login?return_to=%2Fpythonnet%2Fpythonnet
Star 5.4k https://github.com/login?return_to=%2Fpythonnet%2Fpythonnet
Code https://github.com/pythonnet/pythonnet
Issues 155 https://github.com/pythonnet/pythonnet/issues
Pull requests 18 https://github.com/pythonnet/pythonnet/pulls
Discussions https://github.com/pythonnet/pythonnet/discussions
Actions https://github.com/pythonnet/pythonnet/actions
Projects 0 https://github.com/pythonnet/pythonnet/projects
Wiki https://github.com/pythonnet/pythonnet/wiki
Security 0 https://github.com/pythonnet/pythonnet/security
Insights https://github.com/pythonnet/pythonnet/pulse
Code https://github.com/pythonnet/pythonnet
Issues https://github.com/pythonnet/pythonnet/issues
Pull requests https://github.com/pythonnet/pythonnet/pulls
Discussions https://github.com/pythonnet/pythonnet/discussions
Actions https://github.com/pythonnet/pythonnet/actions
Projects https://github.com/pythonnet/pythonnet/projects
Wiki https://github.com/pythonnet/pythonnet/wiki
Security https://github.com/pythonnet/pythonnet/security
Insights https://github.com/pythonnet/pythonnet/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpythonnet%2Fpythonnet%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpythonnet%2Fpythonnet%2Fissues%2Fnew%2Fchoose
filmorhttps://github.com/filmor
pythonnet:masterhttps://github.com/pythonnet/pythonnet/tree/master
Unity-Technologies:fix-domain-unloadhttps://github.com/Unity-Technologies/pythonnet/tree/fix-domain-unload
Conversation 16 https://github.com/pythonnet/pythonnet/pull/752
Commits 3 https://github.com/pythonnet/pythonnet/pull/752/commits
Checks 0 https://github.com/pythonnet/pythonnet/pull/752/checks
Files changed https://github.com/pythonnet/pythonnet/pull/752/files
Please reload this pagehttps://github.com/pythonnet/pythonnet/pull/752/files
Enable pythonnet to survive in the Unity3d editor environment. https://github.com/pythonnet/pythonnet/pull/752/files#top
Show all changes 3 commits https://github.com/pythonnet/pythonnet/pull/752/files
02efcdf Enable pythonnet to survive in the Unity3d editor environment. Oct 12, 2018 https://github.com/pythonnet/pythonnet/pull/752/commits/02efcdf86423c004a8f87357cc6465bc161e57cb
7222a2c Merge branch 'master' into fix-domain-unload filmor Oct 16, 2018 https://github.com/pythonnet/pythonnet/pull/752/commits/7222a2c366dd30c8a70fd82dbdafe8a07dffe8a8
072022b Merge branch 'master' into fix-domain-unload den-run-ai Oct 18, 2018 https://github.com/pythonnet/pythonnet/pull/752/commits/072022b1e9c024ef8476cc8178bc49688cfd59d1
Clear filters https://github.com/pythonnet/pythonnet/pull/752/files
Please reload this pagehttps://github.com/pythonnet/pythonnet/pull/752/files
Please reload this pagehttps://github.com/pythonnet/pythonnet/pull/752/files
AUTHORS.md https://github.com/pythonnet/pythonnet/pull/752/files#diff-784f358cf224418379ac8bdb1eed7279ca2c499e0fadc292f8ab65dcafe3f7e8
CHANGELOG.md https://github.com/pythonnet/pythonnet/pull/752/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
Python.EmbeddingTest.15.csproj https://github.com/pythonnet/pythonnet/pull/752/files#diff-c13742478d2933fafd00772ed070b9be492b98325996db2606f0c514909f0895
Python.EmbeddingTest.csproj https://github.com/pythonnet/pythonnet/pull/752/files#diff-6bfe85b2afa32799eb0008c63c2ab5372012dba8bf12ffb8c3441fafc57d5ac7
TestDomainReload.cs https://github.com/pythonnet/pythonnet/pull/752/files#diff-bcaca7eb88b9a4ae8e809aa8855c0d4e5b3890a304bf50c6499ac582833e86bf
TestRuntime.cs https://github.com/pythonnet/pythonnet/pull/752/files#diff-481dec5bd87d04829c8b41f2bf1b38bee0a3d62be8e7a84feebaa5ec724ce708
TestTypeManager.cs https://github.com/pythonnet/pythonnet/pull/752/files#diff-da693323034e773b8415718f14ad5259899e9ac5b9f16b9c02ecfea8a5d126b6
dynamic.cs https://github.com/pythonnet/pythonnet/pull/752/files#diff-26c7568c5663bb2b87402204804220a4f2e62643e1400c6bc7f7ad9354610068
classbase.cs https://github.com/pythonnet/pythonnet/pull/752/files#diff-32bee523619b42a59c7c60132a7d605f738b74bf85b7288552d57b6dd03c96d0
extensiontype.cs https://github.com/pythonnet/pythonnet/pull/752/files#diff-2a9d3fd3e4e705e1c1b1e857853601dcdf823ef2e658c772e5c5dd2712af2a9c
pythonengine.cs https://github.com/pythonnet/pythonnet/pull/752/files#diff-59c1255540fe4fce6bd6d1f2b5b31ced7b9baacc387b3d07cb08e9444bcd82aa
runtime.cs https://github.com/pythonnet/pythonnet/pull/752/files#diff-f1749bdd9f64fdac5c64d5cb0982ce1dac5e2d9a2cdd55b93d3f83b5047a855d
typemanager.cs https://github.com/pythonnet/pythonnet/pull/752/files#diff-64b3221887c395ea436fe9433800e73c0854e42d78cd7108c320e5d41d20ab64
AUTHORS.mdhttps://github.com/pythonnet/pythonnet/pull/752/files#diff-784f358cf224418379ac8bdb1eed7279ca2c499e0fadc292f8ab65dcafe3f7e8
View file https://github.com/Unity-Technologies/pythonnet/blob/072022b1e9c024ef8476cc8178bc49688cfd59d1/AUTHORS.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/pythonnet/pythonnet/pull/752/{{ revealButtonHref }}
https://github.com/pythonnet/pythonnet/pull/752/files#diff-784f358cf224418379ac8bdb1eed7279ca2c499e0fadc292f8ab65dcafe3f7e8
https://github.com/pythonnet/pythonnet/pull/752/files#diff-784f358cf224418379ac8bdb1eed7279ca2c499e0fadc292f8ab65dcafe3f7e8
https://github.com/pythonnet/pythonnet/pull/752/files#diff-784f358cf224418379ac8bdb1eed7279ca2c499e0fadc292f8ab65dcafe3f7e8
https://github.com/pythonnet/pythonnet/pull/752/files#diff-784f358cf224418379ac8bdb1eed7279ca2c499e0fadc292f8ab65dcafe3f7e8
CHANGELOG.mdhttps://github.com/pythonnet/pythonnet/pull/752/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
View file https://github.com/Unity-Technologies/pythonnet/blob/072022b1e9c024ef8476cc8178bc49688cfd59d1/CHANGELOG.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/pythonnet/pythonnet/pull/752/{{ revealButtonHref }}
https://github.com/pythonnet/pythonnet/pull/752/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
https://github.com/pythonnet/pythonnet/pull/752/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
src/embed_tests/Python.EmbeddingTest.15.csprojhttps://github.com/pythonnet/pythonnet/pull/752/files#diff-c13742478d2933fafd00772ed070b9be492b98325996db2606f0c514909f0895
View file https://github.com/Unity-Technologies/pythonnet/blob/072022b1e9c024ef8476cc8178bc49688cfd59d1/src/embed_tests/Python.EmbeddingTest.15.csproj
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/pythonnet/pythonnet/pull/752/{{ revealButtonHref }}
https://github.com/pythonnet/pythonnet/pull/752/files#diff-c13742478d2933fafd00772ed070b9be492b98325996db2606f0c514909f0895
https://github.com/pythonnet/pythonnet/pull/752/files#diff-c13742478d2933fafd00772ed070b9be492b98325996db2606f0c514909f0895
src/embed_tests/Python.EmbeddingTest.csprojhttps://github.com/pythonnet/pythonnet/pull/752/files#diff-6bfe85b2afa32799eb0008c63c2ab5372012dba8bf12ffb8c3441fafc57d5ac7
View file https://github.com/Unity-Technologies/pythonnet/blob/072022b1e9c024ef8476cc8178bc49688cfd59d1/src/embed_tests/Python.EmbeddingTest.csproj
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/pythonnet/pythonnet/pull/752/{{ revealButtonHref }}
https://github.com/pythonnet/pythonnet/pull/752/files#diff-6bfe85b2afa32799eb0008c63c2ab5372012dba8bf12ffb8c3441fafc57d5ac7
https://github.com/pythonnet/pythonnet/pull/752/files#diff-6bfe85b2afa32799eb0008c63c2ab5372012dba8bf12ffb8c3441fafc57d5ac7
https://github.com/pythonnet/pythonnet/pull/752/files#diff-6bfe85b2afa32799eb0008c63c2ab5372012dba8bf12ffb8c3441fafc57d5ac7
src/embed_tests/TestDomainReload.cshttps://github.com/pythonnet/pythonnet/pull/752/files#diff-bcaca7eb88b9a4ae8e809aa8855c0d4e5b3890a304bf50c6499ac582833e86bf
View file https://github.com/Unity-Technologies/pythonnet/blob/072022b1e9c024ef8476cc8178bc49688cfd59d1/src/embed_tests/TestDomainReload.cs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/pythonnet/pythonnet/pull/752/{{ revealButtonHref }}
src/embed_tests/TestRuntime.cshttps://github.com/pythonnet/pythonnet/pull/752/files#diff-481dec5bd87d04829c8b41f2bf1b38bee0a3d62be8e7a84feebaa5ec724ce708
View file https://github.com/Unity-Technologies/pythonnet/blob/072022b1e9c024ef8476cc8178bc49688cfd59d1/src/embed_tests/TestRuntime.cs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/pythonnet/pythonnet/pull/752/{{ revealButtonHref }}
https://github.com/pythonnet/pythonnet/pull/752/files#diff-481dec5bd87d04829c8b41f2bf1b38bee0a3d62be8e7a84feebaa5ec724ce708
https://github.com/pythonnet/pythonnet/pull/752/files#diff-481dec5bd87d04829c8b41f2bf1b38bee0a3d62be8e7a84feebaa5ec724ce708
src/embed_tests/TestTypeManager.cshttps://github.com/pythonnet/pythonnet/pull/752/files#diff-da693323034e773b8415718f14ad5259899e9ac5b9f16b9c02ecfea8a5d126b6
View file https://github.com/Unity-Technologies/pythonnet/blob/072022b1e9c024ef8476cc8178bc49688cfd59d1/src/embed_tests/TestTypeManager.cs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/pythonnet/pythonnet/pull/752/{{ revealButtonHref }}
Please reload this pagehttps://github.com/pythonnet/pythonnet/pull/752/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.