From 98ae9e0e2357a26ff692a9ed2259ed5bc8bd5551 Mon Sep 17 00:00:00 2001
From: Xavier Thompson <xavier.thompson@nexedi.com>
Date: Tue, 28 Jul 2020 17:57:19 +0200
Subject: [PATCH] Avoid locking the object on which a static method is called

---
 Cython/Compiler/ExprNodes.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py
index 9d0ea7c5a..4e94cb115 100644
--- a/Cython/Compiler/ExprNodes.py
+++ b/Cython/Compiler/ExprNodes.py
@@ -6283,7 +6283,9 @@ class SimpleCallNode(CallNode):
                 else:
                     actual_arg.ensure_rhs_locked(env, is_dereferenced = deref_flag)
             # XXX - Should we do something in a pyfunc case ?
-            if func_type.is_const_method:
+            if func_type.is_static_method:
+                pass # no need to lock the object on which a static method is called
+            elif func_type.is_const_method:
                 self.function.ensure_rhs_locked(env)
             else:
                 self.function.ensure_lhs_locked(env)
-- 
2.30.9