Commit c3e11181 authored by Stefan Behnel's avatar Stefan Behnel

Use _PyDict_Pop() only when available (CPython 3.6+).

parent 5f4e51e7
...@@ -2931,8 +2931,9 @@ class OptimizeBuiltinCalls(Visitor.NodeRefCleanupMixin, ...@@ -2931,8 +2931,9 @@ class OptimizeBuiltinCalls(Visitor.NodeRefCleanupMixin,
return self._substitute_method_call( return self._substitute_method_call(
node, function, node, function,
"_PyDict_Pop", self.PyDict_Pop_func_type, "__Pyx_PyDict_Pop", self.PyDict_Pop_func_type,
'pop', is_unbound_method, args) 'pop', is_unbound_method, args,
utility_code=load_c_utility('py_dict_pop'))
Pyx_PyInt_BinopInt_func_type = PyrexTypes.CFuncType( Pyx_PyInt_BinopInt_func_type = PyrexTypes.CFuncType(
PyrexTypes.py_object_type, [ PyrexTypes.py_object_type, [
......
...@@ -269,6 +269,26 @@ static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *ke ...@@ -269,6 +269,26 @@ static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *ke
#define __Pyx_PyDict_Clear(d) (PyDict_Clear(d), 0) #define __Pyx_PyDict_Clear(d) (PyDict_Clear(d), 0)
/////////////// py_dict_pop.proto ///////////////
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B3
#define __Pyx_PyDict_Pop(d, key, default_value) _PyDict_Pop(d, key, default_value)
#else
static CYTHON_INLINE PyObject *__Pyx_PyDict_Pop(PyObject *d, PyObject *key, PyObject *default_value); /*proto*/
#endif
/////////////// py_dict_pop ///////////////
#if !(CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B3)
static CYTHON_INLINE PyObject *__Pyx_PyDict_Pop(PyObject *d, PyObject *key, PyObject *default_value) {
// 'default_value' can be NULL
return PyObject_CallMethodObjArgs(d, PYIDENT("pop"), key, default_value);
}
#endif
/////////////// dict_iter.proto /////////////// /////////////// dict_iter.proto ///////////////
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name, static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment