From 9360efd895db986efd7e9ea66b987ce868ee8328 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl>
Date: Mon, 22 Feb 2021 13:50:21 +0100
Subject: [PATCH] 2.14.42 added Closeable.closed

---
 CHANGELOG.md                   | 1 +
 satella/__init__.py            | 2 +-
 satella/coding/misc.py         | 7 +++++++
 tests/test_coding/test_misc.py | 1 +
 4 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4e6d2269..51934ab6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,4 @@
 # v2.14.42
 
 * added `terminating` property to `TerminableThread`
+* added `Closeable.closed`
diff --git a/satella/__init__.py b/satella/__init__.py
index 5a7b5935..3c298eaa 100644
--- a/satella/__init__.py
+++ b/satella/__init__.py
@@ -1 +1 @@
-__version__ = '2.14.42a2'
+__version__ = '2.14.42'
diff --git a/satella/coding/misc.py b/satella/coding/misc.py
index 5cfcd394..1f3ff3f5 100644
--- a/satella/coding/misc.py
+++ b/satella/coding/misc.py
@@ -66,6 +66,13 @@ class Closeable:
     def __init__(self):
         self.__finalized = False
 
+    @property
+    def closed(self) -> bool:
+        """
+        :return: whether this object is closed
+        """
+        return self.__finalized
+
     def close(self) -> bool:
         """
         Check if the resource needs cleanup, and clean up this resource.
diff --git a/tests/test_coding/test_misc.py b/tests/test_coding/test_misc.py
index 19f53ce7..48a71492 100644
--- a/tests/test_coding/test_misc.py
+++ b/tests/test_coding/test_misc.py
@@ -49,6 +49,7 @@ class TestCase(unittest.TestCase):
                     a['test'] = True
 
         b = MyClose()
+        self.assertFalse(b.closed)
         del b
         gc.collect()
         self.assertTrue(a['test'])
-- 
GitLab