@@ -123,7 +123,7 @@ def build_filter_kwargs(filters):
123
123
return filter_kwargs , filter_methods
124
124
125
125
126
- @functools .lru_cache (maxsize = None )
126
+ @functools .lru_cache (maxsize = 256 )
127
127
def function_allow_passing_info (filter_method : FunctionType ) -> bool :
128
128
argspec = inspect .getfullargspec (filter_method )
129
129
@@ -146,7 +146,10 @@ def apply(filters, queryset: QuerySet, info=UNSET, pk=UNSET) -> QuerySet:
146
146
147
147
filter_method = getattr (filters , "filter" , None )
148
148
if filter_method :
149
- if function_allow_passing_info (filter_method ):
149
+ if function_allow_passing_info (
150
+ # Pass the original __func__ which is always the same
151
+ getattr (filter_method , "__func__" , filter_method )
152
+ ):
150
153
return filter_method (queryset = queryset , info = info )
151
154
152
155
else :
@@ -155,7 +158,10 @@ def apply(filters, queryset: QuerySet, info=UNSET, pk=UNSET) -> QuerySet:
155
158
filter_kwargs , filter_methods = build_filter_kwargs (filters )
156
159
queryset = queryset .filter (** filter_kwargs )
157
160
for filter_method in filter_methods :
158
- if function_allow_passing_info (filter_method ):
161
+ if function_allow_passing_info (
162
+ # Pass the original __func__ which is always the same
163
+ getattr (filter_method , "__func__" , filter_method )
164
+ ):
159
165
queryset = filter_method (queryset = queryset , info = info )
160
166
161
167
else :
0 commit comments