fix: prevent RecursionError when pickling Config

On Python 3.8+ with macOS, the multiprocessing module uses 'spawn' by
default which pickles objects. When pickle.load tries to read
__setstate__ before __dict__ is restored, it hits __getattr__ causing
infinite recursion. Adding a special case for 'settings' prevents this.

Closes #2401
This commit is contained in:
Benoit Chesneau 2026-01-23 10:59:56 +01:00
parent a182066bea
commit 8e75b3aba3

View File

@ -62,6 +62,8 @@ class Config:
return "\n".join(lines)
def __getattr__(self, name):
if name == "settings":
raise AttributeError()
if name not in self.settings:
raise AttributeError("No configuration setting for: %s" % name)
return self.settings[name].get()