This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Warnings can cause application errors
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: mhammond Nosy List: loewis, mhammond
Priority: normal Keywords:

Created on 2002-09-11 06:17 by mhammond, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
warnings.py.patch mhammond, 2002-09-11 06:17 Proposed fix
Messages (3)
msg12345 - (view) Author: Mark Hammond (mhammond) * (Python committer) Date: 2002-09-11 06:17
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.
msg12346 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-09-11 08:33
Logged In: YES 
user_id=21627

Looks good, please apply it.
msg12347 - (view) Author: Mark Hammond (mhammond) * (Python committer) Date: 2002-09-11 13:23
Logged In: YES 
user_id=14198

Checking in warnings.py;
/cvsroot/python/python/dist/src/Lib/warnings.py,v  <-- 
warnings.py
new revision: 1.17; previous revision: 1.16
History
Date User Action Args
2022-04-10 16:05:40adminsetgithub: 37162
2002-09-11 06:17:40mhammondcreate