summaryrefslogtreecommitdiff
path: root/Cython/Compiler/ParseTreeTransforms.py
diff options
context:
space:
mode:
authorNicolas Pauss <nicolas.pauss@intersec.com>2018-10-27 14:50:56 +0200
committerStefan Behnel <stefan_ml@behnel.de>2018-10-30 21:54:06 +0100
commita12dab85c3cf4f6fea0734c8767ba3f48c10b0fb (patch)
treef57a41e9b675f7e9c3f417d7bbf03a5151eb3502 /Cython/Compiler/ParseTreeTransforms.py
parent8eb3fd2b10dafc259288262e4a3aaf28ad1f627a (diff)
downloadcython-a12dab85c3cf4f6fea0734c8767ba3f48c10b0fb.tar.gz
2685_warn_undeclared: fix undeclared type warnings for unpickle variables.
The types of variables __pyx_PickleError, __pyx_result from generated unpickle function, and variables state, _dict from __reduce_cython__ generated method were not declared. So warnings were raised with warn.undeclared for every single extension type. Now, we define the type of these variables, and no warnings are raised.
Diffstat (limited to 'Cython/Compiler/ParseTreeTransforms.py')
-rw-r--r--Cython/Compiler/ParseTreeTransforms.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py
index 9753a2f61..f4c0f5c36 100644
--- a/Cython/Compiler/ParseTreeTransforms.py
+++ b/Cython/Compiler/ParseTreeTransforms.py
@@ -1707,6 +1707,8 @@ if VALUE is not None:
# so it can be pickled *after* self is memoized.
unpickle_func = TreeFragment(u"""
def %(unpickle_func_name)s(__pyx_type, long __pyx_checksum, __pyx_state):
+ cdef object __pyx_PickleError
+ cdef object __pyx_result
if __pyx_checksum != %(checksum)s:
from pickle import PickleError as __pyx_PickleError
raise __pyx_PickleError("Incompatible checksums (%%s vs %(checksum)s = (%(members)s))" %% __pyx_checksum)
@@ -1735,6 +1737,8 @@ if VALUE is not None:
pickle_func = TreeFragment(u"""
def __reduce_cython__(self):
+ cdef tuple state
+ cdef object _dict
cdef bint use_setstate
state = (%(members)s)
_dict = getattr(self, '__dict__', None)