[Python-Dev] Problem in SRE ?

M.-A. Lemburg mal@lemburg.com
Wed, 07 Nov 2001 18:57:48 +0100


Michael Hudson wrote:
> 
> "M.-A. Lemburg" <mal@lemburg.com> writes:
> 
> > I've just run across a strange problem with SRE. The following
> > code does not run with the current CVS version -- the program
> > simply exists without notice even though there doesn't seem
> > to be an exit() or abort() call in SRE.
> 
> Well, your regexp doesn't work for the given version:
> 
> > Note that sys.version is
> > '2.2b1+ (#59, Nov  7 2001, 12:57:29) \n[GCC pgcc-2.95.2 19991024
> > (release)]'
> >
> > Any ideas ?
> >
> > --
> > import sys, re, string
> > _sys_version_parser = re.compile('([\w.]+)\s*'
> 
> You need a \+? in here somewhere!  Or a + inside the [].

True and thanks for the hint, but still: why does Python exit ? 

I'd expect a None return, or rather an attribute error since 
I'm asking for the .groups() method of None.

Something is either wrong with my compiler or some attribute lookup
code (or both).
 
> With this change, works fine on all Pythons I have here:
> 
> [mwh@starship mwh]$ /usr/local/bin/python foo4.py
> 2.1.1 (#1, Aug 23 2001, 22:12:58)
> [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)]
> ('2.1.1', 1, 'Aug 23 2001 22:12:58', 'GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)')
> [mwh@starship mwh]$ /usr/bin/python foo4.py
> 1.5.2 (#1, Dec 21 2000, 15:29:08)  [GCC egcs-2.91.66 19990314/Linux (egcs-
> ('1.5.2', 1, 'Dec 21 2000 15:29:08', 'GCC egcs-2.91.66 19990314/Linux (egcs-')
> [mwh@starship mwh]$ ~/bin/python foo4.py
> 2.2a4+ (#1, Oct 19 2001, 03:56:59)
> [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)]
> ('2.2a4.0', 1, 'Oct 19 2001 03:56:59', 'GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)')
> [mwh@starship mwh]$ ~/src/python/dist/src/build/python foo4.py
> 2.2b1+ (#1, Nov  7 2001, 05:07:34)
> [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)]
> ('2.2b1.0', 1, 'Nov  7 2001 05:07:34', 'GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)')

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Consulting & Company:                           http://www.egenix.com/
Python Software:                        http://www.lemburg.com/python/