mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
bpo-44987: Speed up unicode normalization of ASCII strings (GH-28283)
This commit is contained in:
parent
97ea18eced
commit
9abd07e596
3 changed files with 9 additions and 0 deletions
|
|
@ -287,6 +287,9 @@ Optimizations
|
|||
|
||||
* :file:`.pdbrc` is now read with ``'utf-8'`` encoding.
|
||||
|
||||
* Pure ASCII strings are now normalized in constant time by :func:`unicodedata.normalize`.
|
||||
(Contributed by Dong-hee Na in :issue:`bpo-44987`.)
|
||||
|
||||
|
||||
CPython bytecode changes
|
||||
========================
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
Pure ASCII strings are now normalized in constant time by :func:`unicodedata.normalize`.
|
||||
Patch by Dong-hee Na.
|
||||
|
|
@ -807,6 +807,10 @@ is_normalized_quickcheck(PyObject *self, PyObject *input, bool nfc, bool k,
|
|||
return NO;
|
||||
}
|
||||
|
||||
if (PyUnicode_IS_ASCII(input)) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
Py_ssize_t i, len;
|
||||
int kind;
|
||||
const void *data;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue