Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-dogpile.cache for openSUSE:Factory checked in at 2023-05-10 16:19:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-dogpile.cache (Old) and /work/SRC/openSUSE:Factory/.python-dogpile.cache.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-dogpile.cache" Wed May 10 16:19:00 2023 rev:36 rq:1085846 version:1.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-dogpile.cache/python-dogpile.cache.changes 2022-07-21 11:33:43.930967790 +0200 +++ /work/SRC/openSUSE:Factory/.python-dogpile.cache.new.1533/python-dogpile.cache.changes 2023-05-10 16:19:02.551158568 +0200 @@ -1,0 +2,9 @@ +Tue May 9 21:34:11 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 1.2.0: + * Added new construct api.CantDeserializeException which can be + raised by user-defined deserializer functions which would be + passed to CacheRegion.deserializer, to indicate a cache value + that can't be deserialized and therefore should be regenerated. + +------------------------------------------------------------------- Old: ---- dogpile.cache-1.1.8.tar.gz New: ---- dogpile.cache-1.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-dogpile.cache.spec ++++++ --- /var/tmp/diff_new_pack.Cl0cy8/_old 2023-05-10 16:19:03.107161857 +0200 +++ /var/tmp/diff_new_pack.Cl0cy8/_new 2023-05-10 16:19:03.111161881 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-dogpile.cache # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,10 +19,10 @@ %{?!python_module:%define python_module() python3-%{**}} %global pythons python3 Name: python-dogpile.cache -Version: 1.1.8 +Version: 1.2.0 Release: 0 %define modname dogpile.cache -%define modver 1_1_8 +%define modver 1_2_0 Summary: A caching front-end based on the Dogpile lock License: BSD-3-Clause URL: https://github.com/sqlalchemy/dogpile.cache ++++++ dogpile.cache-1.1.8.tar.gz -> dogpile.cache-1.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dogpile.cache-rel_1_1_8/LICENSE new/dogpile.cache-rel_1_2_0/LICENSE --- old/dogpile.cache-rel_1_1_8/LICENSE 2022-07-08 19:57:24.000000000 +0200 +++ new/dogpile.cache-rel_1_2_0/LICENSE 2023-04-26 17:47:49.000000000 +0200 @@ -1,4 +1,4 @@ -Copyright 2005-2022 Michael Bayer. +Copyright 2005-2023 Michael Bayer. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dogpile.cache-rel_1_1_8/docs/build/changelog.rst new/dogpile.cache-rel_1_2_0/docs/build/changelog.rst --- old/dogpile.cache-rel_1_1_8/docs/build/changelog.rst 2022-07-08 19:57:24.000000000 +0200 +++ new/dogpile.cache-rel_1_2_0/docs/build/changelog.rst 2023-04-26 17:47:49.000000000 +0200 @@ -3,6 +3,22 @@ ========= .. changelog:: + :version: 1.2.0 + :released: Wed Apr 26 2023 + + .. change:: + :tags: feature, region + :tickets: 236 + + Added new construct :class:`.api.CantDeserializeException` which can be + raised by user-defined deserializer functions which would be passed to + :paramref:`.CacheRegion.deserializer`, to indicate a cache value that can't + be deserialized and therefore should be regenerated. This can allow an + application that's been updated to gracefully re-cache old items that were + persisted from a previous version of the application. Pull request courtesy + Simon Hewitt. + +.. changelog:: :version: 1.1.8 :released: Fri Jul 8 2022 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dogpile.cache-rel_1_1_8/docs/build/conf.py new/dogpile.cache-rel_1_2_0/docs/build/conf.py --- old/dogpile.cache-rel_1_1_8/docs/build/conf.py 2022-07-08 19:57:24.000000000 +0200 +++ new/dogpile.cache-rel_1_2_0/docs/build/conf.py 2023-04-26 17:47:49.000000000 +0200 @@ -65,7 +65,7 @@ # General information about the project. project = "dogpile.cache" -copyright = "2011-2022 Mike Bayer" +copyright = "2011-2023 Mike Bayer" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -74,7 +74,7 @@ # The short X.Y version. version = dogpile.__version__ # The full version, including alpha/beta/rc tags. -release = "1.1.8" +release = "1.2.0" # The language for content autogenerated by Sphinx. Refer to documentation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dogpile.cache-rel_1_1_8/dogpile/__init__.py new/dogpile.cache-rel_1_2_0/dogpile/__init__.py --- old/dogpile.cache-rel_1_1_8/dogpile/__init__.py 2022-07-08 19:57:24.000000000 +0200 +++ new/dogpile.cache-rel_1_2_0/dogpile/__init__.py 2023-04-26 17:47:49.000000000 +0200 @@ -1,4 +1,4 @@ -__version__ = "1.1.8" +__version__ = "1.2.0" from .lock import Lock # noqa from .lock import NeedRegenerationException # noqa diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dogpile.cache-rel_1_1_8/dogpile/cache/api.py new/dogpile.cache-rel_1_2_0/dogpile/cache/api.py --- old/dogpile.cache-rel_1_1_8/dogpile/cache/api.py 2022-07-08 19:57:24.000000000 +0200 +++ new/dogpile.cache-rel_1_2_0/dogpile/cache/api.py 2023-04-26 17:47:49.000000000 +0200 @@ -51,6 +51,15 @@ Deserializer = Callable[[bytes], ValuePayload] +class CantDeserializeException(Exception): + """Exception indicating deserialization failed, and that caching + should proceed to re-generate a value + + .. versionadded:: 1.2.0 + + """ + + class CacheMutex(abc.ABC): """Describes a mutexing object with acquire and release methods. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dogpile.cache-rel_1_1_8/dogpile/cache/region.py new/dogpile.cache-rel_1_2_0/dogpile/cache/region.py --- old/dogpile.cache-rel_1_1_8/dogpile/cache/region.py 2022-07-08 19:57:24.000000000 +0200 +++ new/dogpile.cache-rel_1_2_0/dogpile/cache/region.py 2023-04-26 17:47:49.000000000 +0200 @@ -27,6 +27,7 @@ from .api import CachedValue from .api import CacheMutex from .api import CacheReturnType +from .api import CantDeserializeException from .api import KeyType from .api import MetaDataType from .api import NO_VALUE @@ -328,7 +329,17 @@ deserializer recommended by the backend will be used. Typical deserializers include ``pickle.dumps`` and ``json.dumps``. - .. versionadded:: 1.1.0 + Deserializers can raise a :class:`.api.CantDeserializeException` if they + are unable to deserialize the value from the backend, indicating + deserialization failed and that caching should proceed to re-generate + a value. This allows an application that has been updated to gracefully + re-cache old items which were persisted by a previous version of the + application and can no longer be successfully deserialized. + + .. versionadded:: 1.1.0 added "deserializer" parameter + + .. versionadded:: 1.2.0 added support for + :class:`.api.CantDeserializeException` :param async_creation_runner: A callable that, when specified, will be passed to and called by dogpile.lock when @@ -1219,8 +1230,12 @@ bytes_metadata, _, bytes_payload = byte_value.partition(b"|") metadata = json.loads(bytes_metadata) - payload = self.deserializer(bytes_payload) - return CachedValue(payload, metadata) + try: + payload = self.deserializer(bytes_payload) + except CantDeserializeException: + return NO_VALUE + else: + return CachedValue(payload, metadata) def _serialize_cached_value_elements( self, payload: ValuePayload, metadata: MetaDataType @@ -1247,7 +1262,8 @@ return self._serialize_cached_value_elements(payload, metadata) def _serialized_cached_value(self, value: CachedValue) -> BackendFormatted: - """Return a backend formatted representation of a :class:`.CachedValue`. + """Return a backend formatted representation of a + :class:`.CachedValue`. If a serializer is in use then this will return a string representation with the value formatted by the serializer. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dogpile.cache-rel_1_1_8/tests/cache/_fixtures.py new/dogpile.cache-rel_1_2_0/tests/cache/_fixtures.py --- old/dogpile.cache-rel_1_1_8/tests/cache/_fixtures.py 2022-07-08 19:57:24.000000000 +0200 +++ new/dogpile.cache-rel_1_2_0/tests/cache/_fixtures.py 2023-04-26 17:47:49.000000000 +0200 @@ -14,6 +14,7 @@ from dogpile.cache import register_backend from dogpile.cache.api import CacheBackend from dogpile.cache.api import CacheMutex +from dogpile.cache.api import CantDeserializeException from dogpile.cache.api import NO_VALUE from dogpile.cache.region import _backend_loader from . import assert_raises_message @@ -380,6 +381,10 @@ ) +def raise_cant_deserialize_exception(v): + raise CantDeserializeException() + + class _GenericSerializerTest(TestCase): # Inheriting from this class will make test cases # use these serialization arguments @@ -388,6 +393,19 @@ "deserializer": json.loads, } + def test_serializer_cant_deserialize(self): + region = self._region( + region_args={ + "serializer": self.region_args["serializer"], + "deserializer": raise_cant_deserialize_exception, + } + ) + + value = {"foo": ["bar", 1, False, None]} + region.set("k", value) + asserted = region.get("k") + eq_(asserted, NO_VALUE) + def test_uses_serializer(self): region = self._region()