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
Xavier Thompson
cython
Commits
af8c3c1d
Commit
af8c3c1d
authored
May 23, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve declaration analysis of cypclass methods
parent
e9dadd66
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+5
-4
No files found.
Cython/Compiler/Nodes.py
View file @
af8c3c1d
...
...
@@ -2470,6 +2470,7 @@ class CFuncDefNode(FuncDefNode):
# is_const_method whether this is a const method
# is_static_method whether this is a static method
# is_c_class_method whether this is a cclass method
# is_cyp_class_method whether this is a cypclass method
child_attrs
=
[
"base_type"
,
"declarator"
,
"body"
,
"py_func_stat"
,
"decorators"
]
outer_attrs
=
[
"decorators"
]
...
...
@@ -2508,6 +2509,7 @@ class CFuncDefNode(FuncDefNode):
"Cannot handle %s decorators yet"
%
type
(
func
).
__name__
)
self
.
is_c_class_method
=
env
.
is_c_class_scope
self
.
is_cyp_class_method
=
env
.
is_cpp_class_scope
and
env
.
parent_type
.
is_cyp_class
if
self
.
directive_locals
is
None
:
self
.
directive_locals
=
{}
self
.
directive_locals
.
update
(
env
.
directives
.
get
(
'locals'
,
{}))
...
...
@@ -2549,8 +2551,7 @@ class CFuncDefNode(FuncDefNode):
# It is reinserted here, as __new__ MUST be static in a cypclass,
# so there is no self arg (the first arg is actually the allocator).
if
env
.
is_cpp_class_scope
and
env
.
parent_type
.
is_cyp_class
\
and
name
in
(
"__new__"
,
"__alloc__"
)
and
not
self
.
is_static_method
:
if
self
.
is_cyp_class_method
and
name
in
(
"__new__"
,
"__alloc__"
)
and
not
self
.
is_static_method
:
self
.
is_static_method
=
1
if
declarator
.
skipped_self
:
_name
,
_type
,
_pos
,
_arg
=
declarator
.
skipped_self
...
...
@@ -2630,8 +2631,7 @@ class CFuncDefNode(FuncDefNode):
# An error will be produced in the cdef function
self
.
overridable
=
False
if
env
.
is_cpp_class_scope
and
env
.
parent_type
.
is_cyp_class
\
and
not
declarator
.
skipped_self
and
not
self
.
is_static_method
:
if
self
.
is_cyp_class_method
and
not
declarator
.
skipped_self
and
not
self
.
is_static_method
:
# It means we have a cypclass method without the self argument
# => shout
error
(
self
.
pos
,
"Cypclass methods must have a self argument"
)
...
...
@@ -2650,6 +2650,7 @@ class CFuncDefNode(FuncDefNode):
self_locking_state
.
is_rlocked
=
self
.
is_const_method
self_locking_state
.
is_wlocked
=
not
self
.
is_const_method
def
declare_cpdef_wrapper
(
self
,
env
):
if
self
.
overridable
:
if
self
.
is_static_method
:
...
...
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