New submission from Samuel John:

As also discussed at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=704084 
and https://github.com/mxcl/homebrew/pull/19300, Python 2.7.4 and 2.7.5 seem to 
have added an `from _sre import MAXREPEAT` to the sre_compile.py, sre_parse.py 
and sre_constants.py modules.

But python 2.7.3 (and older?) don't have the built in MAXREPEAT in _sre. Some 
virtualenvs have to be updated (which is easy) but some Software (such as vim, 
shipped with OS X 10.8.3) is statically linked to an older python 2.7.2 (I 
guess) but somehow picks up my newly built python 2.7.5 and attempts to load 
it's site.py. (Weechat also reported to being affected)

I think this is more a bug of vim/weechat etc. but we at homebrew have to do 
some "hacky" fix, because Apple is not going to update vim very soon, and so 
having a newer python in path breaks system stuff.

So I am fine if you close this here again. But at least we have a reference or 
perhaps you guys have a better idea how to work-around.

For homebrew, I propose a monkey-patch in re.py to the _sre module if it does 
not have a MAXREPEAT.


   try:
       from _sre import MAXREPEAT
   except ImportError:
       import _sre
       _sre.MAXREPEAT = 65535 # this monkey-patches all other places of "from 
_sre import MAXREPEAT"

----------
components: Extension Modules, Regular Expressions
messages: 189924
nosy: ezio.melotti, mrabarnett, samueljohn
priority: normal
severity: normal
status: open
title: _sre.MAXREPEAT not defined in 2.7.3
type: crash
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18050>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to