Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8f943ca commit 8620be9Copy full SHA for 8620be9
1 file changed
Objects/unicodeobject.c
@@ -1994,8 +1994,10 @@ unicode_is_singleton(PyObject *unicode)
1994
if (unicode == state->empty_string) {
1995
return 1;
1996
}
1997
- for (Py_ssize_t i = 0; i < 256; i++) {
1998
- if (unicode == state->latin1[i]) {
+ PyASCIIObject *ascii = (PyASCIIObject *)unicode;
+ if (ascii->state.kind != PyUnicode_WCHAR_KIND && ascii->length == 1) {
1999
+ Py_UCS4 ch = PyUnicode_READ_CHAR(unicode, 0);
2000
+ if (ch < 256 && state->latin1[ch] == unicode) {
2001
2002
2003
0 commit comments