Drop LoadLibrary by amos402 · Pull Request #880 · pythonnet/pythonnet
Repository navigation
Drop LoadLibrary - #880
Closed
amos402 wants to merge 14 commits into pythonnet:master from amos402:drop-dlopen
Closed
Drop LoadLibrary #880 amos402 wants to merge 14 commits into pythonnet:master from amos402:drop-dlopen
Conversation
amos402 commented Jun 13, 2019 · edited Loading
Copy link Copy Markdown
Member
What does this implement/fix? Explain your changes.
There are some limitations to dynamic load a library on some systems(e. g. Android).
LoadLibrary just called for once for getting the _PyObject_NextNotImplemented,
we can use another ways to get this function.
Does this close any currently open issues?
No
Any other comments?
Checklist
Check all those that are applicable and complete.
- Make sure to include one or more tests for your change
- If an enhancement PR, please create docs and at best an example
- Add yourself to
AUTHORS - Updated the
CHANGELOG
Drop LoadLibrary dependency
d1928dc
Explain for getting _PyObject_NextNotImplemented
f000e08
Update changelog and authors
f882400
filmor commented Jun 13, 2019
Copy link Copy Markdown
Member
|
I'll have to look a bit more into this. I thought that this |
lostmsu commented Jun 13, 2019
Copy link Copy Markdown
Member
|
@filmor @amos402 I made a single Python.Runtime.dll to work with any Python 3.x interpreter in my fork (could have included 2.x, but its lifetime is ending) via extensive use of |
filmor commented Jun 13, 2019
Copy link Copy Markdown
Member
|
@lostmsu What do you mean by "extensive use"? Isn't it enough to load libpython*.so once at startup? Could you point me to that code? |
lostmsu commented Jun 13, 2019 · edited Loading
Copy link Copy Markdown
Member
|
@filmor well, the And also losttech@ 80aa07f All of that happens once at startup too. But there are many functions. There is probably a performance impact too, due to the use of delegates in place of PInvoke calls. |
Merge branch 'master' into drop-dlopen
b7715ee
Merge remote-tracking branch 'remotes/upstream/master' into drop-dlopen
41ac665
Merge branch 'master' into drop-dlopen
c6dae9e
filmor commented Sep 12, 2019
Copy link Copy Markdown
Member
|
@lostmsu What's your conclusion on keeping |
View reviewed changes
Comment thread src/runtime/runtime.cs
Outdated
| @@ -297,16 +297,20 @@ internal static void Initialize(bool initSigs = false) | ||
| IntPtr dllLocal = IntPtr.Zero; | ||
| var loader = LibraryLoader.Get(OperatingSystem); |
View reviewed changes
benoithudson left a comment
Copy link Copy Markdown
Contributor
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more .
This seems a quite reasonable patch, I think we should merge it.
I've had trouble in the past with this LoadLibrary/FreeLibrary screwing up the dlopen flags.
Merge branch 'master' into drop-dlopen
653a263
amos402
force-pushed
the
drop-dlopen
branch
from
4d9c632 to
18d8da4
Compare
December 1, 2019 13:35
* Load PyModuleType without LibraryLoader
b3e889b
* Drop C module dependency when getting _PyObject_NextNotImplemented * Exception details for SetNoSiteFlagamos402 force-pushed the drop-dlopen branch from
18d8da4 to
b3e889b
Compare
December 1, 2019 13:40
codecov-io commented Dec 1, 2019 · edited Loading
Copy link Copy Markdown
Codecov Report
@@ Coverage Diff @@ ## master #880 +/- ## ======================================= Coverage 86.71% 86.71% ======================================= Files 1 1 Lines 301 301 ======================================= Hits 261 261 Misses 40 40
Continue to review full report at Codecov .
|
amos402 commented Dec 1, 2019
Copy link Copy Markdown
Member
Author
|
I removed the dependency of |
View reviewed changes
Comment thread src/runtime/runtime.cs
Outdated
| if (dllLocal == IntPtr.Zero) | ||
| { | ||
| dllLocal = loader.Load( _PythonDll); | ||
| throw new Exception($"Cannot load { _PythonDll }" ); |
Outdated
| private static IntPtr Get_PyObject_NextNotImplemented() | ||
| { | ||
| IntPtr globals = PyDict_New(); | ||
| if (PyDict_SetItemString(globals, "__builtins__", PyEval_GetBuiltins()) != 0) |
Outdated
Comment on lines +335 to +336
| XDecref(globals); | ||
| throw new PythonException(); |
Runtime.InitializePlatformData
#891
Closed
amos402
added 2 commits
December 15, 2019 02:26
Merge remote-tracking branch 'remotes/upstream/master' into drop-dlop...
04d6dfb
...en-2
Prevent exception override
5150e61
filmor
reviewed
Dec 15, 2019
View reviewed changes
Comment thread src/runtime/runtime.cs
Outdated
| { | ||
| if (_PythonDll == "__Internal") | ||
| { | ||
| throw new NotSupportedException("SetNoSiteFlag didn't support on static compile"); |
Rollback symbol loading for __Internal
65e209e
Jeff17Robbins commented Dec 15, 2019
Copy link Copy Markdown
Contributor
|
I believe issues #891 , #946 , and #967 all point to a fundamental problem with this PR. On certain Linux distributions (Debian for example), Python C extension libraries are deliberately not linked to Yet .NET Core's So if this PR removes As Victor Stinner put it in Python issue issue 21536 :
Unless we can get |
Merge branch 'master' into drop-dlopen
431d644
* Fix refcnt error
2b84394
* Pick `SlotHelper` from pythonnet#958
Merge 'master' into drop-dlopen
b7797d3
amos402 commented Feb 13, 2020
Copy link Copy Markdown
Member
Author
|
@Jeff17Robbins This PR won't break "Embedding" mode on .NET Core, moreover it improve the compatibility since it didn't need call the |
amos402 commented Oct 9, 2020
Copy link Copy Markdown
Member
Author
|
Contained in #958 |