FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[WIP] PythonHome Path is correctly set by den-run-ai · Pull Request #279 · pythonnet/pythonnet · GitHub

Repository navigation

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension .cs  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
Next Next commit
Py_SetPythonHome argument updated to IntPtr such that string marhsal …
…is explicit and will not be freed automatically.
  • Loading branch information
leomeuk committed Mar 13, 2016
commit 63c43dd3ad5b8ccf59bb6305f8ce684b4c3f1d2e
6 changes: 4 additions & 2 deletions src/runtime/pythonengine.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
using System.IO;
using System.Threading;
using System.Reflection;

using System.Runtime.InteropServices;

namespace Python.Runtime {

/// <summary>
Expand Down Expand Up @@ -62,7 +63,8 @@ public static string PythonHome {
return result;
}
set {
Runtime.Py_SetPythonHome(value);
IntPtr pythonHome = Marshal.StringToHGlobalAnsi(value);
Runtime.Py_SetPythonHome(pythonHome);
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/runtime/runtime.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,9 @@ internal unsafe static extern IntPtr
[DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl,
ExactSpelling=true, CharSet=CharSet.Ansi)]
internal unsafe static extern IntPtr
PyEval_GetLocals();


PyEval_GetLocals();
#if PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35
[DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl,
ExactSpelling=true, CharSet=CharSet.Ansi)]
Expand All @@ -762,7 +762,7 @@ internal unsafe static extern string
[DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl,
ExactSpelling=true, CharSet=CharSet.Ansi)]
internal unsafe static extern void
Py_SetPythonHome([MarshalAsAttribute(UnmanagedType.LPWStr)]string home);
Py_SetPythonHome(IntPtr home);

[DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl,
ExactSpelling=true, CharSet=CharSet.Ansi)]
Expand Down Expand Up @@ -793,7 +793,7 @@ internal unsafe static extern string
[DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl,
ExactSpelling = true, CharSet = CharSet.Ansi)]
internal unsafe static extern void
Py_SetPythonHome(string home);
Py_SetPythonHome(IntPtr home);

[DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl,
ExactSpelling = true, CharSet = CharSet.Ansi)]
Expand Down

Back | FazBrowse Home | New Git URL