File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed
src/marshmallow_sqlalchemy Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change 11Changelog
22---------
33
4+ (unreleased)
5+ ++++++++++++
6+
7+ Bug fixes:
8+
9+ * Fix memory usage regression in 1.4.1 (:issue: `665 `).
10+ Thanks :user: `mistercrunch ` for reporting and sending a PR.
11+
4121.4.1 (2025-02-10)
513++++++++++++++++++
614
Original file line number Diff line number Diff line change @@ -178,22 +178,16 @@ def _maybe_filter_foreign_keys(
178178 and not issubclass (base , SQLAlchemyAutoSchema )
179179 ]
180180
181- def is_declared_field (field : str ) -> bool :
182- return any (
183- field
184- in [
185- name
186- for name , _ in _get_fields (
187- getattr (base , "_declared_fields" , base .__dict__ )
188- )
189- ]
190- for base in non_auto_schema_bases
191- )
181+ # Pre-compute declared fields only once
182+ declared_fields : set [Any ] = set ()
183+ for base in non_auto_schema_bases :
184+ base_fields = getattr (base , "_declared_fields" , base .__dict__ )
185+ declared_fields .update (name for name , _ in _get_fields (base_fields ))
192186
193187 return [
194188 (name , field )
195189 for name , field in fields
196- if name not in foreign_keys or is_declared_field ( name )
190+ if name not in foreign_keys or name in declared_fields
197191 ]
198192 return fields
199193
You can’t perform that action at this time.
0 commit comments