Commit adfcde1e authored by da-woods's avatar da-woods

Error message on cpdef variables

Allowing these gives people the false impression that they
do something meaningful. "Fixes" https://github.com/cython/cython/issues/3959
parent 4c02adc9
......@@ -1380,6 +1380,9 @@ class CVarDefNode(StatNode):
self.entry.type.create_to_py_utility_code(env)
self.entry.create_wrapper = True
else:
if self.overridable:
warning(self.pos, "cpdef variables will not be supported in Cython 3; "
"currently they are no different from cdef variables", 2)
if self.directive_locals:
error(self.pos, "Decorators can only be followed by functions")
self.entry = dest_scope.declare_var(
......
# tag: warnings
cpdef str a = "123"
cpdef b = 2
cdef class C:
cpdef float c
def func():
cpdef d=C()
return d
_WARNINGS = """
3:6: cpdef variables will not be supported in Cython 3; currently they are no different from cdef variables
4:6: cpdef variables will not be supported in Cython 3; currently they are no different from cdef variables
7:10: cpdef variables will not be supported in Cython 3; currently they are no different from cdef variables
10:10: cpdef variables will not be supported in Cython 3; currently they are no different from cdef variables
"""
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