8000 added GetPyNone() to Runtime · SciSharp/pythonnet@1591a71 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 1591a71

Browse files
committed
added GetPyNone() to Runtime
1 parent 59206a3 commit 1591a71

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/runtime/runtime.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,19 @@ public static int AtExit()
536536
public static IntPtr PyNone;
537537
public static IntPtr Error;
538538

539+
public static PyObject _none;
540+
public static PyObject GetPyNone()
541+
{
542+
if (_none == null)
543+
{
544+
var result = Runtime.PyNone;
545+
Runtime.XIncref(result);
546+
_none= new PyObject(result);
547+
}
548+
549+
return _none;
550+
}
551+
539552
/// <summary>
540553
/// Check if any Python Exceptions occurred.
541554
/// If any exist throw new PythonException.

0 commit comments

Comments
 (0)
0