Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
438a61e1
Commit
438a61e1
authored
Jun 03, 2011
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable bindings for staticmethods
parent
bdb3551b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-0
tests/run/staticmethod.pyx
tests/run/staticmethod.pyx
+18
-0
No files found.
Cython/Compiler/Nodes.py
View file @
438a61e1
...
...
@@ -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
),
...
...
tests/run/staticmethod.pyx
View file @
438a61e1
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment