Hello community,

here is the log from the commit of package python-cbor2 for openSUSE:Factory 
checked in at 2020-03-30 23:06:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-cbor2 (Old)
 and      /work/SRC/openSUSE:Factory/.python-cbor2.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-cbor2"

Mon Mar 30 23:06:46 2020 rev:4 rq:789799 version:5.1.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-cbor2/python-cbor2.changes        
2020-03-10 09:51:11.808018654 +0100
+++ /work/SRC/openSUSE:Factory/.python-cbor2.new.3160/python-cbor2.changes      
2020-03-30 23:06:51.592294660 +0200
@@ -1,0 +2,10 @@
+Mon Mar 30 12:59:56 UTC 2020 - Marketa Calabkova <[email protected]>
+
+- update to version 5.1.0
+  * Minor API change :class:`CBORSimpleValue` is now a subclass of namedtuple 
and allows
+    all numeric comparisons. This brings functional parity between C and 
Python modules.
+  * Fixes for C-module on big-endian systems including floating point 
decoding, smallint encoding,
+    and boolean argument handling. Tested on s390x and MIPS32.
+  * Increase version requred of setuptools during install due to unicode 
errors.
+
+-------------------------------------------------------------------

Old:
----
  cbor2-5.0.1.tar.gz

New:
----
  cbor2-5.1.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-cbor2.spec ++++++
--- /var/tmp/diff_new_pack.Sd4EkN/_old  2020-03-30 23:06:52.584295226 +0200
+++ /var/tmp/diff_new_pack.Sd4EkN/_new  2020-03-30 23:06:52.588295227 +0200
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-cbor2
-Version:        5.0.1
+Version:        5.1.0
 Release:        0
 Summary:        Pure Python CBOR (de)serializer with extensive tag support
 License:        MIT
@@ -26,7 +26,7 @@
 Source:         
https://files.pythonhosted.org/packages/source/c/cbor2/cbor2-%{version}.tar.gz
 BuildRequires:  %{python_module devel}
 BuildRequires:  %{python_module pytest}
-BuildRequires:  %{python_module setuptools >= 36.2.7}
+BuildRequires:  %{python_module setuptools >= 40.7.0}
 BuildRequires:  %{python_module setuptools_scm >= 1.7.0}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros

++++++ cbor2-5.0.1.tar.gz -> cbor2-5.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cbor2-5.0.1/.travis.yml new/cbor2-5.1.0/.travis.yml
--- old/cbor2-5.0.1/.travis.yml 2020-01-21 15:50:41.000000000 +0100
+++ new/cbor2-5.1.0/.travis.yml 2020-03-18 18:22:03.000000000 +0100
@@ -1,4 +1,4 @@
-dist: xenial
+dist: bionic
 language: python
 python: "3.6"
 
@@ -16,11 +16,11 @@
 
     - stage: test
       env: TOXENV=pypy
-      python: pypy2.7-6.0
+      python: pypy2.7-7.2.0
 
     - stage: test
       env: TOXENV=pypy3
-      python: pypy3.5-6.0
+      python: pypy3.6-7.2.0
 
     - stage: test
       env: TOXENV=py27
@@ -41,6 +41,11 @@
     - stage: test
       env: TOXENV=py38
       python: "3.8"
+      
+    - stage: test
+      env: TOXENV=py38
+      python: "3.8"
+      arch: s390x
 
     - stage: deploy to pypi
       install: true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cbor2-5.0.1/PKG-INFO new/cbor2-5.1.0/PKG-INFO
--- old/cbor2-5.0.1/PKG-INFO    2020-01-21 15:50:57.000000000 +0100
+++ new/cbor2-5.1.0/PKG-INFO    2020-03-18 18:22:18.000000000 +0100
@@ -1,11 +1,11 @@
 Metadata-Version: 2.1
 Name: cbor2
-Version: 5.0.1
+Version: 5.1.0
 Summary: Pure Python CBOR (de)serializer with extensive tag support
 Home-page: UNKNOWN
 Author: Alex Grönholm
 Author-email: [email protected]
-Maintainer: Kio Smallwood
+Maintainer: Kio Smallwood (Sekenre)
 Maintainer-email: [email protected]
 License: MIT
 Project-URL: Documentation, https://cbor2.readthedocs.org/en/latest/
@@ -41,9 +41,9 @@
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
 Provides-Extra: test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cbor2-5.0.1/cbor2/types.py 
new/cbor2-5.1.0/cbor2/types.py
--- old/cbor2-5.0.1/cbor2/types.py      2020-01-21 15:50:41.000000000 +0100
+++ new/cbor2-5.1.0/cbor2/types.py      2020-03-18 18:22:03.000000000 +0100
@@ -1,6 +1,8 @@
-from .compat import Mapping, recursive_repr
+from collections import namedtuple
 from functools import total_ordering
 
+from .compat import Mapping, recursive_repr
+
 
 class CBORError(Exception):
     "Base class for errors that occur during CBOR encoding or decoding."
@@ -62,36 +64,50 @@
         return 'CBORTag({self.tag}, {self.value!r})'.format(self=self)
 
 
-class CBORSimpleValue(object):
+class CBORSimpleValue(namedtuple('CBORSimpleValue', ['value'])):
     """
     Represents a CBOR "simple value".
 
     :param int value: the value (0-255)
     """
 
-    __slots__ = 'value'
+    __slots__ = ()
+    __hash__ = namedtuple.__hash__
 
-    def __init__(self, value):
+    def __new__(cls, value):
         if value < 0 or value > 255:
             raise TypeError('simple value out of range (0..255)')
-        self.value = value
+        return super(CBORSimpleValue, cls).__new__(cls, value)
 
     def __eq__(self, other):
-        if isinstance(other, CBORSimpleValue):
-            return self.value == other.value
-        elif isinstance(other, int):
+        if isinstance(other, int):
             return self.value == other
-        return NotImplemented
+        return super(CBORSimpleValue, self).__eq__(other)
 
     def __ne__(self, other):
-        if isinstance(other, CBORSimpleValue):
-            return self.value != other.value
-        elif isinstance(other, int):
+        if isinstance(other, int):
             return self.value != other
-        return NotImplemented
+        return super(CBORSimpleValue, self).__ne__(other)
 
-    def __repr__(self):
-        return 'CBORSimpleValue(value={self.value})'.format(self=self)
+    def __lt__(self, other):
+        if isinstance(other, int):
+            return self.value < other
+        return super(CBORSimpleValue, self).__lt__(other)
+
+    def __le__(self, other):
+        if isinstance(other, int):
+            return self.value <= other
+        return super(CBORSimpleValue, self).__le__(other)
+
+    def __ge__(self, other):
+        if isinstance(other, int):
+            return self.value >= other
+        return super(CBORSimpleValue, self).__ge__(other)
+
+    def __gt__(self, other):
+        if isinstance(other, int):
+            return self.value > other
+        return super(CBORSimpleValue, self).__gt__(other)
 
 
 class FrozenDict(Mapping):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cbor2-5.0.1/cbor2.egg-info/PKG-INFO 
new/cbor2-5.1.0/cbor2.egg-info/PKG-INFO
--- old/cbor2-5.0.1/cbor2.egg-info/PKG-INFO     2020-01-21 15:50:57.000000000 
+0100
+++ new/cbor2-5.1.0/cbor2.egg-info/PKG-INFO     2020-03-18 18:22:18.000000000 
+0100
@@ -1,11 +1,11 @@
 Metadata-Version: 2.1
 Name: cbor2
-Version: 5.0.1
+Version: 5.1.0
 Summary: Pure Python CBOR (de)serializer with extensive tag support
 Home-page: UNKNOWN
 Author: Alex Grönholm
 Author-email: [email protected]
-Maintainer: Kio Smallwood
+Maintainer: Kio Smallwood (Sekenre)
 Maintainer-email: [email protected]
 License: MIT
 Project-URL: Documentation, https://cbor2.readthedocs.org/en/latest/
@@ -41,9 +41,9 @@
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
 Provides-Extra: test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cbor2-5.0.1/docs/versionhistory.rst 
new/cbor2-5.1.0/docs/versionhistory.rst
--- old/cbor2-5.0.1/docs/versionhistory.rst     2020-01-21 15:50:41.000000000 
+0100
+++ new/cbor2-5.1.0/docs/versionhistory.rst     2020-03-18 18:22:03.000000000 
+0100
@@ -5,6 +5,14 @@
 
 This library adheres to `Semantic Versioning <http://semver.org/>`_.
 
+**5.1.0** (2020-03-18)
+
+- Minor API change :class:`CBORSimpleValue` is now a subclass of namedtuple 
and allows
+  all numeric comparisons. This brings functional parity between C and Python 
modules.
+- Fixes for C-module on big-endian systems including floating point decoding, 
smallint encoding,
+  and boolean argument handling. Tested on s390x and MIPS32.
+- Increase version requred of setuptools during install due to unicode errors.
+
 **5.0.1** (2020-01-21)
 
 - Fix deprecation warning on python 3.7, 3.8 (mariano54)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cbor2-5.0.1/setup.cfg new/cbor2-5.1.0/setup.cfg
--- old/cbor2-5.0.1/setup.cfg   2020-01-21 15:50:57.000000000 +0100
+++ new/cbor2-5.1.0/setup.cfg   2020-03-18 18:22:18.000000000 +0100
@@ -4,7 +4,7 @@
 long_description = file: README.rst
 author = Alex Grönholm
 author_email = [email protected]
-maintainer = Kio Smallwood
+maintainer = Kio Smallwood (Sekenre)
 maintainer_email = [email protected]
 project_urls = 
        Documentation = https://cbor2.readthedocs.org/en/latest/
@@ -19,11 +19,11 @@
        Programming Language :: Python
        Programming Language :: Python :: 2.7
        Programming Language :: Python :: 3
-       Programming Language :: Python :: 3.3
        Programming Language :: Python :: 3.4
        Programming Language :: Python :: 3.5
        Programming Language :: Python :: 3.6
        Programming Language :: Python :: 3.7
+       Programming Language :: Python :: 3.8
 
 [options]
 packages = find:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cbor2-5.0.1/setup.py new/cbor2-5.1.0/setup.py
--- old/cbor2-5.0.1/setup.py    2020-01-21 15:50:41.000000000 +0100
+++ new/cbor2-5.1.0/setup.py    2020-03-18 18:22:03.000000000 +0100
@@ -46,7 +46,7 @@
         'local_scheme': 'dirty-tag'
     },
     setup_requires=[
-        'setuptools >= 36.2.7',
+        'setuptools >= 40.7.0',
         'setuptools_scm >= 1.7.0'
     ],
     **kwargs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cbor2-5.0.1/source/encoder.c 
new/cbor2-5.1.0/source/encoder.c
--- old/cbor2-5.0.1/source/encoder.c    2020-01-21 15:50:41.000000000 +0100
+++ new/cbor2-5.1.0/source/encoder.c    2020-03-18 18:22:03.000000000 +0100
@@ -120,13 +120,22 @@
         "fp", "datetime_as_timestamp", "timezone", "value_sharing", "default",
         "canonical", "date_as_datetime", NULL
     };
-    PyObject *tmp, *fp = NULL, *default_handler = NULL, *tz = NULL,
-    *date_as_datetime = NULL;
+    PyObject *tmp, *fp = NULL, *default_handler = NULL, *tz = NULL;
+    int value_sharing = 0, timestamp_format = 0, enc_style = 0,
+       date_as_datetime = 0;
 
     if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|pOpOpp", keywords,
-                &fp, &self->timestamp_format, &tz, &self->value_sharing,
-                &default_handler, &self->enc_style, &date_as_datetime))
+                &fp, &timestamp_format, &tz, &value_sharing,
+                &default_handler, &enc_style, &date_as_datetime))
         return -1;
+    // Predicate values are returned as ints, but need to be stored as bool or 
ubyte
+    if (timestamp_format == 1)
+       self->timestamp_format = true;
+    if (value_sharing == 1)
+       self->value_sharing = true;
+    if (enc_style == 1)
+       self->enc_style = 1;
+
 
     if (_CBOREncoder_set_fp(self, fp, NULL) == -1)
         return -1;
@@ -155,7 +164,7 @@
                     _CBOR2_str_update, _CBOR2_canonical_encoders, NULL))
             return -1;
     }
-    if (date_as_datetime) {
+    if (date_as_datetime == 1) {
         PyObject *encode_date = PyObject_GetAttr((PyObject *) 
&CBOREncoderType, _CBOR2_str_encode_date);
         if (!encode_date)
             return -1;
@@ -996,7 +1005,8 @@
 encode_decimal_digits(CBOREncoderObject *self, PyObject *value)
 {
     PyObject *tuple, *digits, *exp, *sig, *ten, *tmp, *ret = NULL;
-    bool sign, sharing;
+    int sign = 0;
+    bool sharing;
 
     tuple = PyObject_CallMethodObjArgs(value, _CBOR2_str_as_tuple, NULL);
     if (tuple) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cbor2-5.0.1/source/halffloat.c 
new/cbor2-5.1.0/source/halffloat.c
--- old/cbor2-5.0.1/source/halffloat.c  2020-01-21 15:50:41.000000000 +0100
+++ new/cbor2-5.1.0/source/halffloat.c  2020-03-18 18:22:03.000000000 +0100
@@ -1,3 +1,4 @@
+#include <Python.h>
 #include <stdbool.h>
 #include <stdint.h>
 #include <math.h>
@@ -448,8 +449,13 @@
     // equivalent value (handling infinity and NaN cases accordingly)
     union {
         struct {
+#if PY_BIG_ENDIAN
+            unsigned int exp: 6; // yes, this includes the sign
+            unsigned int sig: 10;
+#else
             unsigned int sig: 10;
             unsigned int exp: 6; // yes, this includes the sign
+#endif
         };
         uint16_t value;
     } in;
@@ -470,8 +476,13 @@
     // NaN cases accordingly); overflow returns infinity, underflow returns 0.0
     union {
         struct {
+#if PY_BIG_ENDIAN
+            unsigned int exp: 9;
+            unsigned int sig: 23;
+#else
             unsigned int sig: 23;
             unsigned int exp: 9; // again, this includes the sign
+#endif
         };
         float f;
     } in;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cbor2-5.0.1/source/module.c 
new/cbor2-5.1.0/source/module.c
--- old/cbor2-5.0.1/source/module.c     2020-01-21 15:50:41.000000000 +0100
+++ new/cbor2-5.1.0/source/module.c     2020-03-18 18:22:03.000000000 +0100
@@ -191,23 +191,21 @@
 static PyObject *
 CBORSimpleValue_richcompare(PyObject *a, PyObject *b, int op)
 {
-    if (op == Py_EQ || op == Py_NE) {
-        switch (PyObject_IsInstance(b, (PyObject *) &CBORSimpleValueType)) {
-            case 1:
-                return PyObject_RichCompare(
-                    PyStructSequence_GET_ITEM(a, 0),
-                    PyStructSequence_GET_ITEM(b, 0),
-                    op);
-            case -1:
-                return NULL;
-        }
-        switch (PyObject_IsInstance(b, (PyObject *) &PyLong_Type)) {
-            case 1:
-                return PyObject_RichCompare(
-                    PyStructSequence_GET_ITEM(a, 0), b, op);
-            case -1:
-                return NULL;
-        }
+    switch (PyObject_IsInstance(b, (PyObject *) &CBORSimpleValueType)) {
+        case 1:
+        return PyObject_RichCompare(
+            PyStructSequence_GET_ITEM(a, 0),
+            PyStructSequence_GET_ITEM(b, 0),
+            op);
+        case -1:
+        return NULL;
+    }
+    switch (PyObject_IsInstance(b, (PyObject *) &PyLong_Type)) {
+        case 1:
+        return PyObject_RichCompare(
+            PyStructSequence_GET_ITEM(a, 0), b, op);
+        case -1:
+        return NULL;
     }
     Py_RETURN_NOTIMPLEMENTED;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cbor2-5.0.1/source/module.h 
new/cbor2-5.1.0/source/module.h
--- old/cbor2-5.0.1/source/module.h     2020-01-21 15:50:41.000000000 +0100
+++ new/cbor2-5.1.0/source/module.h     2020-03-18 18:22:03.000000000 +0100
@@ -1,7 +1,6 @@
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
-#if PY_MAJOR_VERSION < 3
-#error "_cbor2 doesn't support the Python 2.x API"
-#elif PY_MAJOR_VERSION == 3 && PY_MAJOR_VERSION < 3
+#if PY_VERSION_HEX < 0x03030000
 #error "_cbor2 requires Python 3.3 or newer"
 #endif
 
@@ -9,8 +8,13 @@
 typedef
     union {
         struct {
+#if PY_BIG_ENDIAN
+            unsigned int major: 3;
+            unsigned int subtype: 5;
+#else
             unsigned int subtype: 5;
             unsigned int major: 3;
+#endif
         };
         char byte;
     } LeadByte;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cbor2-5.0.1/tests/test_decoder.py 
new/cbor2-5.1.0/tests/test_decoder.py
--- old/cbor2-5.0.1/tests/test_decoder.py       2020-01-21 15:50:41.000000000 
+0100
+++ new/cbor2-5.1.0/tests/test_decoder.py       2020-03-18 18:22:03.000000000 
+0100
@@ -300,6 +300,10 @@
     assert decoded == wrapped
 
 
+def test_simple_val_as_key(impl):
+    decoded = impl.loads(unhexlify('A1F86301'))
+    assert decoded == {impl.CBORSimpleValue(99): 1}
+
 #
 # Tests for extension tags
 #
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cbor2-5.0.1/tests/test_encoder.py 
new/cbor2-5.1.0/tests/test_encoder.py
--- old/cbor2-5.0.1/tests/test_encoder.py       2020-01-21 15:50:41.000000000 
+0100
+++ new/cbor2-5.1.0/tests/test_encoder.py       2020-03-18 18:22:03.000000000 
+0100
@@ -206,10 +206,16 @@
     assert impl.dumps(value) == expected
 
 
+def test_simple_val_as_key(impl):
+    payload = {impl.CBORSimpleValue(99): 1}
+    result = impl.dumps(payload)
+    assert result == unhexlify('A1F86301')
+
 #
 # Tests for extension tags
 #
 
+
 @pytest.mark.parametrize('value, as_timestamp, expected', [
     (datetime(2013, 3, 21, 20, 4, 0, tzinfo=timezone.utc), False,
      'c074323031332d30332d32315432303a30343a30305a'),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cbor2-5.0.1/tests/test_types.py 
new/cbor2-5.1.0/tests/test_types.py
--- old/cbor2-5.0.1/tests/test_types.py 2020-01-21 15:50:41.000000000 +0100
+++ new/cbor2-5.1.0/tests/test_types.py 2020-03-18 18:22:03.000000000 +0100
@@ -98,12 +98,29 @@
     tag1 = impl.CBORSimpleValue(1)
     tag2 = impl.CBORSimpleValue(1)
     tag3 = impl.CBORSimpleValue(21)
+    tag4 = impl.CBORSimpleValue(99)
     assert tag1 == tag2
     assert tag1 == 1
     assert not tag2 == "21"
     assert tag1 != tag3
     assert tag1 != 21
     assert tag2 != "21"
+    assert tag4 > tag1
+    assert tag4 >= tag3
+    assert 99 <= tag4
+    assert 100 > tag4
+    assert tag4 <= 100
+    assert 2 < tag4
+    assert tag4 >= 99
+    assert tag1 <= tag4
+
+
+def test_simple_ordering(impl):
+    randints = [9, 7, 3, 8, 4, 0, 2, 5, 6, 1]
+    expected = [impl.CBORSimpleValue(v) for v in range(10)]
+    disordered = [impl.CBORSimpleValue(v) for v in randints]
+    assert expected == sorted(disordered)
+    assert expected == sorted(randints)
 
 
 def test_simple_value_too_big(impl):


Reply via email to