15
0

Accepting request 780358 from devel:languages:python

- Add PR292-Python38.patch to fix Python 3.8 incompatibilities
  (gh#jsonpickle/jsonpickle#281).

OBS-URL: https://build.opensuse.org/request/show/780358
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-jsonpickle?expand=0&rev=6
This commit is contained in:
2020-03-08 21:21:24 +00:00
committed by Git OBS Bridge
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'

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d3e922d781b1d0096df2dad89a2e1f47177d7969b596aea806a9d91b4626b29b
size 74693

3
jsonpickle-1.3.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:71bca2b80ae28af4e3f86629ef247100af7f97032b5ca8d791c1f8725b411d95
size 76571

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Feb 28 18:31:13 CET 2020 - Matej Cepl <mcepl@suse.com>
- Add PR292-Python38.patch to fix Python 3.8 incompatibilities
(gh#jsonpickle/jsonpickle#281).
-------------------------------------------------------------------
Thu Dec 5 18:13:07 CET 2019 - Matej Cepl <mcepl@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-jsonpickle
#
# Copyright (c) 2019 SUSE LLC
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,14 +17,18 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define modname jsonpickle
Name: python-jsonpickle
Version: 1.2
Version: 1.3
Release: 0
Summary: Python library for serializing any arbitrary object graph into JSON
License: BSD-3-Clause
Group: Development/Languages/Python
URL: https://github.com/jsonpickle/jsonpickle
Source: https://files.pythonhosted.org/packages/source/j/jsonpickle/jsonpickle-%{version}.tar.gz
# PATCH-FIX-UPSTREAM PR292-Python38.patch gh#jsonpickle/jsonpickle#281 mcepl@suse.com
# Fix Python 3.8 incompatibilities
Patch01: PR292-Python38.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -57,7 +61,7 @@ It can take almost any Python object and turn the object into JSON.
Additionally, it can reconstitute the object back into Python.
%prep
%setup -q -n jsonpickle-%{version}
%autosetup -p1 -n %{modname}-%{version}
%build
%python_build
@@ -67,8 +71,7 @@ Additionally, it can reconstitute the object back into Python.
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
# Exclusions because of gh#jsonpickle/jsonpickle#281
%pytest -k 'not (test_thing_with_fd or test_list_with_fd or test_dict_with_fd)'
%pytest
%files %{python_files}
%doc README.rst docs/source/changelog.rst