Skip to content

Bug in runtime.cs Runtime.Initialize() method. #445

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
dmitriyse opened this issue Mar 29, 2017 · 3 comments
Closed

Bug in runtime.cs Runtime.Initialize() method. #445

dmitriyse opened this issue Mar 29, 2017 · 3 comments

Comments

@dmitriyse
Copy link
Contributor

dmitriyse commented Mar 29, 2017

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
@vmuriart
Copy link
Contributor

Is this actually causing you an issue? I looked into this too a while back and couldn't make it produce an error even though the syntax looks wrong. If I remember right 'dllLocal' ends up getting assigned in Linux but not on windows.

Since I couldn't reproduce an actual bug I left the code as is.

@den-run-ai
Copy link
Contributor

@dmitriyse can you provide a use case or ideally a test when this issue is reproduced?

@den-run-ai
Copy link
Contributor

closing due to inactivity, not reproducible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants