- Notifications
You must be signed in to change notification settings - Fork752
Closed
Description
Environment
- Pythonnet version: 2.5.2
- Python version: 3.8.7
- Operating System: Windows 10
- .NET Runtime:
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.101\
Details
- Describe what you were trying to get done.
I was trying to invoke a C# function with an argument of type Nullable. Python.NET reported that it could find no function matching the arguments. Eventually, I tried to test the fix for issue#460.
- 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.
Python 3.8.7 (tags/v3.8.7:6503f05, Dec 21 2020, 17:59:51) [MSC v.1928 64 bit (AMD64)]Type 'copyright', 'credits' or 'license' for more informationIPython 7.28.0 -- An enhanced Interactive Python. Type '?' for help.[ins] In [1]: import clr[ins] In [2]: from System import (UInt32, Nullable)[ins] In [3]: Nullable[UInt32](3)Out[3]: <System.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] object at 0x0000020A6AF106D0>[ins] In [4]: Nullable[UInt32](None)---------------------------------------------------------------------------TypeError Traceback (most recent call last)<ipython-input-4-b1659b301f87> in <module>----> 1 Nullable[UInt32](None)TypeError: No constructor matches given arguments: (<class 'NoneType'>)
- If there was a crash, please include the traceback here.
I also tried testing against pythonnet 3.0.0.a2. I see the following stack trace.
Python 3.8.7 (tags/v3.8.7:6503f05, Dec 21 2020, 17:59:51) [MSC v.1928 64 bit (AMD64)] Type 'copyright', 'credits' or 'license' for more information IPython 8.0.1 -- An enhanced Interactive Python. Type '?' for help. [ins] In [1]: import clr [ins] In [2]: from System import DateTime, Double, Guid, Nullable, String, UInt32 [ins] In [3]: Nullable[Double](None) Python.Runtime.PythonException: 'NoneType' value cannot be converted to System.Double The above exception was the direct cause of the following exception: System.ArgumentException: 'NoneType' value cannot be converted to System.Double in method Void .ctor(Double) ---> Python.Runtime.PythonException: 'NoneType' value cannot be converted to System.Double --- End of inner exception stack trace --- The above exception was the direct cause of the following exception: System.AggregateException: One or more errors occurred. ---> System.ArgumentException: 'NoneType' value cannot be converted to System.Double in method Void .ctor(Double) ---> Python.Runtime.PythonException: 'NoneType' value cannot be converted to System.Double --- End of inner exception stack trace --- --- End of inner exception stack trace --- ---> (Inner Exception #0) System.ArgumentException: 'NoneType' value cannot be converted to System.Double in method Void .ctor(Double) ---> Python.Runtime.PythonException: 'NoneType' value cannot be converted to System.Double --- End of inner exception stack trace ---<--- The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\interactiveshell.py", line 3251, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-3-3b78c20f70fb>", line 1, in <module> Nullable[Double](None) TypeError: No constructor matches given arguments: (<class 'NoneType'>) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\interactiveshell.py", line 1934, in showtraceback stb = value._render_traceback_() AttributeError: 'TypeError' object has no attribute '_render_traceback_' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\interactiveshell.py", line 3191, in run_ast_nodes if await self.run_code(code, result, async_=asy): File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\interactiveshell.py", line 3268, in run_code self.showtraceback(running_compiled_code=True) File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\interactiveshell.py", line 1936, in showtraceback stb = self.InteractiveTB.structured_traceback(etype, File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\ultratb.py", line 1105, in structured_traceback return FormattedTB.structured_traceback( File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\ultratb.py", line 999, in structured_traceback return VerboseTB.structured_traceback( File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\ultratb.py", line 871, in structured_traceback formatted_exceptions += self.format_exception_as_a_whole(etype, evalue, etb, lines_of_context, File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\ultratb.py", line 775, in format_exception_as_a_whole assert etb is not None AssertionError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\interactiveshell.py", line 1934, in showtraceback stb = value._render_traceback_() AttributeError: 'AssertionError' object has no attribute '_render_traceback_' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\interactiveshell.py", line 2814, in _run_cell return runner(coro) File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\async_helpers.py", line 129, in _pseudo_sync_runner coro.send(None) File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\interactiveshell.py", line 3012, in run_cell_async has_raised = await self.run_ast_nodes(code_ast.body, cell_name, File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\interactiveshell.py", line 3210, in run_ast_nodes self.showtraceback() File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\interactiveshell.py", line 1936, in showtraceback stb = self.InteractiveTB.structured_traceback(etype, File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\ultratb.py", line 1105, in structured_traceback return FormattedTB.structured_traceback( File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\ultratb.py", line 999, in structured_traceback return VerboseTB.structured_traceback( File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\ultratb.py", line 871, in structured_traceback formatted_exceptions += self.format_exception_as_a_whole(etype, evalue, etb, lines_of_context, File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\ultratb.py", line 775, in format_exception_as_a_whole assert etb is not None AssertionError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\interactiveshell.py", line 1934, in showtraceback stb = value._render_traceback_() AttributeError: 'AssertionError' object has no attribute '_render_traceback_' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\larry.jones\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\larry.jones\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\Scripts\ipython.exe\__main__.py", line 7, in <module> sys.exit(start_ipython()) File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\__init__.py", line 123, in start_ipython return launch_new_instance(argv=argv, **kwargs) File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\traitlets\config\application.py", line 846, in launch_instance app.start() File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\terminal\ipapp.py", line 316, in start self.shell.mainloop() File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\terminal\interactiveshell.py", line 611, in mainloop self.interact() File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\terminal\interactiveshell.py", line 604, in interact self.run_cell(code, store_history=True) File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\interactiveshell.py", line 2768, in run_cell result = self._run_cell( File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\interactiveshell.py", line 2819, in _run_cell self.showtraceback(running_compiled_code=True) File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\interactiveshell.py", line 1936, in showtraceback stb = self.InteractiveTB.structured_traceback(etype, File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\ultratb.py", line 1105, in structured_traceback return FormattedTB.structured_traceback( File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\ultratb.py", line 999, in structured_traceback return VerboseTB.structured_traceback( File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\ultratb.py", line 871, in structured_traceback formatted_exceptions += self.format_exception_as_a_whole(etype, evalue, etb, lines_of_context, File "C:\Users\larry.jones\AppData\Local\pypoetry\Cache\virtualenvs\libpy-QVeQv1xn-py3.8\lib\site-packages\IPython\core\ultratb.py", line 775, in format_exception_as_a_whole assert etb is not None AssertionError If you suspect this is an IPython 8.0.1 bug, please report it at: https://github.com/ipython/ipython/issues or send an email to the mailing list at ipython-dev@python.org You can print a more detailed traceback right now with "%tb", or use "%debug" to interactively debug it. Extra-detailed tracebacks for bug-reporting purposes can be enabled via: %config Application.verbose_crash=True
Metadata
Metadata
Assignees
Labels
No labels