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
Kirill Smelkov
cython
Commits
51240f2e
Commit
51240f2e
authored
Oct 08, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed up assignments in Python class bodies.
parent
d150293c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-1
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+15
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
51240f2e
...
...
@@ -2210,7 +2210,8 @@ class NameNode(AtomicExprNode):
setter
=
'PyDict_SetItem'
namespace
=
Naming
.
moddict_cname
elif
entry
.
is_pyclass_attr
:
setter
=
'PyObject_SetItem'
code
.
globalstate
.
use_utility_code
(
UtilityCode
.
load_cached
(
"SetNameInClass"
,
"ObjectHandling.c"
))
setter
=
'__Pyx_SetNameInClass'
else
:
assert
False
,
repr
(
entry
)
code
.
put_error_if_neg
(
...
...
Cython/Utility/ObjectHandling.c
View file @
51240f2e
...
...
@@ -1041,6 +1041,21 @@ static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) {
return
result
;
}
/////////////// SetNameInClass.proto ///////////////
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
// Identifier names are always interned and have a pre-calculated hash value.
#define __Pyx_SetNameInClass(ns, name, value) \
(likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
#elif CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_SetNameInClass(ns, name, value) \
(likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
#else
#define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value)
#endif
/////////////// GetModuleGlobalName.proto ///////////////
static
CYTHON_INLINE
PyObject
*
__Pyx_GetModuleGlobalName
(
PyObject
*
name
);
/*proto*/
...
...
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