|
15 | 15 | #ifndef Py_BUILD_CORE_BUILTIN
|
16 | 16 | # define Py_BUILD_CORE_MODULE 1
|
17 | 17 | #endif
|
18 |
| -#define NEEDS_PY_IDENTIFIER |
19 | 18 |
|
20 | 19 | #define PY_SSIZE_T_CLEAN
|
21 | 20 |
|
|
25 | 24 |
|
26 | 25 | #include <stdbool.h>
|
27 | 26 |
|
28 |
| -_Py_IDENTIFIER(NFC); |
29 |
| -_Py_IDENTIFIER(NFD); |
30 |
| -_Py_IDENTIFIER(NFKC); |
31 |
| -_Py_IDENTIFIER(NFKD); |
32 |
| - |
33 | 27 | /*[clinic input]
|
34 | 28 | module unicodedata
|
35 | 29 | class unicodedata.UCD 'PreviousDBVersion *' '<not used>'
|
@@ -890,17 +884,17 @@ unicodedata_UCD_is_normalized_impl(PyObject *self, PyObject *form,
|
890 | 884 | PyObject *cmp;
|
891 | 885 | int match = 0;
|
892 | 886 |
|
893 |
| - if (_PyUnicode_EqualToASCIIId(form, &PyId_NFC)) { |
| 887 | + if (PyUnicode_CompareWithASCIIString(form, "NFC") == 0) { |
894 | 888 | nfc = true;
|
895 | 889 | }
|
896 |
| - else if (_PyUnicode_EqualToASCIIId(form, &PyId_NFKC)) { |
| 890 | + else if (PyUnicode_CompareWithASCIIString(form, "NFKC") == 0) { |
897 | 891 | nfc = true;
|
898 | 892 | k = true;
|
899 | 893 | }
|
900 |
| - else if (_PyUnicode_EqualToASCIIId(form, &PyId_NFD)) { |
| 894 | + else if (PyUnicode_CompareWithASCIIString(form, "NFD") == 0) { |
901 | 895 | /* matches default values for `nfc` and `k` */
|
902 | 896 | }
|
903 |
| - else if (_PyUnicode_EqualToASCIIId(form, &PyId_NFKD)) { |
| 897 | + else if (PyUnicode_CompareWithASCIIString(form, "NFKD") == 0) { |
904 | 898 | k = true;
|
905 | 899 | }
|
906 | 900 | else {
|
@@ -953,31 +947,31 @@ unicodedata_UCD_normalize_impl(PyObject *self, PyObject *form,
|
953 | 947 | return input;
|
954 | 948 | }
|
955 | 949 |
|
956 |
| - if (_PyUnicode_EqualToASCIIId(form, &PyId_NFC)) { |
| 950 | + if (PyUnicode_CompareWithASCIIString(form, "NFC") == 0) { |
957 | 951 | if (is_normalized_quickcheck(self, input,
|
958 | 952 | true, false, true) == YES) {
|
959 | 953 | Py_INCREF(input);
|
960 | 954 | return input;
|
961 | 955 | }
|
962 | 956 | return nfc_nfkc(self, input, 0);
|
963 | 957 | }
|
964 |
| - if (_PyUnicode_EqualToASCIIId(form, &PyId_NFKC)) { |
| 958 | + if (PyUnicode_CompareWithASCIIString(form, "NFKC") == 0) { |
965 | 959 | if (is_normalized_quickcheck(self, input,
|
966 | 960 | true, true, true) == YES) {
|
967 | 961 | Py_INCREF(input);
|
968 | 962 | return input;
|
969 | 963 | }
|
970 | 964 | return nfc_nfkc(self, input, 1);
|
971 | 965 | }
|
972 |
| - if (_PyUnicode_EqualToASCIIId(form, &PyId_NFD)) { |
| 966 | + if (PyUnicode_CompareWithASCIIString(form, "NFD") == 0) { |
973 | 967 | if (is_normalized_quickcheck(self, input,
|
974 | 968 | false, false, true) == YES) {
|
975 | 969 | Py_INCREF(input);
|
976 | 970 | return input;
|
977 | 971 | }
|
978 | 972 | return nfd_nfkd(self, input, 0);
|
979 | 973 | }
|
980 |
| - if (_PyUnicode_EqualToASCIIId(form, &PyId_NFKD)) { |
| 974 | + if (PyUnicode_CompareWithASCIIString(form, "NFKD") == 0) { |
981 | 975 | if (is_normalized_quickcheck(self, input,
|
982 | 976 | false, true, true) == YES) {
|
983 | 977 | Py_INCREF(input);
|
|
0 commit comments