Hi Dennis,

Dennis Benzinger wrote:

Maurice LING schrieb:

Hi,

I have the following codes:

from __future__ import nested_scopes

> [...]

Are you still using Python 2.1?

In every later version you don't need the
"from __future__ import nested_scopes" line.

So, if you are using Python 2.1 I strongly recommend
upgrading to Python 2.4.1.


I am using Python 2.3.5, installed using Fink. That is the latest version Fink has to offer.


[...]
It all works well for rule count up to 800+ but when my replacement rules swells up to 1800+, it gives me a runtime error that says "Internal error in regular expression engine"... traceable to "return self.regex.sub(self, text)" in substitute() method.
[...]


I didn't read your code, but this sounds like you have a problem with the regular expression engine being recursive in Python versions < 2.4.
Try again using Python 2.4 or later (i.e. Python 2.4.1). The new regular expression engine is not recursive anymore.



Apparently this problem had been reported in Bugs item #857676 (http://mail.python.org/pipermail/python-bugs-list/2003-December/021473.html) and (http://www.lehuen.com/nicolas/index.php/Pytst/2005/04). Bugs item #857676 is consistent with my problem as in it works with smaller lists (~1000) but not much bigger than that. The problem seems to lie in the fact that the SRE engine works on a 16-bit opcode...


Cheers
Maurice
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to