From 162687a99e412098729d639ed7bc27f01372cb84 Mon Sep 17 00:00:00 2001
From: Justus Winter <4winter@informatik.uni-hamburg.de>
Date: Mon, 30 Apr 2012 18:52:35 +0200
Subject: [PATCH] python: fix NULL pointer tests

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  | 2 +-
 bindings/python/notmuch/directory.py | 2 +-
 bindings/python/notmuch/filenames.py | 2 +-
 bindings/python/notmuch/message.py   | 2 +-
 bindings/python/notmuch/messages.py  | 2 +-
 bindings/python/notmuch/query.py     | 2 +-
 bindings/python/notmuch/tag.py       | 2 +-
 bindings/python/notmuch/thread.py    | 2 +-
 bindings/python/notmuch/threads.py   | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py
index 0ac8b06a..525f7c9a 100644
--- a/bindings/python/notmuch/database.py
+++ b/bindings/python/notmuch/database.py
@@ -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.")
 
diff --git a/bindings/python/notmuch/directory.py b/bindings/python/notmuch/directory.py
index 667d3a4b..ae115f81 100644
--- a/bindings/python/notmuch/directory.py
+++ b/bindings/python/notmuch/directory.py
@@ -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)
diff --git a/bindings/python/notmuch/filenames.py b/bindings/python/notmuch/filenames.py
index d201ae22..a0b29563 100644
--- a/bindings/python/notmuch/filenames.py
+++ b/bindings/python/notmuch/filenames.py
@@ -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):
diff --git a/bindings/python/notmuch/message.py b/bindings/python/notmuch/message.py
index 54c4e4b2..4ec5147b 100644
--- a/bindings/python/notmuch/message.py
+++ b/bindings/python/notmuch/message.py
@@ -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)
diff --git a/bindings/python/notmuch/messages.py b/bindings/python/notmuch/messages.py
index 6b024cbe..251fa3a3 100644
--- a/bindings/python/notmuch/messages.py
+++ b/bindings/python/notmuch/messages.py
@@ -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):
diff --git a/bindings/python/notmuch/query.py b/bindings/python/notmuch/query.py
index 27bc4df7..756e63b5 100644
--- a/bindings/python/notmuch/query.py
+++ b/bindings/python/notmuch/query.py
@@ -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)
diff --git a/bindings/python/notmuch/tag.py b/bindings/python/notmuch/tag.py
index 9b18160c..e0598139 100644
--- a/bindings/python/notmuch/tag.py
+++ b/bindings/python/notmuch/tag.py
@@ -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)
diff --git a/bindings/python/notmuch/thread.py b/bindings/python/notmuch/thread.py
index a47b2095..2f60d493 100644
--- a/bindings/python/notmuch/thread.py
+++ b/bindings/python/notmuch/thread.py
@@ -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)
diff --git a/bindings/python/notmuch/threads.py b/bindings/python/notmuch/threads.py
index fb053f93..a6441640 100644
--- a/bindings/python/notmuch/threads.py
+++ b/bindings/python/notmuch/threads.py
@@ -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)
-- 
2.45.2