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
f58cc9a8
Commit
f58cc9a8
authored
Jan 07, 2019
by
mattip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MAINT: refactor: is_cgetter now lives on the entry, use find_decorator
parent
03c53946
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
16 deletions
+16
-16
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+3
-3
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+11
-13
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+2
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
f58cc9a8
...
...
@@ -7146,7 +7146,7 @@ class AttributeNode(ExprNode):
obj_code
=
obj
.
result_as
(
obj
.
type
)
#print "...obj_code =", obj_code ###
if
self
.
entry
and
self
.
entry
.
is_cmethod
:
if
getattr
(
self
.
entry
.
type
,
'is_cgetter'
,
False
)
:
if
self
.
entry
.
is_cgetter
:
return
"%s(%s)"
%
(
self
.
entry
.
func_cname
,
obj_code
)
if
obj
.
type
.
is_extension_type
and
not
self
.
entry
.
is_builtin_cmethod
:
if
self
.
entry
.
final_func_cname
:
...
...
@@ -11225,9 +11225,9 @@ class NumBinopNode(BinopNode):
self
.
operand2
=
self
.
operand2
.
coerce_to
(
self
.
type
,
env
)
def
compute_c_result_type
(
self
,
type1
,
type2
):
if
type1
.
is_cfunction
and
type1
.
is_cgetter
:
if
type1
.
is_cfunction
and
type1
.
entry
.
is_cgetter
:
type1
=
type1
.
return_type
if
type2
.
is_cfunction
and
type2
.
is_cgetter
:
if
type2
.
is_cfunction
and
type2
.
entry
.
is_cgetter
:
type2
=
type2
.
return_type
if
self
.
c_types_okay
(
type1
,
type2
):
widest_type
=
PyrexTypes
.
widest_numeric_type
(
type1
,
type2
)
...
...
Cython/Compiler/ParseTreeTransforms.py
View file @
f58cc9a8
...
...
@@ -2245,23 +2245,21 @@ class ReplacePropertyNode(CythonTransform):
return
node
# transform @property decorators on ctypedef class functions
for
decorator_node
in
node
.
decorators
[::
-
1
]:
_node
=
self
.
analyse_decorator
(
node
,
decorator_node
.
decorator
)
if
_node
:
if
self
.
find_decorator
(
decorator_node
.
decorator
,
'property'
):
if
len
(
node
.
decorators
)
>
1
:
# raises
self
.
_reject_decorated_property
(
node
,
decorator_node
)
node
.
entry
.
is_cgetter
=
True
# Add a func_cname to be output instead of the attribute
node
.
entry
.
func_cname
=
node
.
body
.
stats
[
0
].
value
.
function
.
name
node
.
decorators
.
remove
(
decorator_node
)
node
=
_node
break
return
node
def
analyse_decorator
(
self
,
node
,
decorator
):
if
decorator
.
is_name
and
decorator
.
name
==
'property'
:
if
len
(
node
.
decorators
)
>
1
:
return
self
.
_reject_decorated_property
(
node
,
decorator_node
)
# Mark the node as a cgetter
node
.
type
.
is_cgetter
=
True
# Add a func_cname to be output instead of the attribute
node
.
entry
.
func_cname
=
node
.
body
.
stats
[
0
].
value
.
function
.
name
return
node
return
None
def
find_decorator
(
self
,
decorator
,
name
):
if
decorator
.
is_name
and
decorator
.
name
==
name
:
return
True
return
False
class
FindInvalidUseOfFusedTypes
(
CythonTransform
):
...
...
Cython/Compiler/Symtab.py
View file @
f58cc9a8
...
...
@@ -134,6 +134,7 @@ class Entry(object):
# cf_used boolean Entry is used
# is_fused_specialized boolean Whether this entry of a cdef or def function
# is a specialization
# is_cgetter boolean Is a c-level getter function
# TODO: utility_code and utility_code_definition serves the same purpose...
...
...
@@ -203,6 +204,7 @@ class Entry(object):
error_on_uninitialized
=
False
cf_used
=
True
outer_entry
=
None
is_cgetter
=
False
def
__init__
(
self
,
name
,
cname
,
type
,
pos
=
None
,
init
=
None
):
self
.
name
=
name
...
...
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