[Python-Dev] 2.5: uses of sys.exc_type, exc_value

Guido van Rossum guido at python.org
Wed Jul 26 20:21:50 CEST 2006


Clearly they should be fixed. Whether in 2.5 or 2.6 I'll leave up to
Neal and Anthony.

On 7/26/06, A.M. Kuchling <amk at amk.ca> wrote:
> http://www.python.org/sf/1525469 reports that SimpleXMLRPCServer.py
> still uses sys.exc_type and sys.exc_value when handling exceptions.
> These variables aren't thread-safe and sys.exc_info() is the better
> way.  I have a patch attached to the bug that fixes the problem.
>
> Question 1: is this worth fixing for 2.5?  (It's not really a bugfix,
> more of a style cleanup.)
>
> Question 2: I searched for uses of the old variables and found these:
>
> Lib/idlelib/WindowList.py:                      sys.exc_type, ":", sys.exc_value
> Lib/logging/__init__.py:        return sys.exc_traceback.tb_frame.f_back
> Lib/lib-tk/Tkinter.py:        exc, val, tb = sys.exc_type, sys.exc_value, sys.exc_traceback
> Lib/plat-mac/cfmfile.py:                    raise Res.Error, "no 'cfrg' resource found", sys.exc_traceback
> Lib/SocketServer.py:            sys.exc_traceback = None    # Help garbage collection
>
> Plus some references in the test suite, the demos, and faqwizard.py.
>
> SocketServer should use sys.exc_clear() instead.  Tkinter.py could
> just call exc_info(), but I wonder if the usage of the variables is
> intentional here.  sys.exc_info() was introduced in Python 1.5, so
> logging/__init__.py could be fixed without affecting 1.5.2
> compatibility.
>
> Should the above uses be fixed, too?
>
> --amk
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list