Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-bson for openSUSE:Factory checked in at 2022-09-23 14:15:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-bson (Old) and /work/SRC/openSUSE:Factory/.python-bson.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-bson" Fri Sep 23 14:15:30 2022 rev:3 rq:1005567 version:0.5.10 Changes: -------- --- /work/SRC/openSUSE:Factory/python-bson/python-bson.changes 2021-08-31 19:56:09.729997295 +0200 +++ /work/SRC/openSUSE:Factory/.python-bson.new.2275/python-bson.changes 2022-09-23 14:16:20.082136672 +0200 @@ -1,0 +2,7 @@ +Fri Sep 23 02:48:27 UTC 2022 - Yogalakshmi Arunachalam <[email protected]> + +- Update to version v0.5.10 + * Merge pull request #110 from yangroro/master + * Add python 3.9, 3.10-dev for testing + +------------------------------------------------------------------- Old: ---- bson-0.5.8.tar.gz New: ---- bson-0.5.10.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-bson.spec ++++++ --- /var/tmp/diff_new_pack.WgIatK/_old 2022-09-23 14:16:20.506137660 +0200 +++ /var/tmp/diff_new_pack.WgIatK/_new 2022-09-23 14:16:20.510137670 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-bson # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-bson -Version: 0.5.8 +Version: 0.5.10 Release: 0 Summary: BSON codec for Python License: Apache-2.0 AND BSD-3-Clause ++++++ bson-0.5.8.tar.gz -> bson-0.5.10.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bson-0.5.8/.travis.yml new/bson-0.5.10/.travis.yml --- old/bson-0.5.8/.travis.yml 2019-02-25 15:15:54.000000000 +0100 +++ new/bson-0.5.10/.travis.yml 2021-07-17 06:49:54.000000000 +0200 @@ -1,12 +1,14 @@ language: python sudo: false python: -- 2.6 - 2.7 -- 3.3 - 3.4 - 3.5 - 3.6 +- 3.7 +- 3.8 +- 3.9 +- 3.10-dev install: - pip install python-dateutil>=2.4.0 six>=1.9.0 - if [[ $TRAVIS_PYTHON_VERSION == 2.6 ]]; then pip install unittest2; fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bson-0.5.8/bson/codec.py new/bson-0.5.10/bson/codec.py --- old/bson-0.5.8/bson/codec.py 2019-02-25 15:15:54.000000000 +0100 +++ new/bson-0.5.10/bson/codec.py 2021-07-17 06:49:54.000000000 +0200 @@ -12,6 +12,9 @@ from abc import ABCMeta, abstractmethod from uuid import UUID from decimal import Decimal + +from bson.types import UInt64, Int64, Int32 + try: from io import BytesIO as StringIO except ImportError: @@ -34,7 +37,9 @@ class UnknownSerializerError(ValueError): - pass + def __init__(self, key, value): + super(UnknownSerializerError, + self).__init__("Unable to serialize: key '%s' value: %s type: %s" % (key,value, type(value))) class MissingTimezoneWarning(RuntimeWarning): @@ -127,7 +132,7 @@ def encode_cstring(value): if not isinstance(value, bytes): - value = str(value).encode("utf-8") + value = text_type(value).encode("utf-8") if b"\x00" in value: raise ValueError("Element names may not include NUL bytes.") # A NUL byte is used to delimit our string, accepting one would cause @@ -193,6 +198,12 @@ buf.write(encode_uint64_element(name, value)) else: buf.write(encode_int32_element(name, value)) + elif isinstance(value, Int32): + buf.write(encode_int32_element(name, value.get_value())) + elif isinstance(value, Int64): + buf.write(encode_int64_element(name, value.get_value())) + elif isinstance(value, UInt64): + buf.write(encode_uint64_element(name, value.get_value())) elif isinstance(value, float): buf.write(encode_double_element(name, value)) elif _is_string(value): @@ -221,7 +232,7 @@ encode_value(name, on_unknown(value), buf, traversal_stack, generator_func, on_unknown) else: - raise UnknownSerializerError() + raise UnknownSerializerError(name, value) def encode_document(obj, traversal_stack, traversal_parent=None, @@ -286,20 +297,17 @@ if PY3: ll = data.index(0, base + 1) + 1 - try: - base, name = ll, data[base + 1:ll - 1].decode("utf-8") \ - if decode_name else None - except UnicodeDecodeError: - base, name = ll, data[base + 1:ll - 1] \ - if decode_name else None else: ll = data.index("\x00", base + 1) + 1 + if decode_name: + name = data[base + 1:ll - 1] try: - base, name = ll, unicode(data[base + 1:ll - 1])\ - if decode_name else None + name = name.decode("utf-8") except UnicodeDecodeError: - base, name = ll, data[base + 1:ll - 1]\ - if decode_name else None + pass + else: + name = None + base = ll if element_type == 0x01: # double value = double_struct.unpack(data[base: base + 8])[0] @@ -307,10 +315,7 @@ elif element_type == 0x02: # string length = int_struct.unpack(data[base:base + 4])[0] value = data[base + 4: base + 4 + length - 1] - if PY3: - value = value.decode("utf-8") - else: - value = unicode(value) + value = value.decode("utf-8") base += 4 + length elif element_type == 0x03: # document base, value = decode_document(data, base) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bson-0.5.8/bson/tests/test_binary.py new/bson-0.5.10/bson/tests/test_binary.py --- old/bson-0.5.8/bson/tests/test_binary.py 2019-02-25 15:15:54.000000000 +0100 +++ new/bson-0.5.10/bson/tests/test_binary.py 2021-07-17 06:49:54.000000000 +0200 @@ -52,3 +52,7 @@ dump = dumps(self.doc) decoded = loads(dump) self.assertEqual(decoded, self.doc) + + def test_utf8_binary(self): + self.doc[u"\N{SNOWMAN}"] = u"\N{SNOWMAN WITHOUT SNOW}" + self.test_binary() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bson-0.5.8/bson/tests/test_types.py new/bson-0.5.10/bson/tests/test_types.py --- old/bson-0.5.8/bson/tests/test_types.py 1970-01-01 01:00:00.000000000 +0100 +++ new/bson-0.5.10/bson/tests/test_types.py 2021-07-17 06:49:54.000000000 +0200 @@ -0,0 +1,32 @@ +#!/usr/bin/env python +from unittest import TestCase + +from bson import dumps, loads +from bson.types import UInt64, Int64, Int32 + + +class TestTypes(TestCase): + def setUp(self): + self.good_request_dict = { + "uint64": UInt64(0xFFFFFFFFFFFFFFFF - 1), + "int64": Int64(0x7FFFFFFFFFFFFFFF - 1), + "int32": Int32(0x7fffffff) + } + + def test_bad_values(self): + with self.assertRaises(ValueError): + UInt64(0xFFFFFFFFFFFFFFFF << 1) + with self.assertRaises(ValueError): + Int32(2**32) + with self.assertRaises(ValueError): + Int64(2**64) + with self.assertRaises(ValueError): + Int32(-2**31-1) + with self.assertRaises(ValueError): + Int64(-2**63-1) + + def test_int(self): + dump = dumps(self.good_request_dict) + decoded = loads(dump) + self.assertEqual(decoded, {k: v.get_value() for k, v in self.good_request_dict.items()}) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bson-0.5.8/bson/types.py new/bson-0.5.10/bson/types.py --- old/bson-0.5.8/bson/types.py 1970-01-01 01:00:00.000000000 +0100 +++ new/bson-0.5.10/bson/types.py 2021-07-17 06:49:54.000000000 +0200 @@ -0,0 +1,49 @@ +class Int32: + """ + A signed integer with a 32-bit fixed width. + """ + + def __init__(self, value): + if value < -2 ** 31 or value > 2 ** 31 - 1: + raise ValueError('value {} cannot be represented in int32'.format(value)) + self._value = value + + def get_value(self): + return self._value + + def __str__(self): + return str(self._value) + + +class Int64: + """ + A signed integer with a 64-bit fixed width. + """ + + def __init__(self, value): + if value < -2 ** 63 or value > 2 ** 63 - 1: + raise ValueError('value {} cannot be represented in int32'.format(value)) + self._value = value + + def get_value(self): + return self._value + + def __str__(self): + return str(self._value) + + +class UInt64: + """ + An unsigned integer with a 64-bit fixed width. + """ + + def __init__(self, value): + if value < 0 or value > 2 ** 64 - 1: + raise ValueError('value {} cannot be represented in uint32'.format(value)) + self._value = value + + def get_value(self): + return self._value + + def __str__(self): + return str(self._value) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bson-0.5.8/setup.py new/bson-0.5.10/setup.py --- old/bson-0.5.8/setup.py 2019-02-25 15:15:54.000000000 +0100 +++ new/bson-0.5.10/setup.py 2021-07-17 06:49:54.000000000 +0200 @@ -25,7 +25,7 @@ setup( name="bson", - version="0.5.8", + version="0.5.10", packages=["bson"], install_requires=["python-dateutil>=2.4.0", "six>=1.9.0"], author="Ayun Park",
