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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
ba35886d
Commit
ba35886d
authored
Aug 17, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid wrapping cypclass methods with checklock arguments
parent
102448fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
38 deletions
+12
-38
Cython/Compiler/CypclassTransforms.py
Cython/Compiler/CypclassTransforms.py
+12
-38
No files found.
Cython/Compiler/CypclassTransforms.py
View file @
ba35886d
...
@@ -62,46 +62,18 @@ property NAME:
...
@@ -62,46 +62,18 @@ property NAME:
"""
,
level
=
'c_class'
,
pipeline
=
[
NormalizeTree
(
None
)])
"""
,
level
=
'c_class'
,
pipeline
=
[
NormalizeTree
(
None
)])
# method wrapper templates
# method wrapper templates
unlocked_method
=
TreeFragment
.
TreeFragment
(
u"""
method_template
=
TreeFragment
.
TreeFragment
(
u"""
def NAME(self, ARGDECLS):
def NAME(self, ARGDECLS):
OBJ = <TYPE> self
OBJ = <TYPE> self
return OBJ.NAME(ARGS)
return OBJ.NAME(ARGS)
"""
,
level
=
'c_class'
,
pipeline
=
[
NormalizeTree
(
None
)])
"""
,
level
=
'c_class'
,
pipeline
=
[
NormalizeTree
(
None
)])
unlocked_method_no_return
=
TreeFragment
.
TreeFragment
(
u"""
method_no_return_template
=
TreeFragment
.
TreeFragment
(
u"""
def NAME(self, ARGDECLS):
def NAME(self, ARGDECLS):
OBJ = <TYPE> self
OBJ = <TYPE> self
OBJ.NAME(ARGS)
OBJ.NAME(ARGS)
"""
,
level
=
'c_class'
,
pipeline
=
[
NormalizeTree
(
None
)])
"""
,
level
=
'c_class'
,
pipeline
=
[
NormalizeTree
(
None
)])
rlocked_method
=
TreeFragment
.
TreeFragment
(
u"""
def NAME(self, ARGDECLS):
OBJ = <TYPE> self
with rlocked OBJ:
return OBJ.NAME(ARGS)
"""
,
level
=
'c_class'
,
pipeline
=
[
NormalizeTree
(
None
)])
rlocked_method_no_return
=
TreeFragment
.
TreeFragment
(
u"""
def NAME(self, ARGDECLS):
OBJ = <TYPE> self
with rlocked OBJ:
OBJ.NAME(ARGS)
"""
,
level
=
'c_class'
,
pipeline
=
[
NormalizeTree
(
None
)])
wlocked_method
=
TreeFragment
.
TreeFragment
(
u"""
def NAME(self, ARGDECLS):
OBJ = <TYPE> self
with wlocked OBJ:
return OBJ.NAME(ARGS)
"""
,
level
=
'c_class'
,
pipeline
=
[
NormalizeTree
(
None
)])
wlocked_method_no_return
=
TreeFragment
.
TreeFragment
(
u"""
def NAME(self, ARGDECLS):
OBJ = <TYPE> self
with wlocked OBJ:
OBJ.NAME(ARGS)
"""
,
level
=
'c_class'
,
pipeline
=
[
NormalizeTree
(
None
)])
# static method wrapper templates
# static method wrapper templates
static_method
=
TreeFragment
.
TreeFragment
(
u"""
static_method
=
TreeFragment
.
TreeFragment
(
u"""
@staticmethod
@staticmethod
...
@@ -344,6 +316,15 @@ def NAME(ARGDECLS):
...
@@ -344,6 +316,15 @@ def NAME(ARGDECLS):
method_type
=
method_entry
.
type
method_type
=
method_entry
.
type
if
not
method_type
.
is_static_method
and
node
.
entry
.
type
.
lock_mode
==
"checklock"
:
# skip non-static methods with "checklock" self
return
for
argtype
in
method_type
.
args
:
if
argtype
.
type
.
is_cyp_class
and
argtype
.
type
.
lock_mode
==
"checklock"
:
# skip methods with "checklock" cypclass arguments
return
if
method_type
.
optional_arg_count
:
if
method_type
.
optional_arg_count
:
# for now skip methods with optional arguments
# for now skip methods with optional arguments
return
return
...
@@ -422,14 +403,7 @@ def NAME(ARGDECLS):
...
@@ -422,14 +403,7 @@ def NAME(ARGDECLS):
}).
stats
[
0
]
}).
stats
[
0
]
else
:
else
:
if
node
.
lock_mode
==
'checklock'
:
template
=
self
.
method_template
if
need_return
else
self
.
method_no_return_template
need_wlock
=
not
method_type
.
is_const_method
if
need_wlock
:
template
=
self
.
wlocked_method
if
need_return
else
self
.
wlocked_method_no_return
else
:
template
=
self
.
rlocked_method
if
need_return
else
self
.
rlocked_method_no_return
else
:
template
=
self
.
unlocked_method
if
need_return
else
self
.
unlocked_method_no_return
# > derive a unique name that doesn't collide with the arguments
# > derive a unique name that doesn't collide with the arguments
underlying_name
=
self
.
create_unique_name
(
"o"
,
entries
=
[
arg
.
name
for
arg
in
arg_objs
])
underlying_name
=
self
.
create_unique_name
(
"o"
,
entries
=
[
arg
.
name
for
arg
in
arg_objs
])
...
...
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