mirror of https://github.com/python/cpython.git
Remove usage of _Py_IDENTIFIER from unicodedata module. (GH-91532)
This commit is contained in:
parent
f1e989b045
commit
2bf5f64455
|
@ -15,7 +15,6 @@
|
||||||
#ifndef Py_BUILD_CORE_BUILTIN
|
#ifndef Py_BUILD_CORE_BUILTIN
|
||||||
# define Py_BUILD_CORE_MODULE 1
|
# define Py_BUILD_CORE_MODULE 1
|
||||||
#endif
|
#endif
|
||||||
#define NEEDS_PY_IDENTIFIER
|
|
||||||
|
|
||||||
#define PY_SSIZE_T_CLEAN
|
#define PY_SSIZE_T_CLEAN
|
||||||
|
|
||||||
|
@ -25,11 +24,6 @@
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
_Py_IDENTIFIER(NFC);
|
|
||||||
_Py_IDENTIFIER(NFD);
|
|
||||||
_Py_IDENTIFIER(NFKC);
|
|
||||||
_Py_IDENTIFIER(NFKD);
|
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
module unicodedata
|
module unicodedata
|
||||||
class unicodedata.UCD 'PreviousDBVersion *' '<not used>'
|
class unicodedata.UCD 'PreviousDBVersion *' '<not used>'
|
||||||
|
@ -890,17 +884,17 @@ unicodedata_UCD_is_normalized_impl(PyObject *self, PyObject *form,
|
||||||
PyObject *cmp;
|
PyObject *cmp;
|
||||||
int match = 0;
|
int match = 0;
|
||||||
|
|
||||||
if (_PyUnicode_EqualToASCIIId(form, &PyId_NFC)) {
|
if (PyUnicode_CompareWithASCIIString(form, "NFC") == 0) {
|
||||||
nfc = true;
|
nfc = true;
|
||||||
}
|
}
|
||||||
else if (_PyUnicode_EqualToASCIIId(form, &PyId_NFKC)) {
|
else if (PyUnicode_CompareWithASCIIString(form, "NFKC") == 0) {
|
||||||
nfc = true;
|
nfc = true;
|
||||||
k = true;
|
k = true;
|
||||||
}
|
}
|
||||||
else if (_PyUnicode_EqualToASCIIId(form, &PyId_NFD)) {
|
else if (PyUnicode_CompareWithASCIIString(form, "NFD") == 0) {
|
||||||
/* matches default values for `nfc` and `k` */
|
/* matches default values for `nfc` and `k` */
|
||||||
}
|
}
|
||||||
else if (_PyUnicode_EqualToASCIIId(form, &PyId_NFKD)) {
|
else if (PyUnicode_CompareWithASCIIString(form, "NFKD") == 0) {
|
||||||
k = true;
|
k = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -953,7 +947,7 @@ unicodedata_UCD_normalize_impl(PyObject *self, PyObject *form,
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_PyUnicode_EqualToASCIIId(form, &PyId_NFC)) {
|
if (PyUnicode_CompareWithASCIIString(form, "NFC") == 0) {
|
||||||
if (is_normalized_quickcheck(self, input,
|
if (is_normalized_quickcheck(self, input,
|
||||||
true, false, true) == YES) {
|
true, false, true) == YES) {
|
||||||
Py_INCREF(input);
|
Py_INCREF(input);
|
||||||
|
@ -961,7 +955,7 @@ unicodedata_UCD_normalize_impl(PyObject *self, PyObject *form,
|
||||||
}
|
}
|
||||||
return nfc_nfkc(self, input, 0);
|
return nfc_nfkc(self, input, 0);
|
||||||
}
|
}
|
||||||
if (_PyUnicode_EqualToASCIIId(form, &PyId_NFKC)) {
|
if (PyUnicode_CompareWithASCIIString(form, "NFKC") == 0) {
|
||||||
if (is_normalized_quickcheck(self, input,
|
if (is_normalized_quickcheck(self, input,
|
||||||
true, true, true) == YES) {
|
true, true, true) == YES) {
|
||||||
Py_INCREF(input);
|
Py_INCREF(input);
|
||||||
|
@ -969,7 +963,7 @@ unicodedata_UCD_normalize_impl(PyObject *self, PyObject *form,
|
||||||
}
|
}
|
||||||
return nfc_nfkc(self, input, 1);
|
return nfc_nfkc(self, input, 1);
|
||||||
}
|
}
|
||||||
if (_PyUnicode_EqualToASCIIId(form, &PyId_NFD)) {
|
if (PyUnicode_CompareWithASCIIString(form, "NFD") == 0) {
|
||||||
if (is_normalized_quickcheck(self, input,
|
if (is_normalized_quickcheck(self, input,
|
||||||
false, false, true) == YES) {
|
false, false, true) == YES) {
|
||||||
Py_INCREF(input);
|
Py_INCREF(input);
|
||||||
|
@ -977,7 +971,7 @@ unicodedata_UCD_normalize_impl(PyObject *self, PyObject *form,
|
||||||
}
|
}
|
||||||
return nfd_nfkd(self, input, 0);
|
return nfd_nfkd(self, input, 0);
|
||||||
}
|
}
|
||||||
if (_PyUnicode_EqualToASCIIId(form, &PyId_NFKD)) {
|
if (PyUnicode_CompareWithASCIIString(form, "NFKD") == 0) {
|
||||||
if (is_normalized_quickcheck(self, input,
|
if (is_normalized_quickcheck(self, input,
|
||||||
false, true, true) == YES) {
|
false, true, true) == YES) {
|
||||||
Py_INCREF(input);
|
Py_INCREF(input);
|
||||||
|
|
Loading…
Reference in New Issue