[Mailman-Developers] Python 1.5 compatible ? no!

Barry A. Warsaw bwarsaw@cnri.reston.va.us (Barry A. Warsaw)
Wed, 2 Sep 1998 17:44:19 -0400 (EDT)


[Damn!  Sorry for the premature response.  Let's try that again]

>>>>> "CT" == Christian Tismer <tismer@appliedbiometrics.com> writes:

    CT> This is not true. This version will not even run with a
    CT> standard 1.5.1 Python.

    CT> Killer#1: The parameter-less "raise" statement is no 1.5.1
    CT> feature.
    
    CT> Killer#2: The __stdin__ and other underscored system
    CT> file names are no Python 1.5 features.

Chris, I tried both of these under our vanilla 1.5.1 release:

-------------------- snip snip --------------------
Python 1.5.1 (#21, Apr 23 1998, 18:08:12)  [GCC 2.8.1] on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import sys
>>> sys.__stdin__
<open file '<stdin>', mode 'r' at bb878>
>>> try: 1/0
... except ZeroDivisionError: raise
... 
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ZeroDivisionError: integer division or modulo
>>> 
-------------------- snip snip --------------------

I don't have 1.5 handy but I think you're probably right that neither
will work in a 1.5 release.  In any event, the current version of the
driver tries to do sain things with sys.__stdout__ and sys.__stderr__
(I don't think sys.__stdin__ is actually referenced anywhere, but my
grep could be missing it).

-------------------- snip snip --------------------
    # Python 1.5 doesn't have these by default.  Let's make our lives easy
    if not hasattr(sys, '__stderr__'):
        sys.__stderr__ = sys.stderr
    if not hasattr(sys, '__stdout__'):
        sys.__stdout__ = sys.stdout
-------------------- snip snip --------------------

I also thought that I had commented all the bare raises out of the
code (leaving them for a time when we can better rely on its
existance).  I'm pretty sure all instances of re-raising do it the
old-fashion way, but again, I might be missing something.

Have you checked the current CVS snapshot?  I include our latest
driver script below.  See if that helps you out.

-Barry

[ATTACHMENT ~/projects/mailman/scripts/driver, application/octet-stream]