ts_regex.py broken in Z2.0 final? was [Zope] Announce: Confera 1.3.1
On Thu, 2 Sep 1999, Nick Garcia wrote:
Looks good here! I guess this means I don't have to look into it after all ;) Well, it doesn't look to well here.
Actually, the fix I've did, I understand, I've switched from the old regsub to the threadsafe regex module. Now this, I don't understand, it seems like the ts_regex.py is broken for gsub. The offending line in Confera.py is: body =split(ts_regex.gsub(crlf,'\n',body),'\n') Which seems to make quite sense to me. Traceback (innermost last): File /home/zopebot/redhat/BUILD/Zope-2.0.0-src/lib/python/ZPublisher/Publish.py, line 214, in publish_module File /home/zopebot/redhat/BUILD/Zope-2.0.0-src/lib/python/ZPublisher/Publish.py, line 179, in publish File /home/zopebot/redhat/BUILD/Zope-2.0.0-src/lib/python/Zope/__init__.py, line 201, in zpublisher_exception_hook File /home/zopebot/redhat/BUILD/Zope-2.0.0-src/lib/python/ZPublisher/Publish.py, line 165, in publish File /home/zopebot/redhat/BUILD/Zope-2.0.0-src/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: addMessage) File /home/zopebot/redhat/BUILD/Zope-2.0.0-src/lib/python/ZPublisher/Publish.py, line 102, in call_object (Object: addMessage) File /home/zopebot/zope/Products/Confera/Confera.py, line 568, in addMessage File /home/zopebot/redhat/BUILD/Zope-2.0.0-src/lib/python/ts_regex.py, line 109, in __call__ File /var/tmp/mze-python-root/opt/mtg/lib/python1.5/regsub.py, line 38, in gsub AttributeError: (see above) Andreas -- Andreas Kostyrka | andreas@mtg.co.at phone: +43/1/7070750 | phone: +43/676/4091256 MTG Handelsges.m.b.H. | fax: +43/1/7065299 Raiffeisenstr. 16/9 | 2320 Zwoelfaxing AUSTRIA
Andreas Kostyrka wrote:
On Thu, 2 Sep 1999, Nick Garcia wrote:
Looks good here! I guess this means I don't have to look into it after all ;) Well, it doesn't look to well here.
Actually, the fix I've did, I understand, I've switched from the old regsub to the threadsafe regex module. Now this, I don't understand, it seems like the ts_regex.py is broken for gsub.
gsub uses regular expressions in a thread-unsafe way, because gsub uses a the non-thread-safe interface. ts_regex.gsub gets around this by serializing all gsub calls. You must use a regex regular expression with gsub, not a ts_regex regular expression. Just make sure that regular expressions used with ts_regex.gsub are *only* used with ts_regex.gsub. Here's an example: import regex, ts_regex r=regex.compile("...") ... x=ts_regex.gsub(r, foo, bar) Note that early versions of ts_regex did not have this problem because they were not thread safe. Jim -- Jim Fulton mailto:jim@digicool.com Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
participants (2)
-
Andreas Kostyrka -
Jim Fulton