Updated to reflect change in logging.config to remove out-of-date comment in _install...
[python.git] / Objects / stringlib / ctype.h
blob89512768144d24b8a6c67dbfa9124b4b050336b8
1 /* NOTE: this API is -ONLY- for use with single byte character strings. */
2 /* Do not use it with Unicode. */
4 #include "bytes_methods.h"
6 static PyObject*
7 stringlib_isspace(PyObject *self)
9 return _Py_bytes_isspace(STRINGLIB_STR(self), STRINGLIB_LEN(self));
12 static PyObject*
13 stringlib_isalpha(PyObject *self)
15 return _Py_bytes_isalpha(STRINGLIB_STR(self), STRINGLIB_LEN(self));
18 static PyObject*
19 stringlib_isalnum(PyObject *self)
21 return _Py_bytes_isalnum(STRINGLIB_STR(self), STRINGLIB_LEN(self));
24 static PyObject*
25 stringlib_isdigit(PyObject *self)
27 return _Py_bytes_isdigit(STRINGLIB_STR(self), STRINGLIB_LEN(self));
30 static PyObject*
31 stringlib_islower(PyObject *self)
33 return _Py_bytes_islower(STRINGLIB_STR(self), STRINGLIB_LEN(self));
36 static PyObject*
37 stringlib_isupper(PyObject *self)
39 return _Py_bytes_isupper(STRINGLIB_STR(self), STRINGLIB_LEN(self));
42 static PyObject*
43 stringlib_istitle(PyObject *self)
45 return _Py_bytes_istitle(STRINGLIB_STR(self), STRINGLIB_LEN(self));
49 /* functions that return a new object partially translated by ctype funcs: */
51 static PyObject*
52 stringlib_lower(PyObject *self)
54 PyObject* newobj;
55 newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
56 if (!newobj)
57 return NULL;
58 _Py_bytes_lower(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
59 STRINGLIB_LEN(self));
60 return newobj;
63 static PyObject*
64 stringlib_upper(PyObject *self)
66 PyObject* newobj;
67 newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
68 if (!newobj)
69 return NULL;
70 _Py_bytes_upper(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
71 STRINGLIB_LEN(self));
72 return newobj;
75 static PyObject*
76 stringlib_title(PyObject *self)
78 PyObject* newobj;
79 newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
80 if (!newobj)
81 return NULL;
82 _Py_bytes_title(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
83 STRINGLIB_LEN(self));
84 return newobj;
87 static PyObject*
88 stringlib_capitalize(PyObject *self)
90 PyObject* newobj;
91 newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
92 if (!newobj)
93 return NULL;
94 _Py_bytes_capitalize(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
95 STRINGLIB_LEN(self));
96 return newobj;
99 static PyObject*
100 stringlib_swapcase(PyObject *self)
102 PyObject* newobj;
103 newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
104 if (!newobj)
105 return NULL;
106 _Py_bytes_swapcase(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
107 STRINGLIB_LEN(self));
108 return newobj;