mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 04:18:08 +01:00
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>
This commit is contained in:
parent
09fdf2b283
commit
162687a99e
9 changed files with 9 additions and 9 deletions
|
@ -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.")
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue