8000 Bug in runtime.cs Runtime.Initialize() method. · Issue #445 · pythonnet/pythonnet · GitHub
[go: up one dir, main page]

Skip to content
Bug in runtime.cs Runtime.Initialize() method. #445
Closed
@dmitriyse

Description

@dmitriyse

Environment

Almost any.

Details

Probably bugs in the source code.

  • Describe what you were trying to get done.
    Just code review.

file: runtime.cs, line ~281

#if PYTHON3
            IntPtr dllLocal = IntPtr.Zero;
            if (PythonDll != "__Internal")
            {
                // Current. !!!!!!! BUG HERE !!!!!!!
                NativeMethods.LoadLibrary(PythonDll); 

                // Brobably correct version
                dllLocal = NativeMethods.LoadLibrary(PythonDll); 
            }
            _PyObject_NextNotImplemented = NativeMethods.GetProcAddress(dllLocal, "_PyObject_NextNotImplemented");
#if !(MONO_LINUX || MONO_OSX)
            if (dllLocal != IntPtr.Zero)
            {
                // Another !!!! BUG !!!
                // _PyObject_NextNotImplemented - Pointer can stay invalid after Library dispose.
                // This code will be valid only if Windows preserve proc addresses on each DLL load
               // But it can be changed. For example Win7 x86 = ok,    Win10 x64 = oops, addresses drift.
                NativeMethods.FreeLibrary(dllLocal);
            }
#endif
#endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0