use Py_CLEAR
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index ad0f427..51b6c9d 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -784,9 +784,7 @@
 static int
 sm_clear(staticmethod *sm)
 {
-    Py_XDECREF(sm->sm_callable);
-    sm->sm_callable = NULL;
-
+    Py_CLEAR(sm->sm_callable);
     return 0;
 }