[Python-bugs-list] [ python-Bugs-607668 ] Warnings can cause application errors

noreply@sourceforge.net noreply@sourceforge.net
Wed, 11 Sep 2002 01:33:56 -0700


Bugs item #607668, was opened at 2002-09-11 08:17
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=607668&group_id=5470

Category: Python Library
Group: None
Status: Open
>Resolution: Accepted
Priority: 5
Submitted By: Mark Hammond (mhammond)
>Assigned to: Mark Hammond (mhammond)
Summary: Warnings can cause application errors

Initial Comment:
If an application embeds Python while stderr is not
valid, warnings can cause unexpected exceptions in the
application.  This is particularly a problem when it
happens *while* the application is attempting to create
a valid stderr :)

Pythonwin recently started failing to start with the
following traceback:

  File "f:\src\python-cvs\lib\regsub.py", line 15, in ?
    DeprecationWarning)
  File "f:\src\python-cvs\lib\warnings.py", line 45, in
warn
    warn_explicit(message, category, filename, lineno,
module, registry)
  File "f:\src\python-cvs\lib\warnings.py", line 104,
in warn_explicit
    showwarning(message, category, filename, lineno)
  File "f:\src\python-cvs\lib\warnings.py", line 110,
in showwarning
    file.write(formatwarning(message, category,
filename, lineno))
exceptions.IOError: (9, 'Bad file descriptor')

I propose that the warnings module ignore IOError
exceptions when writing the warning.  Attaching
proposed fix.

Assigning to Martin for feedback - assign back for me
to check in.


----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2002-09-11 10:33

Message:
Logged In: YES 
user_id=21627

Looks good, please apply it.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=607668&group_id=5470