Commit 6496c017 authored by da-woods's avatar da-woods Committed by Stefan Behnel

fix "undeclared" warning about generated pickle methods (GH-3353)

The pickle functions __reduce__ and __setstate_cython__ were being
visited in the module scope (where they were undeclared) rather
than the class scope where they were declared
parent 26cb654d
...@@ -1763,7 +1763,9 @@ if VALUE is not None: ...@@ -1763,7 +1763,9 @@ if VALUE is not None:
}, },
level='c_class', pipeline=[NormalizeTree(None)]).substitute({}) level='c_class', pipeline=[NormalizeTree(None)]).substitute({})
pickle_func.analyse_declarations(node.scope) pickle_func.analyse_declarations(node.scope)
self.enter_scope(node, node.scope) # functions should be visited in the class scope
self.visit(pickle_func) self.visit(pickle_func)
self.exit_scope()
node.body.stats.append(pickle_func) node.body.stats.append(pickle_func)
def _handle_fused_def_decorators(self, old_decorators, env, node): def _handle_fused_def_decorators(self, old_decorators, env, node):
......
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