diff options
author | Lisandro Dalcin <dalcinl@gmail.com> | 2020-08-03 16:08:16 +0300 |
---|---|---|
committer | Lisandro Dalcin <dalcinl@gmail.com> | 2020-08-03 16:08:16 +0300 |
commit | 45983898e9a7892ac0dba06660d9ed5fef766e02 (patch) | |
tree | 71661790bfdffe11899689a5cb409f0694fc9772 | |
parent | c2fab361c66fb6e4e2f1775b4eddf27e081721b3 (diff) | |
download | cython-dalcinl/fix-c-used-variable.tar.gz |
Fix unused variable warnings from C/C++ compilers in generated codedalcinl/fix-c-used-variable
* If both __setitem__ and __delitem__ special methods are defined, then
there is no need to get the type name to report an unsupported operation.
-rw-r--r-- | Cython/Compiler/ModuleNode.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index 64265e9af..9eb58513a 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -1866,8 +1866,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): code.putln( "static int %s(PyObject *o, PyObject *i, PyObject *v) {" % ( scope.mangle_internal("mp_ass_subscript"))) - code.putln( - "__Pyx_TypeName o_type_name;") + if not set_entry or not del_entry: + code.putln( + "__Pyx_TypeName o_type_name;") code.putln( "if (v) {") if set_entry: @@ -1941,8 +1942,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): code.putln( "static int %s(PyObject *o, Py_ssize_t i, Py_ssize_t j, PyObject *v) {" % ( scope.mangle_internal("sq_ass_slice"))) - code.putln( - "__Pyx_TypeName o_type_name;") + if not set_entry or not del_entry: + code.putln( + "__Pyx_TypeName o_type_name;") code.putln( "if (v) {") if set_entry: |