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
53eb14de
Commit
53eb14de
authored
6 years ago
by
mattip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MAINT: changes from review
parent
2816f789
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
24 deletions
+19
-24
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+1
-5
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+6
-7
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+9
-9
tests/run/ext_attr_getter.srctree
tests/run/ext_attr_getter.srctree
+3
-3
No files found.
Cython/Compiler/ExprNodes.py
View file @
53eb14de
...
...
@@ -6976,11 +6976,7 @@ class AttributeNode(ExprNode):
self
.
obj
=
self
.
obj
.
analyse_types
(
env
)
self
.
analyse_attribute
(
env
)
if
self
.
entry
and
self
.
entry
.
is_cmethod
and
not
self
.
is_called
:
if
getattr
(
self
.
entry
,
'is_cgetter'
,
False
):
# This should be done at a different level??
self
.
is_called
=
1
self
.
op
=
''
self
.
result_ctype
=
self
.
type
.
return_type
# error(self.pos, "C method can only be called")
pass
## Reference to C array turns into pointer to first element.
#while self.type.is_array:
...
...
This diff is collapsed.
Click to expand it.
Cython/Compiler/Nodes.py
View file @
53eb14de
...
...
@@ -2340,11 +2340,14 @@ class CFuncDefNode(FuncDefNode):
return
self
.
py_func
.
code_object
if
self
.
py_func
else
None
def
analyse_declarations
(
self
,
env
):
is_property
=
False
if
self
.
decorators
:
for
decorator
in
self
.
decorators
:
func
=
decorator
.
decorator
if
func
.
is_name
:
if
func
.
name
in
(
'property'
,
'staticmethod'
):
if
func
.
name
==
'property'
:
is_property
=
True
elif
func
.
name
==
'staticmethod'
:
pass
else
:
error
(
self
.
pos
,
"Cannot handle %s decorators yet"
%
func
.
name
)
...
...
@@ -2421,16 +2424,12 @@ class CFuncDefNode(FuncDefNode):
type
.
is_const_method
=
self
.
is_const_method
type
.
is_static_method
=
self
.
is_static_method
property
=
False
if
self
.
decorators
:
for
_node
in
self
.
decorators
:
if
_node
.
decorator
.
is_name
and
_node
.
decorator
.
name
==
'property'
:
property
=
True
self
.
entry
=
env
.
declare_cfunction
(
name
,
type
,
self
.
pos
,
cname
=
cname
,
visibility
=
self
.
visibility
,
api
=
self
.
api
,
defining
=
self
.
body
is
not
None
,
modifiers
=
self
.
modifiers
,
overridable
=
self
.
overridable
,
property
=
property
)
overridable
=
self
.
overridable
,
is_property
=
is_
property
)
self
.
entry
.
inline_func_in_pxd
=
self
.
inline_in_pxd
self
.
return_type
=
type
.
return_type
if
self
.
return_type
.
is_array
and
self
.
visibility
!=
'extern'
:
...
...
This diff is collapsed.
Click to expand it.
Cython/Compiler/Symtab.py
View file @
53eb14de
...
...
@@ -753,7 +753,7 @@ class Scope(object):
def
declare_cfunction
(
self
,
name
,
type
,
pos
,
cname
=
None
,
visibility
=
'private'
,
api
=
0
,
in_pxd
=
0
,
defining
=
0
,
modifiers
=
(),
utility_code
=
None
,
overridable
=
False
,
property
=
False
):
overridable
=
False
,
is_
property
=
False
):
# Add an entry for a C function.
if
not
cname
:
if
visibility
!=
'private'
or
api
:
...
...
@@ -831,7 +831,7 @@ class Scope(object):
return
entry
def
add_cfunction
(
self
,
name
,
type
,
pos
,
cname
,
visibility
,
modifiers
,
inherited
=
False
,
property
=
False
):
inherited
=
False
,
is_
property
=
False
):
# Add a C function entry without giving it a func_cname.
entry
=
self
.
declare
(
name
,
cname
,
type
,
pos
,
visibility
)
entry
.
is_cfunction
=
1
...
...
@@ -839,7 +839,7 @@ class Scope(object):
entry
.
func_modifiers
=
modifiers
if
inherited
or
type
.
is_fused
:
self
.
cfunc_entries
.
append
(
entry
)
elif
property
:
elif
is_
property
:
self
.
property_entries
.
append
(
entry
)
else
:
# For backwards compatibility reasons, we must keep all non-fused methods
...
...
@@ -1440,7 +1440,7 @@ class ModuleScope(Scope):
def
declare_cfunction
(
self
,
name
,
type
,
pos
,
cname
=
None
,
visibility
=
'private'
,
api
=
0
,
in_pxd
=
0
,
defining
=
0
,
modifiers
=
(),
utility_code
=
None
,
overridable
=
False
,
property
=
False
):
overridable
=
False
,
is_
property
=
False
):
if
not
defining
and
'inline'
in
modifiers
:
# TODO(github/1736): Make this an error.
warning
(
pos
,
"Declarations should not be declared inline."
,
1
)
...
...
@@ -1464,7 +1464,7 @@ class ModuleScope(Scope):
self
,
name
,
type
,
pos
,
cname
=
cname
,
visibility
=
visibility
,
api
=
api
,
in_pxd
=
in_pxd
,
defining
=
defining
,
modifiers
=
modifiers
,
utility_code
=
utility_code
,
overridable
=
overridable
,
property
=
property
)
overridable
=
overridable
,
is_property
=
is_
property
)
return
entry
def
declare_global
(
self
,
name
,
pos
):
...
...
@@ -2220,7 +2220,7 @@ class CClassScope(ClassScope):
def
declare_cfunction
(
self
,
name
,
type
,
pos
,
cname
=
None
,
visibility
=
'private'
,
api
=
0
,
in_pxd
=
0
,
defining
=
0
,
modifiers
=
(),
utility_code
=
None
,
overridable
=
False
,
property
=
False
):
overridable
=
False
,
is_
property
=
False
):
if
get_special_method_signature
(
name
)
and
not
self
.
parent_type
.
is_builtin_type
:
error
(
pos
,
"Special methods must be declared with 'def', not 'cdef'"
)
args
=
type
.
args
...
...
@@ -2265,7 +2265,7 @@ class CClassScope(ClassScope):
"C method '%s' not previously declared in definition part of"
" extension type '%s'"
%
(
name
,
self
.
class_name
))
entry
=
self
.
add_cfunction
(
name
,
type
,
pos
,
cname
,
visibility
,
modifiers
,
property
=
property
)
modifiers
,
is_property
=
is_
property
)
if
defining
:
entry
.
func_cname
=
self
.
mangle
(
Naming
.
func_prefix
,
name
)
entry
.
utility_code
=
utility_code
...
...
@@ -2282,12 +2282,12 @@ class CClassScope(ClassScope):
return
entry
def
add_cfunction
(
self
,
name
,
type
,
pos
,
cname
,
visibility
,
modifiers
,
inherited
=
False
,
property
=
False
):
inherited
=
False
,
is_
property
=
False
):
# Add a cfunction entry without giving it a func_cname.
prev_entry
=
self
.
lookup_here
(
name
)
entry
=
ClassScope
.
add_cfunction
(
self
,
name
,
type
,
pos
,
cname
,
visibility
,
modifiers
,
inherited
=
inherited
,
property
=
property
)
inherited
=
inherited
,
is_property
=
is_
property
)
entry
.
is_cmethod
=
1
entry
.
prev_entry
=
prev_entry
return
entry
...
...
This diff is collapsed.
Click to expand it.
tests/run/ext_attr_getter.srctree
View file @
53eb14de
...
...
@@ -44,17 +44,17 @@ typedef struct {
int PyFoo_Get0F(FooStructOpaque *f)
{
return
((FooStructNominal*)f)->f0
;
return
PyFoo_GET0M(f)
;
}
int PyFoo_Get1F(FooStructOpaque *f)
{
return
((FooStructNominal*)f)->f1
;
return
PyFoo_GET1M(f)
;
}
int PyFoo_Get2F(FooStructOpaque *f)
{
return
((FooStructNominal*)f)->f2
;
return
PyFoo_GET2M(f)
;
}
#ifdef __cplusplus
...
...
This diff is collapsed.
Click to expand it.
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