Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-filelock for openSUSE:Factory 
checked in at 2024-04-21 20:24:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-filelock (Old)
 and      /work/SRC/openSUSE:Factory/.python-filelock.new.26366 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-filelock"

Sun Apr 21 20:24:46 2024 rev:18 rq:1169267 version:3.13.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-filelock/python-filelock.changes  
2024-03-26 19:27:47.854120306 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-filelock.new.26366/python-filelock.changes   
    2024-04-21 20:25:17.837553945 +0200
@@ -1,0 +2,8 @@
+Fri Apr 12 17:03:41 UTC 2024 - Dirk Müller <dmuel...@suse.com>
+
+- update to 3.13.4:
+  * Raise error on incompatible singleton timeout and mode args
+- update to 3.13.3:
+  * Make singleton class instance dict unique per subclass
+
+-------------------------------------------------------------------

Old:
----
  filelock-3.13.2.tar.gz

New:
----
  filelock-3.13.4.tar.gz

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

Other differences:
------------------
++++++ python-filelock.spec ++++++
--- /var/tmp/diff_new_pack.XlGLrl/_old  2024-04-21 20:25:18.293570677 +0200
+++ /var/tmp/diff_new_pack.XlGLrl/_new  2024-04-21 20:25:18.297570824 +0200
@@ -19,7 +19,7 @@
 
 %{?sle15_python_module_pythons}
 Name:           python-filelock
-Version:        3.13.2
+Version:        3.13.4
 Release:        0
 Summary:        Platform Independent File Lock in Python
 License:        Unlicense

++++++ filelock-3.13.2.tar.gz -> filelock-3.13.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/filelock-3.13.2/PKG-INFO new/filelock-3.13.4/PKG-INFO
--- old/filelock-3.13.2/PKG-INFO        2020-02-02 01:00:00.000000000 +0100
+++ new/filelock-3.13.4/PKG-INFO        2020-02-02 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.3
 Name: filelock
-Version: 3.13.2
+Version: 3.13.4
 Summary: A platform independent file lock.
 Project-URL: Documentation, https://py-filelock.readthedocs.io
 Project-URL: Homepage, https://github.com/tox-dev/py-filelock
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/filelock-3.13.2/src/filelock/_api.py 
new/filelock-3.13.4/src/filelock/_api.py
--- old/filelock-3.13.2/src/filelock/_api.py    2020-02-02 01:00:00.000000000 
+0100
+++ new/filelock-3.13.4/src/filelock/_api.py    2020-02-02 01:00:00.000000000 
+0100
@@ -8,7 +8,7 @@
 from abc import ABC, abstractmethod
 from dataclasses import dataclass
 from threading import local
-from typing import TYPE_CHECKING, Any, ClassVar
+from typing import TYPE_CHECKING, Any
 from weakref import WeakValueDictionary
 
 from ._error import Timeout
@@ -77,13 +77,13 @@
 class BaseFileLock(ABC, contextlib.ContextDecorator):
     """Abstract base class for a file lock object."""
 
-    _instances: ClassVar[WeakValueDictionary[str, BaseFileLock]] = 
WeakValueDictionary()
+    _instances: WeakValueDictionary[str, BaseFileLock]
 
     def __new__(  # noqa: PLR0913
         cls,
         lock_file: str | os.PathLike[str],
-        timeout: float = -1,  # noqa: ARG003
-        mode: int = 0o644,  # noqa: ARG003
+        timeout: float = -1,
+        mode: int = 0o644,
         thread_local: bool = True,  # noqa: ARG003, FBT001, FBT002
         *,
         is_singleton: bool = False,
@@ -97,9 +97,17 @@
         if not instance:
             instance = super().__new__(cls)
             cls._instances[str(lock_file)] = instance
+        elif timeout != instance.timeout or mode != instance.mode:
+            msg = "Singleton lock instances cannot be initialized with 
differing arguments"
+            raise ValueError(msg)
 
         return instance  # type: ignore[return-value] # 
https://github.com/python/mypy/issues/15322
 
+    def __init_subclass__(cls, **kwargs: dict[str, Any]) -> None:
+        """Setup unique state for lock subclasses."""
+        super().__init_subclass__(**kwargs)
+        cls._instances = WeakValueDictionary()
+
     def __init__(  # noqa: PLR0913
         self,
         lock_file: str | os.PathLike[str],
@@ -169,6 +177,11 @@
         """
         self._context.timeout = float(value)
 
+    @property
+    def mode(self) -> int:
+        """:return: the file permissions for the lockfile"""
+        return self._context.mode
+
     @abstractmethod
     def _acquire(self) -> None:
         """If the file lock could be acquired, self._context.lock_file_fd 
holds the file descriptor of the lock file."""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/filelock-3.13.2/src/filelock/version.py 
new/filelock-3.13.4/src/filelock/version.py
--- old/filelock-3.13.2/src/filelock/version.py 2020-02-02 01:00:00.000000000 
+0100
+++ new/filelock-3.13.4/src/filelock/version.py 2020-02-02 01:00:00.000000000 
+0100
@@ -12,5 +12,5 @@
 __version_tuple__: VERSION_TUPLE
 version_tuple: VERSION_TUPLE
 
-__version__ = version = '3.13.2'
-__version_tuple__ = version_tuple = (3, 13, 2)
+__version__ = version = '3.13.4'
+__version_tuple__ = version_tuple = (3, 13, 4)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/filelock-3.13.2/tests/test_filelock.py 
new/filelock-3.13.4/tests/test_filelock.py
--- old/filelock-3.13.2/tests/test_filelock.py  2020-02-02 01:00:00.000000000 
+0100
+++ new/filelock-3.13.4/tests/test_filelock.py  2020-02-02 01:00:00.000000000 
+0100
@@ -14,6 +14,7 @@
 from types import TracebackType
 from typing import TYPE_CHECKING, Any, Callable, Iterator, Tuple, Type, Union
 from uuid import uuid4
+from weakref import WeakValueDictionary
 
 import pytest
 
@@ -675,6 +676,17 @@
     assert lock_1 is not lock_2
 
 
+@pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock])
+def test_singleton_locks_must_be_initialized_with_the_same_args(lock_type: 
type[BaseFileLock], tmp_path: Path) -> None:
+    lock_path = tmp_path / "a"
+    lock = lock_type(str(lock_path), is_singleton=True)  # noqa: F841
+
+    with pytest.raises(ValueError, match="Singleton lock instances cannot be 
initialized with differing arguments"):
+        lock_type(str(lock_path), timeout=10, is_singleton=True)
+    with pytest.raises(ValueError, match="Singleton lock instances cannot be 
initialized with differing arguments"):
+        lock_type(str(lock_path), mode=0, is_singleton=True)
+
+
 @pytest.mark.skipif(hasattr(sys, "pypy_version_info"), reason="del() does not 
trigger GC in PyPy")
 @pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock])
 def test_singleton_locks_are_deleted_when_no_external_references_exist(
@@ -687,3 +699,17 @@
     assert lock_type._instances == {str(lock_path): lock}  # noqa: SLF001
     del lock
     assert lock_type._instances == {}  # noqa: SLF001
+
+
+@pytest.mark.skipif(hasattr(sys, "pypy_version_info"), reason="del() does not 
trigger GC in PyPy")
+@pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock])
+def test_singleton_instance_tracking_is_unique_per_subclass(lock_type: 
type[BaseFileLock]) -> None:
+    class Lock1(lock_type):  # type: ignore[valid-type, misc]
+        pass
+
+    class Lock2(lock_type):  # type: ignore[valid-type, misc]
+        pass
+
+    assert isinstance(Lock1._instances, WeakValueDictionary)  # noqa: SLF001
+    assert isinstance(Lock2._instances, WeakValueDictionary)  # noqa: SLF001
+    assert Lock1._instances is not Lock2._instances  # noqa: SLF001

Reply via email to