Commit f3b71348 authored by Stefan Behnel's avatar Stefan Behnel

Avoid calling _PyDict_NewPresized() for len(dict) <=8, which is the minimum dict size in CPython.

parent c132ad9c
......@@ -1742,7 +1742,7 @@ static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_c
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
int result;
PyObject *globals, *result_obj;
globals = __Pyx_PyDict_NewPresized(4); if (unlikely(!globals)) goto ignore;
globals = PyDict_New(); if (unlikely(!globals)) goto ignore;
result = PyDict_SetItemString(globals, "_cython_coroutine_type",
#ifdef __Pyx_Coroutine_USED
(PyObject*)__pyx_CoroutineType);
......
......@@ -256,7 +256,7 @@
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n) _PyDict_NewPresized(n)
#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n) PyDict_New()
#endif
......
......@@ -83,7 +83,7 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
return -1;
}
if (stream) {
kwargs = __Pyx_PyDict_NewPresized(2);
kwargs = PyDict_New();
if (unlikely(!kwargs))
return -1;
if (unlikely(PyDict_SetItem(kwargs, PYIDENT("file"), stream) < 0))
......@@ -100,7 +100,7 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
}
} else if (!newline) {
if (unlikely(!$print_function_kwargs)) {
$print_function_kwargs = __Pyx_PyDict_NewPresized(1);
$print_function_kwargs = PyDict_New();
if (unlikely(!$print_function_kwargs))
return -1;
end_string = PyUnicode_FromStringAndSize(" ", 1);
......
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