mirror of
https://github.com/frappe/gunicorn.git
synced 2026-07-01 18:21:30 +08:00
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:
parent
a182066bea
commit
8e75b3aba3
@ -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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user