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
9789f14e
Commit
9789f14e
authored
Apr 18, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved DictGetItem utility code into ObjectHandling.c
parent
6d72f76e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
27 deletions
+25
-27
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-27
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+23
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
9789f14e
...
...
@@ -2916,7 +2916,8 @@ class IndexNode(ExprNode):
index_code
=
self
.
index
.
py_result
()
if
self
.
base
.
type
is
dict_type
:
function
=
"__Pyx_PyDict_GetItem"
code
.
globalstate
.
use_utility_code
(
getitem_dict_utility_code
)
code
.
globalstate
.
use_utility_code
(
UtilityCode
.
load_cached
(
"DictGetItem"
,
"ObjectHandling.c"
))
else
:
function
=
"PyObject_GetItem"
code
.
putln
(
...
...
@@ -9741,32 +9742,6 @@ requires = [raise_unbound_local_error_utility_code])
#------------------------------------------------------------------------------------
getitem_dict_utility_code
=
UtilityCode
(
proto
=
"""
#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
PyObject *value;
if (unlikely(d == Py_None)) {
__Pyx_RaiseNoneIndexingError();
return NULL;
}
value = PyDict_GetItemWithError(d, key);
if (unlikely(!value)) {
if (!PyErr_Occurred())
PyErr_SetObject(PyExc_KeyError, key);
return NULL;
}
Py_INCREF(value);
return value;
}
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif
"""
,
requires
=
[
raise_noneindex_error_utility_code
])
#------------------------------------------------------------------------------------
getitem_int_pyunicode_utility_code
=
UtilityCode
(
proto
=
'''
#define __Pyx_GetItemInt_Unicode(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ?
\
\
...
...
Cython/Utility/ObjectHandling.c
View file @
9789f14e
...
...
@@ -235,6 +235,29 @@ static CYTHON_INLINE int __Pyx_IterFinish(void) {
#endif
}
/////////////// DictGetItem.proto ///////////////
//@requires: RaiseNoneIndexingError
#if PY_MAJOR_VERSION >= 3
static
PyObject
*
__Pyx_PyDict_GetItem
(
PyObject
*
d
,
PyObject
*
key
)
{
PyObject
*
value
;
if
(
unlikely
(
d
==
Py_None
))
{
__Pyx_RaiseNoneIndexingError
();
return
NULL
;
}
value
=
PyDict_GetItemWithError
(
d
,
key
);
if
(
unlikely
(
!
value
))
{
if
(
!
PyErr_Occurred
())
PyErr_SetObject
(
PyExc_KeyError
,
key
);
return
NULL
;
}
Py_INCREF
(
value
);
return
value
;
}
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif
/////////////// FindPy2Metaclass.proto ///////////////
static
PyObject
*
__Pyx_FindPy2Metaclass
(
PyObject
*
bases
);
/*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