8000 Drop LoadLibrary by amos402 · Pull Request #880 · pythonnet/pythonnet · GitHub
[go: up one dir, main page]

Skip to content

Drop LoadLibrary #880

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
- William Sardar ([@williamsardar])(https://github.com/williamsardar)
- Xavier Dupré ([@sdpython](https://github.com/sdpython))
- Zane Purvis ([@zanedp](https://github.com/zanedp))
- ([@amos402]https://github.com/amos402)
- ([@bltribble](https://github.com/bltribble))
- ([@civilx64](https://github.com/civilx64))
- ([@GSPP](https://github.com/GSPP))
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
- PythonEngine.Intialize will now call `Py_InitializeEx` with a default value of 0, so signals will not be configured by default on embedding. This is different from the previous behaviour, where `Py_Initialize` was called instead, which sets initSigs to 1. ([#449][i449])
- Refactored MethodBinder.Bind in preparation to make it extensible (#829)
- Look for installed Windows 10 sdk's during installation instead of relying on specific versions.
- Remove `LoadLibrary` call. ([#880][p880])

### Fixed

Expand All @@ -60,7 +61,7 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
- Fixed conversion of 'float' and 'double' values ([#486][i486])
- Fixed 'clrmethod' for python 2 ([#492][i492])
- Fixed double calling of constructor when deriving from .NET class ([#495][i495])
- Fixed `clr.GetClrType` when iterating over `System` members ([#607][p607])
- Fixed `clr.GetClrType` when iterating over `System` members ([#607][p607])
- Fixed `LockRecursionException` when loading assemblies ([#627][i627])
- Fixed errors breaking .NET Remoting on method invoke ([#276][i276])
- Fixed PyObject.GetHashCode ([#676][i676])
Expand Down
22 changes: 13 additions & 9 deletions src/runtime/runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,16 +297,20 @@ internal static void Initialize(bool initSigs = false)
IntPtr dllLocal = IntPtr.Zero;
var loader = LibraryLoader.Get(OperatingSystem);
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like you should delete these lines too, and line 295 as well since you moved it below.


if (_PythonDll != "__Internal")
{
dllLocal = loader.Load(_PythonDll);
}
_PyObject_NextNotImplemented = loader.GetFunction(dllLocal, "_PyObject_NextNotImplemented");
// Since `_PyObject_NextNotImplemented` would set to a heap class
// for tp_iternext which doesn't implement __next__.
// Thus we need a heap class to get it, the ZipImportError is a
// heap class and it's in builtins, so we can use it as a trick.
var zipimport = PyImport_ImportModule("zipimport");
var ZipImportError = PyObject_GetAttrString(zipimport, "ZipImportError");
_PyObject_NextNotImplemented = Marshal.ReadIntPtr(ZipImportError, TypeOffset.tp_iternext);
XDecref(ZipImportError);
XDecref(zipimport);

if (dllLocal != IntPtr.Zero)
{
loader.Free(dllLocal);
}
// Initialize data about the platform we're running on. We need
// this for the type manager and potentially other details. Must
// happen after caching the python types, above.
InitializePlatformData();

// Initialize modules that depend on the runtime class.
AssemblyManager.Initialize();
Expand Down
0