Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added IsNone() and GetPyNone()#1137

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
filmor merged 4 commits intopythonnet:masterfromhenon:net_framework
May 11, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
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
1 change: 1 addition & 0 deletionsAUTHORS.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -45,6 +45,7 @@
- Luke Stratman ([@lstratman](https://github.com/lstratman))
- Konstantin Posudevskiy ([@konstantin-posudevskiy](https://github.com/konstantin-posudevskiy))
- Matthias Dittrich ([@matthid](https://github.com/matthid))
- Meinrad Recheis ([@henon](https://github.com/henon))
- Mohamed Koubaa ([@koubaa](https://github.com/koubaa))
- Patrick Stewart ([@patstew](https://github.com/patstew))
- Raphael Nestler ([@rnestler](https://github.com/rnestler))
Expand Down
2 changes: 2 additions & 0 deletionsCHANGELOG.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,8 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
- Added support for Jetson Nano.
- Added support for __len__ for .NET classes that implement ICollection
- Added PythonException.Format method to format exceptions the same as traceback.format_exception
- Added Runtime.None to be able to pass None as parameter into Python from .NET
- Added PyObject.IsNone() to check if a Python object is None in .NET.

### Changed

Expand Down
4 changes: 4 additions & 0 deletionssrc/runtime/pyobject.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -979,6 +979,10 @@ public bool IsTrue()
return Runtime.PyObject_IsTrue(obj) != 0;
}

/// <summary>
/// Return true if the object is None
/// </summary>
public bool IsNone() => CheckNone(this) == null;

/// <summary>
/// Dir Method
Expand Down
10 changes: 10 additions & 0 deletionssrc/runtime/runtime.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -473,6 +473,16 @@ private static void ResetPyMembers()
internal static IntPtr PyNone;
internal static IntPtr Error;

public static PyObject None
{
get
{
var none = Runtime.PyNone;
Runtime.XIncref(none);
return new PyObject(none);
}
}

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

[8]ページ先頭

©2009-2025 Movatter.jp