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
Boxiang Sun
cython
Commits
b421819a
Commit
b421819a
authored
Mar 09, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use inlined setattr also for delattr
parent
76f2ea63
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+7
-3
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+2
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
b421819a
...
...
@@ -1953,8 +1953,10 @@ class NameNode(AtomicExprNode):
else
:
code
.
put_error_if_neg
(
self
.
pos
,
del_code
)
elif
self
.
entry
.
is_pyglobal
:
code
.
globalstate
.
use_utility_code
(
UtilityCode
.
load_cached
(
"PyObjectSetAttrStr"
,
"ObjectHandling.c"
))
interned_cname
=
code
.
intern_identifier
(
self
.
entry
.
name
)
del_code
=
'
PyObject_DelAt
tr(%s, %s)'
%
(
del_code
=
'
__Pyx_PyObject_DelAttrS
tr(%s, %s)'
%
(
Naming
.
module_cname
,
interned_cname
)
if
ignore_nonexisting
:
code
.
putln
(
'if (unlikely(%s < 0)) { if (likely(PyErr_ExceptionMatches(PyExc_AttributeError))) PyErr_Clear(); else %s }'
%
(
...
...
@@ -5210,10 +5212,12 @@ class AttributeNode(ExprNode):
def
generate_deletion_code
(
self
,
code
,
ignore_nonexisting
=
False
):
self
.
obj
.
generate_evaluation_code
(
code
)
if
self
.
is_py_attr
or
(
isinstance
(
self
.
entry
.
scope
,
Symtab
.
PropertyScope
)
if
self
.
is_py_attr
or
(
self
.
entry
.
scope
.
is_property_scope
and
u'__del__'
in
self
.
entry
.
scope
.
entries
):
code
.
globalstate
.
use_utility_code
(
UtilityCode
.
load_cached
(
"PyObjectSetAttrStr"
,
"ObjectHandling.c"
))
code
.
put_error_if_neg
(
self
.
pos
,
'
PyObject_DelAt
tr(%s, %s)'
%
(
'
__Pyx_PyObject_DelAttrS
tr(%s, %s)'
%
(
self
.
obj
.
py_result
(),
code
.
intern_identifier
(
self
.
attribute
)))
else
:
...
...
Cython/Utility/ObjectHandling.c
View file @
b421819a
...
...
@@ -660,6 +660,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject
/////////////// PyObjectSetAttrStr.proto ///////////////
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
static
CYTHON_INLINE
int
__Pyx_PyObject_SetAttrStr
(
PyObject
*
obj
,
PyObject
*
attr_name
,
PyObject
*
value
)
{
PyTypeObject
*
tp
=
Py_TYPE
(
obj
);
if
(
likely
(
tp
->
tp_setattro
))
...
...
@@ -671,6 +672,7 @@ static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr
return
PyObject_SetAttr
(
obj
,
attr_name
,
value
);
}
#else
#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif
...
...
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