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
adc5a3ea
Commit
adc5a3ea
authored
May 17, 2011
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug in property attribute access exposed by pure mode.
parent
1619617d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
10 deletions
+6
-10
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+0
-10
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+6
-0
No files found.
Cython/Compiler/Nodes.py
View file @
adc5a3ea
...
...
@@ -948,15 +948,6 @@ class CVarDefNode(StatNode):
dest_scope
=
env
self
.
dest_scope
=
dest_scope
base_type
=
self
.
base_type
.
analyse
(
env
)
# If the field is an external typedef, we cannot be sure about the type,
# so do conversion ourself rather than rely on the CPython mechanism (through
# a property; made in AnalyseDeclarationsTransform).
if
(
dest_scope
.
is_c_class_scope
and
self
.
visibility
in
(
'public'
,
'readonly'
)):
need_property
=
True
else
:
need_property
=
False
visibility
=
self
.
visibility
for
declarator
in
self
.
declarators
:
...
...
@@ -990,7 +981,6 @@ class CVarDefNode(StatNode):
"Only 'extern' C variable declaration allowed in .pxd file"
)
entry
=
dest_scope
.
declare_var
(
name
,
type
,
declarator
.
pos
,
cname
=
cname
,
visibility
=
visibility
,
api
=
self
.
api
,
is_cdef
=
1
)
entry
.
needs_property
=
need_property
class
CStructOrUnionDefNode
(
StatNode
):
...
...
Cython/Compiler/Symtab.py
View file @
adc5a3ea
...
...
@@ -1600,6 +1600,10 @@ class CClassScope(ClassScope):
error
(
pos
,
"Attribute of extension type cannot be declared %s"
%
visibility
)
if
visibility
in
(
'public'
,
'readonly'
):
# If the field is an external typedef, we cannot be sure about the type,
# so do conversion ourself rather than rely on the CPython mechanism (through
# a property; made in AnalyseDeclarationsTransform).
entry
.
needs_property
=
True
if
name
==
"__weakref__"
:
error
(
pos
,
"Special attribute __weakref__ cannot be exposed to Python"
)
if
not
type
.
is_pyobject
:
...
...
@@ -1608,6 +1612,8 @@ class CClassScope(ClassScope):
type
.
create_from_py_utility_code
(
self
))):
error
(
pos
,
"C attribute of type '%s' cannot be accessed from Python"
%
type
)
else
:
entry
.
needs_property
=
False
return
entry
else
:
if
type
is
unspecified_type
:
...
...
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