- Notifications
You must be signed in to change notification settings - Fork750
Open
Labels
Description
Environment
- Pythonnet version:
3.0.2 from pip
- Python version:
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
- Operating System:
Debian GNU/Linux 12 (bookworm); Linux localhost 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.38-1 (2023-07-14) x86_64 unknown unknown linux
- .NET Runtime:
8.0.100-preview.3.23178.7 [/home/jorge/.dotnet/sdk]
Details
Describe what you were trying to get done.
I was exploring pythonnet inside Python REPL (by the way it's a very amazing library!) and I tried to useT[].Address(int)
, but when I called Address using wrong arguments, it crashes the interpreter instead of throwing an exception.
The same thing happens when trying to useT[].Get
andT[].Set
.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.
>>>importclr_loader,pythonnet>>>pythonnet.set_runtime(clr_loader.get_coreclr(runtime_config="/home/jorge/runtimeconfig.json",dotnet_root="/home/jorge/.dotnet"))>>>pythonnet.load()>>>importSystem>>>array=System.Array[int]((1,))>>>array.Address()
>>># runtime being loaded and array created the same way as first example>>>array.A# press TAB here
- If there was a crash, please include the traceback here.
Unhandledexception. System.ArgumentNullException: Value cannot benull.(Parameter 'key') atSystem.Collections.Generic.Dictionary`2.FindValue(TKeykey) atSystem.Collections.Generic.Dictionary`2.ContainsKey(TKeykey) atPython.Runtime.MethodBinder.MatchesArgumentCount(Int32positionalArgumentCount,ParameterInfo[]parameters, Dictionary`2kwargDict,Boolean¶msArray,ArrayList&defaultArgList,Int32&kwargsMatched,Int32&defaultsNeeded)in/tmp/build-via-sdist-zkttv147/pythonnet-3.0.2/src/runtime/MethodBinder.cs:line775 at Python.Runtime.MethodBinder.Bind(BorrowedReferenceinst,BorrowedReferenceargs, Dictionary`2kwargDict,MethodBase[]methods,BooleanmatchGenerics)in/tmp/build-via-sdist-zkttv147/pythonnet-3.0.2/src/runtime/MethodBinder.cs:line392 at Python.Runtime.MethodBinder.Bind(BorrowedReferenceinst,BorrowedReferenceargs,BorrowedReferencekw,MethodBaseinfo,MethodBase[]methodinfo)in/tmp/build-via-sdist-zkttv147/pythonnet-3.0.2/src/runtime/MethodBinder.cs:line366 at Python.Runtime.MethodBinder.Invoke(BorrowedReferenceinst,BorrowedReferenceargs,BorrowedReferencekw,MethodBaseinfo,MethodBase[]methodinfo)in/tmp/build-via-sdist-zkttv147/pythonnet-3.0.2/src/runtime/MethodBinder.cs:line868 at Python.Runtime.MethodObject.Invoke(BorrowedReferencetarget,BorrowedReferenceargs,BorrowedReferencekw,MethodBaseinfo)in/tmp/build-via-sdist-zkttv147/pythonnet-3.0.2/src/runtime/Types/MethodObject.cs:line77 at Python.Runtime.MethodBinding.tp_call(BorrowedReferenceob,BorrowedReferenceargs,BorrowedReferencekw)in/tmp/build-via-sdist-zkttv147/pythonnet-3.0.2/src/runtime/Types/MethodBinding.cs:line166Aborted
Unhandledexception. Python.Runtime.PythonException: name must be a str,not a NoneType File"/usr/lib/python3.11/inspect.py",line2701,in __init__raiseTypeError(msg) atPython.Runtime.PythonException.ThrowLastAsClrException()in/tmp/build-via-sdist-zkttv147/pythonnet-3.0.2/src/runtime/PythonException.cs:line53 at Python.Runtime.PyObject.Invoke(PyTupleargs,PyDictkw)in/tmp/build-via-sdist-zkttv147/pythonnet-3.0.2/src/runtime/PythonTypes/PyObject.cs:line801 at Python.Runtime.MethodBinding.get_Signature()in/tmp/build-via-sdist-zkttv147/pythonnet-3.0.2/src/runtime/Types/MethodBinding.cs:line103 at Python.Runtime.MethodBinding.tp_getattro(BorrowedReferenceob,BorrowedReferencekey)in/tmp/build-via-sdist-zkttv147/pythonnet-3.0.2/src/runtime/Types/MethodBinding.cs:line147
Address
,Get
andSet
are documented here:https://download.microsoft.com/download/7/3/3/733AD403-90B2-4064-A81E-01035A7FE13C/MS%20Partition%20II.pdf.