[Zope-dev] Re: [Zope] ts_regex.py broken in Z2.0 final? was [Zope] Announce:
Confera 1.3.1
Confera 1.3.1
Jim Fulton
jim@digicool.com
Fri, 03 Sep 1999 08:43:43 -0400
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.