Regular Expressions and Threads?

Andrew M. Kuchling akuchlin at mems-exchange.org
Thu Jun 15 15:22:30 EDT 2000


aahz at netcom.com (Aahz Maruch) writes:
> checking for the existence of a match, that could cause problems.  (As
> with anything else, the re module should be thread-safe, but individual
> re objects probably are not.)

No, individual re objects should be.  The MatchObject you get back
from a matching operation contains references to the string, groups,
and original regex object, but a RegexObject shouldn't ever change
after it's been created.  Tim Peters put some effort into making the
cache thread-safe.  Brian, can you post the relevant bits of code so
we can see what's going on?

-- 
A.M. Kuchling			http://starship.python.net/crew/amk/
Surprisingly enough, Python has taught me more about Lisp than Lisp ever did.
  -- Glyph Lefkowitz, 03 May 2000



More information about the Python-list mailing list