Commit 7e1933c7 authored by Stefan Behnel's avatar Stefan Behnel

ticket #128: disable Cython type declarations in signatures of .py files

parent abb7a118
......@@ -2089,9 +2089,17 @@ def p_c_arg_decl(s, ctx, in_pyfunc, cmethod_flag = 0, nonempty = 0, kw_only = 0)
pos = s.position()
not_none = 0
default = None
base_type = p_c_base_type(s, cmethod_flag, nonempty = nonempty)
if s.in_python_file:
# empty type declaration
base_type = Nodes.CSimpleBaseTypeNode(pos,
name = None, module_path = [],
is_basic_c_type = 0, signed = 0,
complex = 0, longness = 0,
is_self_arg = cmethod_flag, templates = None)
else:
base_type = p_c_base_type(s, cmethod_flag, nonempty = nonempty)
declarator = p_c_declarator(s, ctx, nonempty = nonempty)
if s.sy == 'not':
if s.sy == 'not' and not s.in_python_file:
s.next()
if s.sy == 'IDENT' and s.systring == 'None':
s.next()
......
......@@ -13,6 +13,7 @@ cdef class PyrexScanner(Scanner):
cdef public bint compile_time_eval
cdef public bint compile_time_expr
cdef public bint parse_comments
cdef public bint in_python_file
cdef public source_encoding
cdef set keywords
cdef public list indentation_stack
......
......@@ -255,8 +255,10 @@ class PyrexScanner(Scanner):
self.parse_comments = parse_comments
self.source_encoding = source_encoding
if filename.is_python_file():
self.in_python_file = True
self.keywords = cython.set(py_reserved_words)
else:
self.in_python_file = False
self.keywords = cython.set(pyx_reserved_words)
self.trace = trace_scanner
self.indentation_stack = [0]
......
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