Author: Armin Rigo <[email protected]>
Branch: unicode-utf8
Changeset: r93232:a868253965d3
Date: 2017-12-01 14:05 +0100
http://bitbucket.org/pypy/pypy/changeset/a868253965d3/
Log: Get rid of this function (there is codepoints_in_utf8())
diff --git a/rpython/rlib/rstring.py b/rpython/rlib/rstring.py
--- a/rpython/rlib/rstring.py
+++ b/rpython/rlib/rstring.py
@@ -253,7 +253,7 @@
else:
assert isutf8
from rpython.rlib import rutf8
- cnt = rutf8.compute_length_utf8(input) + 1
+ cnt = rutf8.codepoints_in_utf8(input) + 1
if cnt > maxsplit and maxsplit > 0:
cnt = maxsplit
diff --git a/rpython/rlib/rutf8.py b/rpython/rlib/rutf8.py
--- a/rpython/rlib/rutf8.py
+++ b/rpython/rlib/rutf8.py
@@ -120,13 +120,6 @@
assert pos >= 0
return pos
-def compute_length_utf8(s):
- continuation_bytes = 0
- for i in range(len(s)):
- if 0x80 <= ord(s[i]) <= 0xBF: # count the continuation bytes
- continuation_bytes += 1
- return len(s) - continuation_bytes
-
def codepoint_at_pos(code, pos):
""" Give a codepoint in code at pos - assumes valid utf8, no checking!
"""
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit