This repository was archived by the owner on Jul 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +17
-0
lines changed Expand file tree Collapse file tree 4 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 45
45
- Luke Stratman ([ @lstratman ] ( https://github.com/lstratman ) )
46
46
- Konstantin Posudevskiy ([ @konstantin-posudevskiy ] ( https://github.com/konstantin-posudevskiy ) )
47
47
- Matthias Dittrich ([ @matthid ] ( https://github.com/matthid ) )
48
+ - Meinrad Recheis ([ @henon ] ( https://github.com/henon ) )
48
49
- Mohamed Koubaa ([ @koubaa ] ( https://github.com/koubaa ) )
49
50
- Patrick Stewart ([ @patstew ] ( https://github.com/patstew ) )
50
51
- Raphael Nestler ([ @rnestler ] ( https://github.com/rnestler ) )
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
14
14
- Added support for Jetson Nano.
15
15
- Added support for __ len__ for .NET classes that implement ICollection
16
16
- Added PythonException.Format method to format exceptions the same as traceback.format_exception
17
+ - Added Runtime.None to be able to pass None as parameter into Python from .NET
18
+ - Added PyObject.IsNone() to check if a Python object is None in .NET.
17
19
18
20
### Changed
19
21
Original file line number Diff line number Diff line change @@ -979,6 +979,10 @@ public bool IsTrue()
979
979
return Runtime . PyObject_IsTrue ( obj ) != 0 ;
980
980
}
981
981
982
+ /// <summary>
983
+ /// Return true if the object is None
984
+ /// </summary>
985
+ public bool IsNone ( ) => CheckNone ( this ) == null ;
982
986
983
987
/// <summary>
984
988
/// Dir Method
Original file line number Diff line number Diff line change @@ -473,6 +473,16 @@ private static void ResetPyMembers()
473
473
internal static IntPtr PyNone ;
474
474
internal static IntPtr Error ;
475
475
476
+ public static PyObject None
477
+ {
478
+ get
479
+ {
480
+ var none = Runtime . PyNone ;
481
+ Runtime . XIncref ( none ) ;
482
+ return new PyObject ( none ) ;
483
+ }
484
+ }
485
+
476
486
/// <summary>
477
487
/// Check if any Python Exceptions occurred.
478
488
/// If any exist throw new PythonException.
You can’t perform that action at this time.
0 commit comments