mirror of
https://github.com/evennia/evennia.git
synced 2026-03-26 17:56:32 +01:00
Convert string to bytes safely, resolves #1770.
This commit is contained in:
parent
3e7275f367
commit
68f10b25b1
2 changed files with 3 additions and 3 deletions
|
|
@ -30,7 +30,7 @@ except ImportError:
|
|||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.utils.safestring import SafeString, SafeBytes
|
||||
from evennia.utils.utils import uses_database, is_iter
|
||||
from evennia.utils.utils import uses_database, is_iter, to_str, to_bytes
|
||||
from evennia.utils import logger
|
||||
|
||||
__all__ = ("to_pickle", "from_pickle", "do_pickle", "do_unpickle",
|
||||
|
|
@ -679,7 +679,7 @@ def do_pickle(data):
|
|||
|
||||
def do_unpickle(data):
|
||||
"""Retrieve pickle from pickled string"""
|
||||
return loads(data)
|
||||
return loads(to_bytes(data))
|
||||
|
||||
|
||||
def dbserialize(data):
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ try:
|
|||
except ImportError:
|
||||
from pickle import loads, dumps # cpython 3.x, other interpreters
|
||||
|
||||
DEFAULT_PROTOCOL = 2
|
||||
DEFAULT_PROTOCOL = 4
|
||||
|
||||
|
||||
class PickledObject(str):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue