mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Ensure that registered Config defaults are serializable to JSON (#5557)
This commit is contained in:
parent
9baf9ba546
commit
b0ab6186ef
@ -1,5 +1,6 @@
|
||||
import asyncio
|
||||
import collections.abc
|
||||
import json
|
||||
import logging
|
||||
import pickle
|
||||
import weakref
|
||||
@ -807,7 +808,8 @@ class Config(metaclass=ConfigMeta):
|
||||
if key not in self._defaults:
|
||||
self._defaults[key] = {}
|
||||
|
||||
data = pickle.loads(pickle.dumps(kwargs, -1))
|
||||
# this serves as a 'deep copy' and verification that the default is serializable to JSON
|
||||
data = json.loads(json.dumps(kwargs))
|
||||
|
||||
for k, v in data.items():
|
||||
to_add = self._get_defaults_dict(k, v)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user