Skip to content

Commit 6b6dc51

Browse files
authored
Fix thread-local recursion guard initialization (#191)
Thread-local variables must be initialized at runtime (i.e. in their own thread), not globally at import time. Fixes #190
1 parent 04c6e3d commit 6b6dc51

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

marshmallow_dataclass/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ class User:
8080

8181
# Recursion guard for class_schema()
8282
_RECURSION_GUARD = threading.local()
83-
_RECURSION_GUARD.seen_classes = {}
8483

8584

8685
@overload
@@ -352,6 +351,7 @@ def class_schema(
352351
clazz_frame = current_frame.f_back
353352
# Per https://docs.python.org/3/library/inspect.html#the-interpreter-stack
354353
del current_frame
354+
_RECURSION_GUARD.seen_classes = {}
355355
try:
356356
return _internal_class_schema(clazz, base_schema, clazz_frame)
357357
finally:

0 commit comments

Comments
 (0)