Skip to content

Fill nb_index slot for integer types #1907

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 13, 2022
Merged
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
Readd explicit __int__ for enums
  • Loading branch information
filmor authored Aug 13, 2022
commit ccb3f7ee038fa088422ddfa6fe4b4b863e17b75a
4 changes: 4 additions & 0 deletions src/runtime/Util/OpsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,9 @@ public static PyInt __index__(T value)
=> typeof(T).GetEnumUnderlyingType() == typeof(UInt64)
? new PyInt(Convert.ToUInt64(value))
: new PyInt(Convert.ToInt64(value));
[ForbidPythonThreads]
#pragma warning disable IDE1006 // Naming Styles - must match Python
public static PyInt __int__(T value) => __index__(value);
#pragma warning restore IDE1006 // Naming Styles
}
}