Skip to content

Commit 2ae1ff4

Browse files
authored
[FIX] - annotation handling for Python 3.14+ versions (#305) (#309)
1 parent 6ffdef7 commit 2ae1ff4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scheduler/settings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ def conf_settings():
4343
return
4444
if not isinstance(user_settings, dict):
4545
raise ImproperlyConfigured("SCHEDULER_CONFIG should be a SchedulerConfiguration or dict")
46-
annotations = get_annotations(SCHEDULER_CONFIG)
46+
47+
# Use `type(obj)` because Python 3.14+ `annotationlib.get_annotations()` works only on classes/functions/modules.
48+
# It reads __annotations__ or __annotate__; instances without annotations will fail.
49+
annotations = get_annotations(type(SCHEDULER_CONFIG))
4750
for k, v in user_settings.items():
4851
if k not in annotations:
4952
raise ImproperlyConfigured(f"Unknown setting {k} in SCHEDULER_CONFIG")

0 commit comments

Comments
 (0)