@@ -16,7 +16,7 @@ def _print(file, str='', terminator='\n'):
1616def print_list (extracted_list , file = None ):
1717 """Print the list of tuples as returned by extract_tb() or
1818 extract_stack() as a formatted stack trace to the given file."""
19- if not file :
19+ if file is None :
2020 file = sys .stderr
2121 for filename , lineno , name , line in extracted_list :
2222 _print (file ,
@@ -51,7 +51,7 @@ def print_tb(tb, limit=None, file=None):
5151 'file' should be an open file or file-like object with a write()
5252 method.
5353 """
54- if not file :
54+ if file is None :
5555 file = sys .stderr
5656 if limit is None :
5757 if hasattr (sys , 'tracebacklimit' ):
@@ -116,7 +116,7 @@ def print_exception(etype, value, tb, limit=None, file=None):
116116 occurred with a caret on the next line indicating the approximate
117117 position of the error.
118118 """
119- if not file :
119+ if file is None :
120120 file = sys .stderr
121121 if tb :
122122 _print (file , 'Traceback (most recent call last):' )
@@ -203,7 +203,7 @@ def print_exc(limit=None, file=None):
203203 """Shorthand for 'print_exception(sys.exc_type, sys.exc_value, sys.exc_traceback, limit, file)'.
204204 (In fact, it uses sys.exc_info() to retrieve the same information
205205 in a thread-safe way.)"""
206- if not file :
206+ if file is None :
207207 file = sys .stderr
208208 try :
209209 etype , value , tb = sys .exc_info ()
@@ -214,7 +214,7 @@ def print_exc(limit=None, file=None):
214214def print_last (limit = None , file = None ):
215215 """This is a shorthand for 'print_exception(sys.last_type,
216216 sys.last_value, sys.last_traceback, limit, file)'."""
217- if not file :
217+ if file is None :
218218 file = sys .stderr
219219 print_exception (sys .last_type , sys .last_value , sys .last_traceback ,
220220 limit , file )
0 commit comments