Ai
25 Star 1 Fork 14

src-openEuler/python2

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
bugfix-excessive-memory-usage-when-using-regular-expressions.patch 866 Bytes
Copy Edit Raw Blame History
diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py
index b6689fa..0063845 100644
--- a/Lib/sre_compile.py
+++ b/Lib/sre_compile.py
@@ -271,7 +271,7 @@ def _optimize_charset(charset, fixup, fixes, isunicode):
else:
charmap[av] = 1
elif op is RANGE:
- r = range(av[0], av[1]+1)
+ r = xrange(av[0], av[1]+1)
if fixup:
r = map(fixup, r)
if fixup and fixes:
@@ -374,7 +374,7 @@ def _optimize_charset(charset, fixup, fixes, isunicode):
mapping = bytearray(256)
block = 0
data = bytearray()
- for i in range(0, 65536, 256):
+ for i in xrange(0, 65536, 256):
chunk = charmap[i: i + 256]
if chunk in comps:
mapping[i // 256] = comps[chunk]
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/python2.git
git@gitee.com:src-openeuler/python2.git
src-openeuler
python2
python2
master

Search