15
0

- Add PR292-Python38.patch to fix Python 3.8 incompatibilities

(gh#jsonpickle/jsonpickle#281).

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-jsonpickle?expand=0&rev=16
This commit is contained in:
2020-02-28 17:46:34 +00:00
committed by Git OBS Bridge
parent 75904ecb7b
commit 548c1e69cc
5 changed files with 58 additions and 8 deletions

41
PR292-Python38.patch Normal file
View File

@@ -0,0 +1,41 @@
--- a/jsonpickle/handlers.py
+++ b/jsonpickle/handlers.py
@@ -10,7 +10,9 @@ A handler can be bound to other types by
from __future__ import absolute_import, division, unicode_literals
import copy
import datetime
+import io
import re
+import sys
import threading
import uuid
@@ -254,3 +256,18 @@ class LockHandler(BaseHandler):
_lock = threading.Lock()
LockHandler.handles(_lock.__class__)
+
+
+class TextIOHandler(BaseHandler):
+ """Serialize file descriptors as None because we cannot roundtrip"""
+
+ def flatten(self, obj, data):
+ return None
+
+ def restore(self, data):
+ """Restore should never get called because flatten() returns None"""
+ raise AssertionError('Restoring IO.TextIOHandler is not supported')
+
+
+if sys.version_info >= (3, 8):
+ TextIOHandler.handles(io.TextIOWrapper)
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -12,5 +12,5 @@ pytest
pytest-cov
simplejson
sqlalchemy
-ujson
-yajl; sys_platform != 'win32'
+ujson; python_version < '3.8'
+yajl; sys_platform != 'win32' and python_version < '3.8'