]> git.cworth.org Git - obsolete/notmuch-old/commitdiff
python: fix NULL pointer tests
authorJustus Winter <4winter@informatik.uni-hamburg.de>
Mon, 30 Apr 2012 16:52:35 +0000 (18:52 +0200)
committerJustus Winter <4winter@informatik.uni-hamburg.de>
Mon, 30 Apr 2012 17:24:34 +0000 (19:24 +0200)
Fix the NULL pointer tests in the destructors of all classes and
Database.create.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
bindings/python/notmuch/database.py
bindings/python/notmuch/directory.py
bindings/python/notmuch/filenames.py
bindings/python/notmuch/message.py
bindings/python/notmuch/messages.py
bindings/python/notmuch/query.py
bindings/python/notmuch/tag.py
bindings/python/notmuch/thread.py
bindings/python/notmuch/threads.py

index 0ac8b06a35f15c1965e3cf1e8d6c1bab7a3909c3..525f7c9a0ca9d0b2a933faa26185e3671e736e8f 100644 (file)
@@ -189,7 +189,7 @@ class Database(object):
         :raises: :exc:`NotmuchError` in case of any failure
                     (possibly after printing an error message on stderr).
         """
-        if self._db is not None:
+        if self._db:
             raise NotmuchError(message="Cannot create db, this Database() "
                                        "already has an open one.")
 
index 667d3a4b64986c4901d0b9f0e52f43334660e120..ae115f818be2c22395531e454dc51ab907405f3c 100644 (file)
@@ -181,5 +181,5 @@ class Directory(object):
 
     def __del__(self):
         """Close and free the Directory"""
-        if self._dir_p is not None:
+        if self._dir_p:
             self._destroy(self._dir_p)
index d201ae2207a652958b0c1473ddc89c5124990800..a0b2956316fdd79781905157b7bc1ea9d82dbd88 100644 (file)
@@ -128,7 +128,7 @@ class Filenames(Python3StringMixIn):
 
     def __del__(self):
         """Close and free the notmuch filenames"""
-        if self._files_p is not None:
+        if self._files_p:
             self._destroy(self._files_p)
 
     def __len__(self):
index 54c4e4b2c14b0394360bb8e78e9b5bdd3a46fb3f..4ec5147b55115bc2db1a2b26339bcb019e0ee99c 100644 (file)
@@ -741,5 +741,5 @@ class Message(Python3StringMixIn):
 
     def __del__(self):
         """Close and free the notmuch Message"""
-        if self._msg is not None:
+        if self._msg:
             self._destroy(self._msg)
index 6b024cbe0d00c6067c3155a4e2b00f8d3e344f55..251fa3a3457f77ef42831925b7021264c4d9e3be 100644 (file)
@@ -184,7 +184,7 @@ class Messages(object):
 
     def __del__(self):
         """Close and free the notmuch Messages"""
-        if self._msgs is not None:
+        if self._msgs:
             self._destroy(self._msgs)
 
     def format_messages(self, format, indent=0, entire_thread=False):
index 27bc4df79a1e97d54e385daeeca06a32a3847ff8..756e63b582a0ed6eeb06a131dfeb110e76215111 100644 (file)
@@ -203,5 +203,5 @@ class Query(object):
 
     def __del__(self):
         """Close and free the Query"""
-        if self._query is not None:
+        if self._query:
             self._destroy(self._query)
index 9b18160c3d895c501a4cba5a05f875a9b6b78149..e0598139a0d44f7499f4ebaf1d3f6fda3f0d41e2 100644 (file)
@@ -137,5 +137,5 @@ class Tags(Python3StringMixIn):
 
     def __del__(self):
         """Close and free the notmuch tags"""
-        if self._tags is not None:
+        if self._tags:
             self._destroy(self._tags)
index a47b2095b1f8d38aa90c3fb0ac152f91fffcc242..2f60d493fc52b0945e7479d9655d8b5c89edd7f6 100644 (file)
@@ -260,5 +260,5 @@ class Thread(object):
 
     def __del__(self):
         """Close and free the notmuch Thread"""
-        if self._thread is not None:
+        if self._thread:
             self._destroy(self._thread)
index fb053f939de64ca42b968571ab56a68fc0e36ec3..a6441640605b13bf909d8a7e77c5cc609e98718a 100644 (file)
@@ -176,5 +176,5 @@ class Threads(Python3StringMixIn):
 
     def __del__(self):
         """Close and free the notmuch Threads"""
-        if self._threads is not None:
+        if self._threads:
             self._destroy(self._threads)