Skip to content

Commit f03c98b

Browse files
committed
Add support for the Py_UNICODE datatype.
1 parent de8c3d3 commit f03c98b

File tree

4 files changed

+422
-1
lines changed

4 files changed

+422
-1
lines changed

generate.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,23 @@
3232
("Py_ReprEnter", "O", "i"),
3333
("Py_ReprLeave", "O", ""),
3434
("Py_SetProgramName", "u", ""),
35+
("Py_UNICODE_ISALNUM", "C", "i"),
36+
("Py_UNICODE_ISALPHA", "C", "i"),
37+
("Py_UNICODE_ISDECIMAL", "C", "i"),
38+
("Py_UNICODE_ISDIGIT", "C", "i"),
39+
("Py_UNICODE_ISLINEBREAK", "C", "i"),
40+
("Py_UNICODE_ISLOWER", "C", "i"),
41+
("Py_UNICODE_ISNUMERIC", "C", "i"),
42+
("Py_UNICODE_ISPRINTABLE", "C", "i"),
43+
("Py_UNICODE_ISSPACE", "C", "i"),
44+
("Py_UNICODE_ISTITLE", "C", "i"),
45+
("Py_UNICODE_ISUPPER", "C", "i"),
46+
("Py_UNICODE_TODECIMAL", "C", "i"),
47+
("Py_UNICODE_TODIGIT", "C", "i"),
48+
("Py_UNICODE_TOLOWER", "C", "C"),
49+
("Py_UNICODE_TONUMERIC", "C", "d"),
50+
("Py_UNICODE_TOTITLE", "C", "C"),
51+
("Py_UNICODE_TOUPPER", "C", "C"),
3552
("Py_XDECREF", "O", ""),
3653
("Py_XINCREF", "O", ""),
3754
("PyAnySet_Check", "O", "i"),
@@ -731,6 +748,7 @@
731748
("PyUnicodeDecodeError_SetEnd", "On", "i"),
732749
("PyUnicodeDecodeError_SetReason", "Oy", "i"),
733750
("PyUnicodeDecodeError_SetStart", "On", "i"),
751+
("PyUnicodeEncodeError_Create", "yunnny", "N"),
734752
("PyUnicodeTranslateError_Create", "unnny", "N"),
735753
("PyWeakref_Check", "O", "i"),
736754
("PyWeakref_CheckProxy", "O", "i"),
@@ -760,6 +778,7 @@
760778
STUB = "def {}({}) -> {}: ..."
761779

762780
ARG_TYPES_PYI = {
781+
"C": "str",
763782
"c": "bytes",
764783
"D": "complex",
765784
"d": "float",
@@ -776,6 +795,7 @@
776795

777796
RETURN_TYPES_PYI = {
778797
"": "None",
798+
"C": "str",
779799
"D": "complex",
780800
"d": "float",
781801
"i": "int",
@@ -790,6 +810,7 @@
790810
}
791811

792812
ARG_TYPES_C = {
813+
"C": "int",
793814
"c": "char",
794815
"D": "Py_complex",
795816
"d": "double",
@@ -806,6 +827,7 @@
806827

807828
RETURN_TYPES_C = {
808829
"": "void",
830+
"C": "int",
809831
"D": "Py_complex",
810832
"d": "double",
811833
"i": "int",
@@ -821,6 +843,7 @@
821843

822844
CONVERTERS = {
823845
"": "Py_RETURN_NONE;",
846+
"C": 'return PyUnicode_FromFormat("%c", result);',
824847
"D": "return PyComplex_FromCComplex(result);",
825848
"d": "return PyFloat_FromDouble(result);",
826849
"i": "return PyLong_FromLong(result);",

0 commit comments

Comments
 (0)