Commit e8d30965 authored by Stefan Behnel's avatar Stefan Behnel

Re-enable "auto late includes" based on a preliminary directive. We have the...

Re-enable "auto late includes" based on a preliminary directive. We have the feature, so allowing its use won't hurt, as long as users are aware that they will have to change their code later.
See #2079.
parent ffa1a198
......@@ -155,7 +155,7 @@ class IncludeCode(object):
if initial:
self.location = self.INITIAL
elif False and late:
elif late:
self.location = self.LATE
else:
self.location = self.EARLY
......
......@@ -485,7 +485,9 @@ class CDefExternNode(StatNode):
if self.include_file or self.verbatim_include:
# Determine whether include should be late
stats = self.body.stats
if not stats:
if not env.directives['preliminary_late_includes_cy28']:
late = False
elif not stats:
# Special case: empty 'cdef extern' blocks are early
late = False
else:
......
......@@ -171,6 +171,7 @@ _directive_defaults = {
'language_level': 2,
'fast_getattr': False, # Undocumented until we come up with a better way to handle this everywhere.
'py2_import': False, # For backward compatibility of Cython's source code in Py3 source mode
'preliminary_late_includes_cy28': False, # Temporary directive in 0.28, to be removed in a later version (see GH#2079).
'iterable_coroutine': False, # Make async coroutines backwards compatible with the old asyncio yield-from syntax.
'c_string_type': 'bytes',
'c_string_encoding': '',
......
......@@ -16,9 +16,6 @@ cimport_alias_subclass
# PEP-489 is currently disabled
run.mod__spec__
# Late includes are currently disabled
run.extern_include_order
# CPython regression tests that don't current work:
pyregr.test_signal
pyregr.test_capi
......
......@@ -12,6 +12,7 @@ setup(
)
######## a.pxd ########
# cython: preliminary_late_includes_cy28=True
cdef extern from "a_early.h":
ctypedef int my_int
......
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