Commit 438a61e1 authored by Vitja Makarov's avatar Vitja Makarov

Disable bindings for staticmethods

parent bdb3551b
......@@ -2294,6 +2294,8 @@ class DefNode(FuncDefNode):
if env.is_py_class_scope:
if not self.is_staticmethod and not self.is_classmethod:
rhs.binding = True
else:
rhs.binding = False
self.assmt = SingleAssignmentNode(self.pos,
lhs = ExprNodes.NameNode(self.pos, name = self.name),
......
......@@ -25,3 +25,21 @@ class class4:
@staticmethod
def plus1(a):
return a + 1
def nested_class():
"""
>>> cls = nested_class()
>>> cls.plus1(1)
2
>>> obj = cls()
>>> obj.plus1(1)
2
"""
class class5(object):
def __new__(cls): # implicit staticmethod
return object.__new__(cls)
@staticmethod
def plus1(a):
return a + 1
return class5
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