From 3fc27935a2712880e3208c1aced9510299f1c27c Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Tue, 28 Oct 2008 15:07:58 -0700 Subject: [PATCH] Fix segfault/invalid value in argument parsing code. Also remove inline for non-critial path. Reducing the total footprint by making error code non-inline helps with code size and can also speed up the critical path. --- Cython/Compiler/Nodes.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index f9e96f33..cd349a71 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -1963,6 +1963,7 @@ class DefNode(FuncDefNode): # args tuple code.putln('} else {') code.putln('switch (PyTuple_GET_SIZE(%s)) {' % Naming.args_cname) + code.putln('default:') reversed_args = list(enumerate(positional_args))[::-1] for i, arg in reversed_args: if i >= min_positional_args-1: @@ -4683,11 +4684,11 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed raise_argtuple_invalid_utility_code = UtilityCode( proto = """ -static INLINE void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ """, impl = """ -static INLINE void __Pyx_RaiseArgtupleInvalid( +static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, @@ -4739,11 +4740,11 @@ static INLINE void __Pyx_RaiseKeywordRequired( raise_double_keywords_utility_code = UtilityCode( proto = """ -static INLINE void __Pyx_RaiseDoubleKeywordsError( +static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name); /*proto*/ """, impl = """ -static INLINE void __Pyx_RaiseDoubleKeywordsError( +static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { -- 2.26.2