From 7a2c616e575d116158c78f235b94e84fc35c06bd Mon Sep 17 00:00:00 2001
From: Kazuhiko SHIOZAKI <kazuhiko@nexedi.com>
Date: Wed, 8 Mar 2023 16:28:24 +0000
Subject: [PATCH] fixup! Zope2: use func_code if __code__ is missing, that is
 the case for Script (Python).

---
 product/ZSQLCatalog/SQLCatalog.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/product/ZSQLCatalog/SQLCatalog.py b/product/ZSQLCatalog/SQLCatalog.py
index 355a0a641f..615c89ae43 100644
--- a/product/ZSQLCatalog/SQLCatalog.py
+++ b/product/ZSQLCatalog/SQLCatalog.py
@@ -1451,7 +1451,7 @@ class Catalog(Folder,
     if meta_type in self.HAS_ARGUMENT_SRC_METATYPE_SET:
       return method.arguments_src.split()
     elif meta_type in self.HAS_FUNC_CODE_METATYPE_SET:
-      func_code = method.__code__
+      func_code = getattr(method, '__code__', None)
       if func_code is None: # BBB Zope2
         func_code = method.func_code
       return func_code.co_varnames[:func_code.co_argcount]
@@ -1840,7 +1840,7 @@ class Catalog(Folder,
       else:
         search_key = self.getSearchKey(key, 'RelatedKey')
     else:
-      func_code = script.__code__
+      func_code = getattr(script, '__code__', None)
       if func_code is None: # BBB Zope2
         func_code = script.func_code
       search_key = (
-- 
2.30.9