cannot get anymore int of enumclass (alpha2)
See original GitHub issueEnvironment
- Pythonnet version: 3.0.0dev
- Python version: 3.9
- Operating System: Windows
- .NET Runtime:
Details
- Describe what you were trying to get done.
In v2.5.2 I’m able to get a C# enum and get the int value. In alpha 2 it seems that the full enum class is returned but the int command is not working. In 3.0.0dev it makes crashing the Debugger.
-
What commands did you run to trigger this issue? If you can provide a Minimal, Complete, and Verifiable example this will help us understand the issue.
-
If there was a crash, please include the traceback here.
Out[13]: <bound method 'int'>
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Python.Runtime.Runtime.PyLong_FromLongLong(Int64 value)
at Python.Runtime.PyInt..ctor(Int64 value)
at Python.Runtime.EnumOps`1.int(T value)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Python.Runtime.MethodBinder.Invoke(BorrowedReference inst, BorrowedReference args, BorrowedReference kw, MethodBase info, MethodBase[] methodinfo)
at Python.Runtime.MethodObject.Invoke(BorrowedReference target, BorrowedReference args, BorrowedReference kw, MethodBase info)
at Python.Runtime.MethodBinding.tp_call(BorrowedReference ob, BorrowedReference args, BorrowedReference kw)
Process finished with exit code -532462766
Issue Analytics
- State:
- Created a year ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
why can enum class values of type int not be used as int
You can't use c++11 scoped enums directly as int, but can cast it into int . Mainly because of type safety reason, unscoped...
Read more >Why cast between two strongly typed C++11 enum classes ...
Hi,. C++11 strong enums ensure that we can not interchange 2 such enum classes as we can not interchange two independent structs.
Read more >enum — Support for enumerations
Enum. Base class for creating enumerated constants. IntEnum ... Enum class decorator that ensures only one name is bound to any one value....
Read more >Enumeration declaration
An enumeration is a distinct type whose value is restricted to a range of values (see below for details), which may include several ......
Read more >Enumeration types - C# reference
An enumeration type (or enum type) is a value type defined by a set of named constants of the underlying integral numeric type....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Taken from your Unit Test:
from System import DayOfWeek int(DayOfWeek.Sunday)
@filmor I’ve tested the latest main and it works pretty well. Thanks