Commit 948bc94d authored by Stefan Behnel's avatar Stefan Behnel

Add some Py3-only builtin names (mostly I/O exceptions) as uncachable builtins...

Add some Py3-only builtin names (mostly I/O exceptions) as uncachable builtins to avoid "unknown name" errors when running Cython in Py2.
Closes #2087.
parent eb17d235
......@@ -102,6 +102,9 @@ Bugs fixed
the type of the first argument as ``self``. It was previously treated as plain
object, but CPython actually guarantees that it always has the correct type.
* Some Python 3 exceptions were not recognised as builtins when running Cython
under Python 2.
* Some async helper functions were not defined in the generated C code when
compiling simple async code. (Github issue #2075)
......
......@@ -60,10 +60,42 @@ basicsize_builtins_map = {
}
uncachable_builtins = [
# builtin names that cannot be cached because they may or may not
# be available at import time
# Global/builtin names that cannot be cached because they may or may not
# be available at import time, for various reasons:
## - Py3.7+
'breakpoint', # might deserve an implementation in Cython
## - Py3.4+
'__loader__',
'__spec__',
## - Py3+
'BlockingIOError',
'BrokenPipeError',
'ChildProcessError',
'ConnectionAbortedError',
'ConnectionError',
'ConnectionRefusedError',
'ConnectionResetError',
'FileExistsError',
'FileNotFoundError',
'InterruptedError',
'IsADirectoryError',
'ModuleNotFoundError',
'NotADirectoryError',
'PermissionError',
'ProcessLookupError',
'RecursionError',
'ResourceWarning',
#'StopAsyncIteration', # backported
'TimeoutError',
'__build_class__',
'ascii', # might deserve an implementation in Cython
#'exec', # implemented in Cython
## - Py2.7+
'memoryview',
## - platform specific
'WindowsError',
'_', # e.g. gettext
## - others
'_', # e.g. used by gettext
]
special_py_methods = set([
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment