| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Call get_annotations() with eval_str=True.
|
@ctypes.util.struct has the same bug: see PR gh-154040 which fixes it. |
Sorry, something went wrong.
Sorry, something went wrong.
|
With this change, the following example: import ctypes.util
@ctypes.util.wrap_dll_function(ctypes.pythonapi)
def Py_GetVersion() -> 'invalid return type':
...now fails with SyntaxError: Traceback (most recent call last):
File "/home/vstinner/python/main/ann.py", line 3, in <module>
@ctypes.util.wrap_dll_function(ctypes.pythonapi)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/home/vstinner/python/main/Lib/ctypes/util.py", line 582, in decorator
annotations = annotationlib.get_annotations(func, eval_str=True)
File "/home/vstinner/python/main/Lib/annotationlib.py", line 1078, in get_annotations
else eval(_rewrite_star_unpack(value), globals, locals)
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<string>", line 1
invalid return type
^^^^^^
SyntaxError: invalid syntax
Hopefully, the traceback starts at line 3 of ann.py which is the line creating Py_GetVersion(), so the traceback is correct and helpful! |
Sorry, something went wrong.
|
Merged, thanks for the review. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Call get_annotations() with eval_str=True.