Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
added GetPyNone() to Runtime
  • Loading branch information
henon committed May 26, 2019
commit 1591a71699b8acafe3f13e4a2465e2f00dec838d
13 changes: 13 additions & 0 deletions src/runtime/runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,19 @@ public static int AtExit()
public static IntPtr PyNone;
public static IntPtr Error;

public static PyObject _none;
public static PyObject GetPyNone()
{
if (_none == null)
{
var result = Runtime.PyNone;
Runtime.XIncref(result);
_none= new PyObject(result);
}

return _none;
}

/// <summary>
/// Check if any Python Exceptions occurred.
/// If any exist throw new PythonException.
Expand Down