Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 1 | /*[clinic input] |
| 2 | preserve |
| 3 | [clinic start generated code]*/ |
| 4 | |
| 5 | PyDoc_STRVAR(_tkinter_tkapp_eval__doc__, |
| 6 | "eval($self, script, /)\n" |
| 7 | "--\n" |
| 8 | "\n"); |
| 9 | |
| 10 | #define _TKINTER_TKAPP_EVAL_METHODDEF \ |
| 11 | {"eval", (PyCFunction)_tkinter_tkapp_eval, METH_O, _tkinter_tkapp_eval__doc__}, |
| 12 | |
| 13 | static PyObject * |
| 14 | _tkinter_tkapp_eval_impl(TkappObject *self, const char *script); |
| 15 | |
| 16 | static PyObject * |
| 17 | _tkinter_tkapp_eval(TkappObject *self, PyObject *arg) |
| 18 | { |
| 19 | PyObject *return_value = NULL; |
| 20 | const char *script; |
| 21 | |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 22 | if (!PyUnicode_Check(arg)) { |
Rémi Lapeyre | 4901fe2 | 2019-08-29 16:49:08 +0200 | [diff] [blame] | 23 | _PyArg_BadArgument("eval", "argument", "str", arg); |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 24 | goto exit; |
| 25 | } |
| 26 | Py_ssize_t script_length; |
| 27 | script = PyUnicode_AsUTF8AndSize(arg, &script_length); |
| 28 | if (script == NULL) { |
| 29 | goto exit; |
| 30 | } |
| 31 | if (strlen(script) != (size_t)script_length) { |
| 32 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 33 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 34 | } |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 35 | return_value = _tkinter_tkapp_eval_impl(self, script); |
| 36 | |
| 37 | exit: |
| 38 | return return_value; |
| 39 | } |
| 40 | |
| 41 | PyDoc_STRVAR(_tkinter_tkapp_evalfile__doc__, |
| 42 | "evalfile($self, fileName, /)\n" |
| 43 | "--\n" |
| 44 | "\n"); |
| 45 | |
| 46 | #define _TKINTER_TKAPP_EVALFILE_METHODDEF \ |
| 47 | {"evalfile", (PyCFunction)_tkinter_tkapp_evalfile, METH_O, _tkinter_tkapp_evalfile__doc__}, |
| 48 | |
| 49 | static PyObject * |
| 50 | _tkinter_tkapp_evalfile_impl(TkappObject *self, const char *fileName); |
| 51 | |
| 52 | static PyObject * |
| 53 | _tkinter_tkapp_evalfile(TkappObject *self, PyObject *arg) |
| 54 | { |
| 55 | PyObject *return_value = NULL; |
| 56 | const char *fileName; |
| 57 | |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 58 | if (!PyUnicode_Check(arg)) { |
Rémi Lapeyre | 4901fe2 | 2019-08-29 16:49:08 +0200 | [diff] [blame] | 59 | _PyArg_BadArgument("evalfile", "argument", "str", arg); |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 60 | goto exit; |
| 61 | } |
| 62 | Py_ssize_t fileName_length; |
| 63 | fileName = PyUnicode_AsUTF8AndSize(arg, &fileName_length); |
| 64 | if (fileName == NULL) { |
| 65 | goto exit; |
| 66 | } |
| 67 | if (strlen(fileName) != (size_t)fileName_length) { |
| 68 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 69 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 70 | } |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 71 | return_value = _tkinter_tkapp_evalfile_impl(self, fileName); |
| 72 | |
| 73 | exit: |
| 74 | return return_value; |
| 75 | } |
| 76 | |
| 77 | PyDoc_STRVAR(_tkinter_tkapp_record__doc__, |
| 78 | "record($self, script, /)\n" |
| 79 | "--\n" |
| 80 | "\n"); |
| 81 | |
| 82 | #define _TKINTER_TKAPP_RECORD_METHODDEF \ |
| 83 | {"record", (PyCFunction)_tkinter_tkapp_record, METH_O, _tkinter_tkapp_record__doc__}, |
| 84 | |
| 85 | static PyObject * |
| 86 | _tkinter_tkapp_record_impl(TkappObject *self, const char *script); |
| 87 | |
| 88 | static PyObject * |
| 89 | _tkinter_tkapp_record(TkappObject *self, PyObject *arg) |
| 90 | { |
| 91 | PyObject *return_value = NULL; |
| 92 | const char *script; |
| 93 | |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 94 | if (!PyUnicode_Check(arg)) { |
Rémi Lapeyre | 4901fe2 | 2019-08-29 16:49:08 +0200 | [diff] [blame] | 95 | _PyArg_BadArgument("record", "argument", "str", arg); |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 96 | goto exit; |
| 97 | } |
| 98 | Py_ssize_t script_length; |
| 99 | script = PyUnicode_AsUTF8AndSize(arg, &script_length); |
| 100 | if (script == NULL) { |
| 101 | goto exit; |
| 102 | } |
| 103 | if (strlen(script) != (size_t)script_length) { |
| 104 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 105 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 106 | } |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 107 | return_value = _tkinter_tkapp_record_impl(self, script); |
| 108 | |
| 109 | exit: |
| 110 | return return_value; |
| 111 | } |
| 112 | |
Serhiy Storchaka | 929b40a | 2017-10-03 21:37:22 +0300 | [diff] [blame] | 113 | PyDoc_STRVAR(_tkinter_tkapp_adderrorinfo__doc__, |
| 114 | "adderrorinfo($self, msg, /)\n" |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 115 | "--\n" |
| 116 | "\n"); |
| 117 | |
Serhiy Storchaka | 929b40a | 2017-10-03 21:37:22 +0300 | [diff] [blame] | 118 | #define _TKINTER_TKAPP_ADDERRORINFO_METHODDEF \ |
| 119 | {"adderrorinfo", (PyCFunction)_tkinter_tkapp_adderrorinfo, METH_O, _tkinter_tkapp_adderrorinfo__doc__}, |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 120 | |
| 121 | static PyObject * |
Serhiy Storchaka | 929b40a | 2017-10-03 21:37:22 +0300 | [diff] [blame] | 122 | _tkinter_tkapp_adderrorinfo_impl(TkappObject *self, const char *msg); |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 123 | |
| 124 | static PyObject * |
Serhiy Storchaka | 929b40a | 2017-10-03 21:37:22 +0300 | [diff] [blame] | 125 | _tkinter_tkapp_adderrorinfo(TkappObject *self, PyObject *arg) |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 126 | { |
| 127 | PyObject *return_value = NULL; |
| 128 | const char *msg; |
| 129 | |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 130 | if (!PyUnicode_Check(arg)) { |
Rémi Lapeyre | 4901fe2 | 2019-08-29 16:49:08 +0200 | [diff] [blame] | 131 | _PyArg_BadArgument("adderrorinfo", "argument", "str", arg); |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 132 | goto exit; |
| 133 | } |
| 134 | Py_ssize_t msg_length; |
| 135 | msg = PyUnicode_AsUTF8AndSize(arg, &msg_length); |
| 136 | if (msg == NULL) { |
| 137 | goto exit; |
| 138 | } |
| 139 | if (strlen(msg) != (size_t)msg_length) { |
| 140 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 141 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 142 | } |
Serhiy Storchaka | 929b40a | 2017-10-03 21:37:22 +0300 | [diff] [blame] | 143 | return_value = _tkinter_tkapp_adderrorinfo_impl(self, msg); |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 144 | |
| 145 | exit: |
| 146 | return return_value; |
| 147 | } |
| 148 | |
| 149 | PyDoc_STRVAR(_tkinter_tkapp_getint__doc__, |
| 150 | "getint($self, arg, /)\n" |
| 151 | "--\n" |
| 152 | "\n"); |
| 153 | |
| 154 | #define _TKINTER_TKAPP_GETINT_METHODDEF \ |
| 155 | {"getint", (PyCFunction)_tkinter_tkapp_getint, METH_O, _tkinter_tkapp_getint__doc__}, |
| 156 | |
| 157 | PyDoc_STRVAR(_tkinter_tkapp_getdouble__doc__, |
| 158 | "getdouble($self, arg, /)\n" |
| 159 | "--\n" |
| 160 | "\n"); |
| 161 | |
| 162 | #define _TKINTER_TKAPP_GETDOUBLE_METHODDEF \ |
| 163 | {"getdouble", (PyCFunction)_tkinter_tkapp_getdouble, METH_O, _tkinter_tkapp_getdouble__doc__}, |
| 164 | |
| 165 | PyDoc_STRVAR(_tkinter_tkapp_getboolean__doc__, |
| 166 | "getboolean($self, arg, /)\n" |
| 167 | "--\n" |
| 168 | "\n"); |
| 169 | |
| 170 | #define _TKINTER_TKAPP_GETBOOLEAN_METHODDEF \ |
| 171 | {"getboolean", (PyCFunction)_tkinter_tkapp_getboolean, METH_O, _tkinter_tkapp_getboolean__doc__}, |
| 172 | |
| 173 | PyDoc_STRVAR(_tkinter_tkapp_exprstring__doc__, |
| 174 | "exprstring($self, s, /)\n" |
| 175 | "--\n" |
| 176 | "\n"); |
| 177 | |
| 178 | #define _TKINTER_TKAPP_EXPRSTRING_METHODDEF \ |
| 179 | {"exprstring", (PyCFunction)_tkinter_tkapp_exprstring, METH_O, _tkinter_tkapp_exprstring__doc__}, |
| 180 | |
| 181 | static PyObject * |
| 182 | _tkinter_tkapp_exprstring_impl(TkappObject *self, const char *s); |
| 183 | |
| 184 | static PyObject * |
| 185 | _tkinter_tkapp_exprstring(TkappObject *self, PyObject *arg) |
| 186 | { |
| 187 | PyObject *return_value = NULL; |
| 188 | const char *s; |
| 189 | |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 190 | if (!PyUnicode_Check(arg)) { |
Rémi Lapeyre | 4901fe2 | 2019-08-29 16:49:08 +0200 | [diff] [blame] | 191 | _PyArg_BadArgument("exprstring", "argument", "str", arg); |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 192 | goto exit; |
| 193 | } |
| 194 | Py_ssize_t s_length; |
| 195 | s = PyUnicode_AsUTF8AndSize(arg, &s_length); |
| 196 | if (s == NULL) { |
| 197 | goto exit; |
| 198 | } |
| 199 | if (strlen(s) != (size_t)s_length) { |
| 200 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 201 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 202 | } |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 203 | return_value = _tkinter_tkapp_exprstring_impl(self, s); |
| 204 | |
| 205 | exit: |
| 206 | return return_value; |
| 207 | } |
| 208 | |
| 209 | PyDoc_STRVAR(_tkinter_tkapp_exprlong__doc__, |
| 210 | "exprlong($self, s, /)\n" |
| 211 | "--\n" |
| 212 | "\n"); |
| 213 | |
| 214 | #define _TKINTER_TKAPP_EXPRLONG_METHODDEF \ |
| 215 | {"exprlong", (PyCFunction)_tkinter_tkapp_exprlong, METH_O, _tkinter_tkapp_exprlong__doc__}, |
| 216 | |
| 217 | static PyObject * |
| 218 | _tkinter_tkapp_exprlong_impl(TkappObject *self, const char *s); |
| 219 | |
| 220 | static PyObject * |
| 221 | _tkinter_tkapp_exprlong(TkappObject *self, PyObject *arg) |
| 222 | { |
| 223 | PyObject *return_value = NULL; |
| 224 | const char *s; |
| 225 | |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 226 | if (!PyUnicode_Check(arg)) { |
Rémi Lapeyre | 4901fe2 | 2019-08-29 16:49:08 +0200 | [diff] [blame] | 227 | _PyArg_BadArgument("exprlong", "argument", "str", arg); |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 228 | goto exit; |
| 229 | } |
| 230 | Py_ssize_t s_length; |
| 231 | s = PyUnicode_AsUTF8AndSize(arg, &s_length); |
| 232 | if (s == NULL) { |
| 233 | goto exit; |
| 234 | } |
| 235 | if (strlen(s) != (size_t)s_length) { |
| 236 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 237 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 238 | } |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 239 | return_value = _tkinter_tkapp_exprlong_impl(self, s); |
| 240 | |
| 241 | exit: |
| 242 | return return_value; |
| 243 | } |
| 244 | |
| 245 | PyDoc_STRVAR(_tkinter_tkapp_exprdouble__doc__, |
| 246 | "exprdouble($self, s, /)\n" |
| 247 | "--\n" |
| 248 | "\n"); |
| 249 | |
| 250 | #define _TKINTER_TKAPP_EXPRDOUBLE_METHODDEF \ |
| 251 | {"exprdouble", (PyCFunction)_tkinter_tkapp_exprdouble, METH_O, _tkinter_tkapp_exprdouble__doc__}, |
| 252 | |
| 253 | static PyObject * |
| 254 | _tkinter_tkapp_exprdouble_impl(TkappObject *self, const char *s); |
| 255 | |
| 256 | static PyObject * |
| 257 | _tkinter_tkapp_exprdouble(TkappObject *self, PyObject *arg) |
| 258 | { |
| 259 | PyObject *return_value = NULL; |
| 260 | const char *s; |
| 261 | |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 262 | if (!PyUnicode_Check(arg)) { |
Rémi Lapeyre | 4901fe2 | 2019-08-29 16:49:08 +0200 | [diff] [blame] | 263 | _PyArg_BadArgument("exprdouble", "argument", "str", arg); |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 264 | goto exit; |
| 265 | } |
| 266 | Py_ssize_t s_length; |
| 267 | s = PyUnicode_AsUTF8AndSize(arg, &s_length); |
| 268 | if (s == NULL) { |
| 269 | goto exit; |
| 270 | } |
| 271 | if (strlen(s) != (size_t)s_length) { |
| 272 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 273 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 274 | } |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 275 | return_value = _tkinter_tkapp_exprdouble_impl(self, s); |
| 276 | |
| 277 | exit: |
| 278 | return return_value; |
| 279 | } |
| 280 | |
| 281 | PyDoc_STRVAR(_tkinter_tkapp_exprboolean__doc__, |
| 282 | "exprboolean($self, s, /)\n" |
| 283 | "--\n" |
| 284 | "\n"); |
| 285 | |
| 286 | #define _TKINTER_TKAPP_EXPRBOOLEAN_METHODDEF \ |
| 287 | {"exprboolean", (PyCFunction)_tkinter_tkapp_exprboolean, METH_O, _tkinter_tkapp_exprboolean__doc__}, |
| 288 | |
| 289 | static PyObject * |
| 290 | _tkinter_tkapp_exprboolean_impl(TkappObject *self, const char *s); |
| 291 | |
| 292 | static PyObject * |
| 293 | _tkinter_tkapp_exprboolean(TkappObject *self, PyObject *arg) |
| 294 | { |
| 295 | PyObject *return_value = NULL; |
| 296 | const char *s; |
| 297 | |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 298 | if (!PyUnicode_Check(arg)) { |
Rémi Lapeyre | 4901fe2 | 2019-08-29 16:49:08 +0200 | [diff] [blame] | 299 | _PyArg_BadArgument("exprboolean", "argument", "str", arg); |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 300 | goto exit; |
| 301 | } |
| 302 | Py_ssize_t s_length; |
| 303 | s = PyUnicode_AsUTF8AndSize(arg, &s_length); |
| 304 | if (s == NULL) { |
| 305 | goto exit; |
| 306 | } |
| 307 | if (strlen(s) != (size_t)s_length) { |
| 308 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 309 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 310 | } |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 311 | return_value = _tkinter_tkapp_exprboolean_impl(self, s); |
| 312 | |
| 313 | exit: |
| 314 | return return_value; |
| 315 | } |
| 316 | |
| 317 | PyDoc_STRVAR(_tkinter_tkapp_splitlist__doc__, |
| 318 | "splitlist($self, arg, /)\n" |
| 319 | "--\n" |
| 320 | "\n"); |
| 321 | |
| 322 | #define _TKINTER_TKAPP_SPLITLIST_METHODDEF \ |
| 323 | {"splitlist", (PyCFunction)_tkinter_tkapp_splitlist, METH_O, _tkinter_tkapp_splitlist__doc__}, |
| 324 | |
| 325 | PyDoc_STRVAR(_tkinter_tkapp_split__doc__, |
| 326 | "split($self, arg, /)\n" |
| 327 | "--\n" |
| 328 | "\n"); |
| 329 | |
| 330 | #define _TKINTER_TKAPP_SPLIT_METHODDEF \ |
| 331 | {"split", (PyCFunction)_tkinter_tkapp_split, METH_O, _tkinter_tkapp_split__doc__}, |
| 332 | |
| 333 | PyDoc_STRVAR(_tkinter_tkapp_createcommand__doc__, |
| 334 | "createcommand($self, name, func, /)\n" |
| 335 | "--\n" |
| 336 | "\n"); |
| 337 | |
| 338 | #define _TKINTER_TKAPP_CREATECOMMAND_METHODDEF \ |
Serhiy Storchaka | 4a934d4 | 2018-11-27 11:27:36 +0200 | [diff] [blame] | 339 | {"createcommand", (PyCFunction)(void(*)(void))_tkinter_tkapp_createcommand, METH_FASTCALL, _tkinter_tkapp_createcommand__doc__}, |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 340 | |
| 341 | static PyObject * |
| 342 | _tkinter_tkapp_createcommand_impl(TkappObject *self, const char *name, |
| 343 | PyObject *func); |
| 344 | |
| 345 | static PyObject * |
Serhiy Storchaka | a5552f0 | 2017-12-15 13:11:11 +0200 | [diff] [blame] | 346 | _tkinter_tkapp_createcommand(TkappObject *self, PyObject *const *args, Py_ssize_t nargs) |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 347 | { |
| 348 | PyObject *return_value = NULL; |
| 349 | const char *name; |
| 350 | PyObject *func; |
| 351 | |
Serhiy Storchaka | 4fa9591 | 2019-01-11 16:01:14 +0200 | [diff] [blame] | 352 | if (!_PyArg_CheckPositional("createcommand", nargs, 2, 2)) { |
Victor Stinner | 259f0e4 | 2017-01-17 01:35:17 +0100 | [diff] [blame] | 353 | goto exit; |
| 354 | } |
Serhiy Storchaka | 4fa9591 | 2019-01-11 16:01:14 +0200 | [diff] [blame] | 355 | if (!PyUnicode_Check(args[0])) { |
Rémi Lapeyre | 4901fe2 | 2019-08-29 16:49:08 +0200 | [diff] [blame] | 356 | _PyArg_BadArgument("createcommand", "argument 1", "str", args[0]); |
Serhiy Storchaka | 4fa9591 | 2019-01-11 16:01:14 +0200 | [diff] [blame] | 357 | goto exit; |
| 358 | } |
| 359 | Py_ssize_t name_length; |
| 360 | name = PyUnicode_AsUTF8AndSize(args[0], &name_length); |
| 361 | if (name == NULL) { |
| 362 | goto exit; |
| 363 | } |
| 364 | if (strlen(name) != (size_t)name_length) { |
| 365 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
| 366 | goto exit; |
| 367 | } |
| 368 | func = args[1]; |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 369 | return_value = _tkinter_tkapp_createcommand_impl(self, name, func); |
| 370 | |
| 371 | exit: |
| 372 | return return_value; |
| 373 | } |
| 374 | |
| 375 | PyDoc_STRVAR(_tkinter_tkapp_deletecommand__doc__, |
| 376 | "deletecommand($self, name, /)\n" |
| 377 | "--\n" |
| 378 | "\n"); |
| 379 | |
| 380 | #define _TKINTER_TKAPP_DELETECOMMAND_METHODDEF \ |
| 381 | {"deletecommand", (PyCFunction)_tkinter_tkapp_deletecommand, METH_O, _tkinter_tkapp_deletecommand__doc__}, |
| 382 | |
| 383 | static PyObject * |
| 384 | _tkinter_tkapp_deletecommand_impl(TkappObject *self, const char *name); |
| 385 | |
| 386 | static PyObject * |
| 387 | _tkinter_tkapp_deletecommand(TkappObject *self, PyObject *arg) |
| 388 | { |
| 389 | PyObject *return_value = NULL; |
| 390 | const char *name; |
| 391 | |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 392 | if (!PyUnicode_Check(arg)) { |
Rémi Lapeyre | 4901fe2 | 2019-08-29 16:49:08 +0200 | [diff] [blame] | 393 | _PyArg_BadArgument("deletecommand", "argument", "str", arg); |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 394 | goto exit; |
| 395 | } |
| 396 | Py_ssize_t name_length; |
| 397 | name = PyUnicode_AsUTF8AndSize(arg, &name_length); |
| 398 | if (name == NULL) { |
| 399 | goto exit; |
| 400 | } |
| 401 | if (strlen(name) != (size_t)name_length) { |
| 402 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 403 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 404 | } |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 405 | return_value = _tkinter_tkapp_deletecommand_impl(self, name); |
| 406 | |
| 407 | exit: |
| 408 | return return_value; |
| 409 | } |
| 410 | |
| 411 | #if defined(HAVE_CREATEFILEHANDLER) |
| 412 | |
| 413 | PyDoc_STRVAR(_tkinter_tkapp_createfilehandler__doc__, |
| 414 | "createfilehandler($self, file, mask, func, /)\n" |
| 415 | "--\n" |
| 416 | "\n"); |
| 417 | |
| 418 | #define _TKINTER_TKAPP_CREATEFILEHANDLER_METHODDEF \ |
Serhiy Storchaka | 4a934d4 | 2018-11-27 11:27:36 +0200 | [diff] [blame] | 419 | {"createfilehandler", (PyCFunction)(void(*)(void))_tkinter_tkapp_createfilehandler, METH_FASTCALL, _tkinter_tkapp_createfilehandler__doc__}, |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 420 | |
| 421 | static PyObject * |
| 422 | _tkinter_tkapp_createfilehandler_impl(TkappObject *self, PyObject *file, |
| 423 | int mask, PyObject *func); |
| 424 | |
| 425 | static PyObject * |
Serhiy Storchaka | a5552f0 | 2017-12-15 13:11:11 +0200 | [diff] [blame] | 426 | _tkinter_tkapp_createfilehandler(TkappObject *self, PyObject *const *args, Py_ssize_t nargs) |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 427 | { |
| 428 | PyObject *return_value = NULL; |
| 429 | PyObject *file; |
| 430 | int mask; |
| 431 | PyObject *func; |
| 432 | |
Serhiy Storchaka | 4fa9591 | 2019-01-11 16:01:14 +0200 | [diff] [blame] | 433 | if (!_PyArg_CheckPositional("createfilehandler", nargs, 3, 3)) { |
Victor Stinner | 259f0e4 | 2017-01-17 01:35:17 +0100 | [diff] [blame] | 434 | goto exit; |
| 435 | } |
Serhiy Storchaka | 4fa9591 | 2019-01-11 16:01:14 +0200 | [diff] [blame] | 436 | file = args[0]; |
| 437 | if (PyFloat_Check(args[1])) { |
| 438 | PyErr_SetString(PyExc_TypeError, |
| 439 | "integer argument expected, got float" ); |
| 440 | goto exit; |
| 441 | } |
| 442 | mask = _PyLong_AsInt(args[1]); |
| 443 | if (mask == -1 && PyErr_Occurred()) { |
| 444 | goto exit; |
| 445 | } |
| 446 | func = args[2]; |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 447 | return_value = _tkinter_tkapp_createfilehandler_impl(self, file, mask, func); |
| 448 | |
| 449 | exit: |
| 450 | return return_value; |
| 451 | } |
| 452 | |
| 453 | #endif /* defined(HAVE_CREATEFILEHANDLER) */ |
| 454 | |
| 455 | #if defined(HAVE_CREATEFILEHANDLER) |
| 456 | |
| 457 | PyDoc_STRVAR(_tkinter_tkapp_deletefilehandler__doc__, |
| 458 | "deletefilehandler($self, file, /)\n" |
| 459 | "--\n" |
| 460 | "\n"); |
| 461 | |
| 462 | #define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF \ |
| 463 | {"deletefilehandler", (PyCFunction)_tkinter_tkapp_deletefilehandler, METH_O, _tkinter_tkapp_deletefilehandler__doc__}, |
| 464 | |
| 465 | #endif /* defined(HAVE_CREATEFILEHANDLER) */ |
| 466 | |
| 467 | PyDoc_STRVAR(_tkinter_tktimertoken_deletetimerhandler__doc__, |
| 468 | "deletetimerhandler($self, /)\n" |
| 469 | "--\n" |
| 470 | "\n"); |
| 471 | |
| 472 | #define _TKINTER_TKTIMERTOKEN_DELETETIMERHANDLER_METHODDEF \ |
| 473 | {"deletetimerhandler", (PyCFunction)_tkinter_tktimertoken_deletetimerhandler, METH_NOARGS, _tkinter_tktimertoken_deletetimerhandler__doc__}, |
| 474 | |
| 475 | static PyObject * |
| 476 | _tkinter_tktimertoken_deletetimerhandler_impl(TkttObject *self); |
| 477 | |
| 478 | static PyObject * |
| 479 | _tkinter_tktimertoken_deletetimerhandler(TkttObject *self, PyObject *Py_UNUSED(ignored)) |
| 480 | { |
| 481 | return _tkinter_tktimertoken_deletetimerhandler_impl(self); |
| 482 | } |
| 483 | |
| 484 | PyDoc_STRVAR(_tkinter_tkapp_createtimerhandler__doc__, |
| 485 | "createtimerhandler($self, milliseconds, func, /)\n" |
| 486 | "--\n" |
| 487 | "\n"); |
| 488 | |
| 489 | #define _TKINTER_TKAPP_CREATETIMERHANDLER_METHODDEF \ |
Serhiy Storchaka | 4a934d4 | 2018-11-27 11:27:36 +0200 | [diff] [blame] | 490 | {"createtimerhandler", (PyCFunction)(void(*)(void))_tkinter_tkapp_createtimerhandler, METH_FASTCALL, _tkinter_tkapp_createtimerhandler__doc__}, |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 491 | |
| 492 | static PyObject * |
| 493 | _tkinter_tkapp_createtimerhandler_impl(TkappObject *self, int milliseconds, |
| 494 | PyObject *func); |
| 495 | |
| 496 | static PyObject * |
Serhiy Storchaka | a5552f0 | 2017-12-15 13:11:11 +0200 | [diff] [blame] | 497 | _tkinter_tkapp_createtimerhandler(TkappObject *self, PyObject *const *args, Py_ssize_t nargs) |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 498 | { |
| 499 | PyObject *return_value = NULL; |
| 500 | int milliseconds; |
| 501 | PyObject *func; |
| 502 | |
Serhiy Storchaka | 4fa9591 | 2019-01-11 16:01:14 +0200 | [diff] [blame] | 503 | if (!_PyArg_CheckPositional("createtimerhandler", nargs, 2, 2)) { |
Victor Stinner | 259f0e4 | 2017-01-17 01:35:17 +0100 | [diff] [blame] | 504 | goto exit; |
| 505 | } |
Serhiy Storchaka | 4fa9591 | 2019-01-11 16:01:14 +0200 | [diff] [blame] | 506 | if (PyFloat_Check(args[0])) { |
| 507 | PyErr_SetString(PyExc_TypeError, |
| 508 | "integer argument expected, got float" ); |
| 509 | goto exit; |
| 510 | } |
| 511 | milliseconds = _PyLong_AsInt(args[0]); |
| 512 | if (milliseconds == -1 && PyErr_Occurred()) { |
| 513 | goto exit; |
| 514 | } |
| 515 | func = args[1]; |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 516 | return_value = _tkinter_tkapp_createtimerhandler_impl(self, milliseconds, func); |
| 517 | |
| 518 | exit: |
| 519 | return return_value; |
| 520 | } |
| 521 | |
| 522 | PyDoc_STRVAR(_tkinter_tkapp_mainloop__doc__, |
| 523 | "mainloop($self, threshold=0, /)\n" |
| 524 | "--\n" |
| 525 | "\n"); |
| 526 | |
| 527 | #define _TKINTER_TKAPP_MAINLOOP_METHODDEF \ |
Serhiy Storchaka | 4a934d4 | 2018-11-27 11:27:36 +0200 | [diff] [blame] | 528 | {"mainloop", (PyCFunction)(void(*)(void))_tkinter_tkapp_mainloop, METH_FASTCALL, _tkinter_tkapp_mainloop__doc__}, |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 529 | |
| 530 | static PyObject * |
| 531 | _tkinter_tkapp_mainloop_impl(TkappObject *self, int threshold); |
| 532 | |
| 533 | static PyObject * |
Serhiy Storchaka | a5552f0 | 2017-12-15 13:11:11 +0200 | [diff] [blame] | 534 | _tkinter_tkapp_mainloop(TkappObject *self, PyObject *const *args, Py_ssize_t nargs) |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 535 | { |
| 536 | PyObject *return_value = NULL; |
| 537 | int threshold = 0; |
| 538 | |
Serhiy Storchaka | 4fa9591 | 2019-01-11 16:01:14 +0200 | [diff] [blame] | 539 | if (!_PyArg_CheckPositional("mainloop", nargs, 0, 1)) { |
Victor Stinner | 259f0e4 | 2017-01-17 01:35:17 +0100 | [diff] [blame] | 540 | goto exit; |
| 541 | } |
Serhiy Storchaka | 4fa9591 | 2019-01-11 16:01:14 +0200 | [diff] [blame] | 542 | if (nargs < 1) { |
| 543 | goto skip_optional; |
| 544 | } |
| 545 | if (PyFloat_Check(args[0])) { |
| 546 | PyErr_SetString(PyExc_TypeError, |
| 547 | "integer argument expected, got float" ); |
| 548 | goto exit; |
| 549 | } |
| 550 | threshold = _PyLong_AsInt(args[0]); |
| 551 | if (threshold == -1 && PyErr_Occurred()) { |
| 552 | goto exit; |
| 553 | } |
| 554 | skip_optional: |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 555 | return_value = _tkinter_tkapp_mainloop_impl(self, threshold); |
| 556 | |
| 557 | exit: |
| 558 | return return_value; |
| 559 | } |
| 560 | |
| 561 | PyDoc_STRVAR(_tkinter_tkapp_dooneevent__doc__, |
| 562 | "dooneevent($self, flags=0, /)\n" |
| 563 | "--\n" |
| 564 | "\n"); |
| 565 | |
| 566 | #define _TKINTER_TKAPP_DOONEEVENT_METHODDEF \ |
Serhiy Storchaka | 4a934d4 | 2018-11-27 11:27:36 +0200 | [diff] [blame] | 567 | {"dooneevent", (PyCFunction)(void(*)(void))_tkinter_tkapp_dooneevent, METH_FASTCALL, _tkinter_tkapp_dooneevent__doc__}, |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 568 | |
| 569 | static PyObject * |
| 570 | _tkinter_tkapp_dooneevent_impl(TkappObject *self, int flags); |
| 571 | |
| 572 | static PyObject * |
Serhiy Storchaka | a5552f0 | 2017-12-15 13:11:11 +0200 | [diff] [blame] | 573 | _tkinter_tkapp_dooneevent(TkappObject *self, PyObject *const *args, Py_ssize_t nargs) |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 574 | { |
| 575 | PyObject *return_value = NULL; |
| 576 | int flags = 0; |
| 577 | |
Serhiy Storchaka | 4fa9591 | 2019-01-11 16:01:14 +0200 | [diff] [blame] | 578 | if (!_PyArg_CheckPositional("dooneevent", nargs, 0, 1)) { |
Victor Stinner | 259f0e4 | 2017-01-17 01:35:17 +0100 | [diff] [blame] | 579 | goto exit; |
| 580 | } |
Serhiy Storchaka | 4fa9591 | 2019-01-11 16:01:14 +0200 | [diff] [blame] | 581 | if (nargs < 1) { |
| 582 | goto skip_optional; |
| 583 | } |
| 584 | if (PyFloat_Check(args[0])) { |
| 585 | PyErr_SetString(PyExc_TypeError, |
| 586 | "integer argument expected, got float" ); |
| 587 | goto exit; |
| 588 | } |
| 589 | flags = _PyLong_AsInt(args[0]); |
| 590 | if (flags == -1 && PyErr_Occurred()) { |
| 591 | goto exit; |
| 592 | } |
| 593 | skip_optional: |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 594 | return_value = _tkinter_tkapp_dooneevent_impl(self, flags); |
| 595 | |
| 596 | exit: |
| 597 | return return_value; |
| 598 | } |
| 599 | |
| 600 | PyDoc_STRVAR(_tkinter_tkapp_quit__doc__, |
| 601 | "quit($self, /)\n" |
| 602 | "--\n" |
| 603 | "\n"); |
| 604 | |
| 605 | #define _TKINTER_TKAPP_QUIT_METHODDEF \ |
| 606 | {"quit", (PyCFunction)_tkinter_tkapp_quit, METH_NOARGS, _tkinter_tkapp_quit__doc__}, |
| 607 | |
| 608 | static PyObject * |
| 609 | _tkinter_tkapp_quit_impl(TkappObject *self); |
| 610 | |
| 611 | static PyObject * |
| 612 | _tkinter_tkapp_quit(TkappObject *self, PyObject *Py_UNUSED(ignored)) |
| 613 | { |
| 614 | return _tkinter_tkapp_quit_impl(self); |
| 615 | } |
| 616 | |
| 617 | PyDoc_STRVAR(_tkinter_tkapp_interpaddr__doc__, |
| 618 | "interpaddr($self, /)\n" |
| 619 | "--\n" |
| 620 | "\n"); |
| 621 | |
| 622 | #define _TKINTER_TKAPP_INTERPADDR_METHODDEF \ |
| 623 | {"interpaddr", (PyCFunction)_tkinter_tkapp_interpaddr, METH_NOARGS, _tkinter_tkapp_interpaddr__doc__}, |
| 624 | |
| 625 | static PyObject * |
| 626 | _tkinter_tkapp_interpaddr_impl(TkappObject *self); |
| 627 | |
| 628 | static PyObject * |
| 629 | _tkinter_tkapp_interpaddr(TkappObject *self, PyObject *Py_UNUSED(ignored)) |
| 630 | { |
| 631 | return _tkinter_tkapp_interpaddr_impl(self); |
| 632 | } |
| 633 | |
| 634 | PyDoc_STRVAR(_tkinter_tkapp_loadtk__doc__, |
| 635 | "loadtk($self, /)\n" |
| 636 | "--\n" |
| 637 | "\n"); |
| 638 | |
| 639 | #define _TKINTER_TKAPP_LOADTK_METHODDEF \ |
| 640 | {"loadtk", (PyCFunction)_tkinter_tkapp_loadtk, METH_NOARGS, _tkinter_tkapp_loadtk__doc__}, |
| 641 | |
| 642 | static PyObject * |
| 643 | _tkinter_tkapp_loadtk_impl(TkappObject *self); |
| 644 | |
| 645 | static PyObject * |
| 646 | _tkinter_tkapp_loadtk(TkappObject *self, PyObject *Py_UNUSED(ignored)) |
| 647 | { |
| 648 | return _tkinter_tkapp_loadtk_impl(self); |
| 649 | } |
| 650 | |
| 651 | PyDoc_STRVAR(_tkinter_tkapp_willdispatch__doc__, |
| 652 | "willdispatch($self, /)\n" |
| 653 | "--\n" |
| 654 | "\n"); |
| 655 | |
| 656 | #define _TKINTER_TKAPP_WILLDISPATCH_METHODDEF \ |
| 657 | {"willdispatch", (PyCFunction)_tkinter_tkapp_willdispatch, METH_NOARGS, _tkinter_tkapp_willdispatch__doc__}, |
| 658 | |
| 659 | static PyObject * |
| 660 | _tkinter_tkapp_willdispatch_impl(TkappObject *self); |
| 661 | |
| 662 | static PyObject * |
| 663 | _tkinter_tkapp_willdispatch(TkappObject *self, PyObject *Py_UNUSED(ignored)) |
| 664 | { |
| 665 | return _tkinter_tkapp_willdispatch_impl(self); |
| 666 | } |
| 667 | |
| 668 | PyDoc_STRVAR(_tkinter__flatten__doc__, |
| 669 | "_flatten($module, item, /)\n" |
| 670 | "--\n" |
| 671 | "\n"); |
| 672 | |
| 673 | #define _TKINTER__FLATTEN_METHODDEF \ |
| 674 | {"_flatten", (PyCFunction)_tkinter__flatten, METH_O, _tkinter__flatten__doc__}, |
| 675 | |
| 676 | PyDoc_STRVAR(_tkinter_create__doc__, |
Serhiy Storchaka | 279f446 | 2019-09-14 12:24:05 +0300 | [diff] [blame] | 677 | "create($module, screenName=None, baseName=\'\', className=\'Tk\',\n" |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 678 | " interactive=False, wantobjects=False, wantTk=True, sync=False,\n" |
| 679 | " use=None, /)\n" |
| 680 | "--\n" |
| 681 | "\n" |
| 682 | "\n" |
| 683 | "\n" |
| 684 | " wantTk\n" |
| 685 | " if false, then Tk_Init() doesn\'t get called\n" |
| 686 | " sync\n" |
| 687 | " if true, then pass -sync to wish\n" |
| 688 | " use\n" |
| 689 | " if not None, then pass -use to wish"); |
| 690 | |
| 691 | #define _TKINTER_CREATE_METHODDEF \ |
Serhiy Storchaka | 4a934d4 | 2018-11-27 11:27:36 +0200 | [diff] [blame] | 692 | {"create", (PyCFunction)(void(*)(void))_tkinter_create, METH_FASTCALL, _tkinter_create__doc__}, |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 693 | |
| 694 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 695 | _tkinter_create_impl(PyObject *module, const char *screenName, |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 696 | const char *baseName, const char *className, |
| 697 | int interactive, int wantobjects, int wantTk, int sync, |
| 698 | const char *use); |
| 699 | |
| 700 | static PyObject * |
Serhiy Storchaka | a5552f0 | 2017-12-15 13:11:11 +0200 | [diff] [blame] | 701 | _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 702 | { |
| 703 | PyObject *return_value = NULL; |
| 704 | const char *screenName = NULL; |
Serhiy Storchaka | 279f446 | 2019-09-14 12:24:05 +0300 | [diff] [blame] | 705 | const char *baseName = ""; |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 706 | const char *className = "Tk"; |
| 707 | int interactive = 0; |
| 708 | int wantobjects = 0; |
| 709 | int wantTk = 1; |
| 710 | int sync = 0; |
| 711 | const char *use = NULL; |
| 712 | |
Serhiy Storchaka | 4fa9591 | 2019-01-11 16:01:14 +0200 | [diff] [blame] | 713 | if (!_PyArg_CheckPositional("create", nargs, 0, 8)) { |
Victor Stinner | 259f0e4 | 2017-01-17 01:35:17 +0100 | [diff] [blame] | 714 | goto exit; |
| 715 | } |
Serhiy Storchaka | 4fa9591 | 2019-01-11 16:01:14 +0200 | [diff] [blame] | 716 | if (nargs < 1) { |
| 717 | goto skip_optional; |
| 718 | } |
| 719 | if (args[0] == Py_None) { |
| 720 | screenName = NULL; |
| 721 | } |
| 722 | else if (PyUnicode_Check(args[0])) { |
| 723 | Py_ssize_t screenName_length; |
| 724 | screenName = PyUnicode_AsUTF8AndSize(args[0], &screenName_length); |
| 725 | if (screenName == NULL) { |
| 726 | goto exit; |
| 727 | } |
| 728 | if (strlen(screenName) != (size_t)screenName_length) { |
| 729 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
| 730 | goto exit; |
| 731 | } |
| 732 | } |
| 733 | else { |
Rémi Lapeyre | 4901fe2 | 2019-08-29 16:49:08 +0200 | [diff] [blame] | 734 | _PyArg_BadArgument("create", "argument 1", "str or None", args[0]); |
Serhiy Storchaka | 4fa9591 | 2019-01-11 16:01:14 +0200 | [diff] [blame] | 735 | goto exit; |
| 736 | } |
| 737 | if (nargs < 2) { |
| 738 | goto skip_optional; |
| 739 | } |
| 740 | if (!PyUnicode_Check(args[1])) { |
Rémi Lapeyre | 4901fe2 | 2019-08-29 16:49:08 +0200 | [diff] [blame] | 741 | _PyArg_BadArgument("create", "argument 2", "str", args[1]); |
Serhiy Storchaka | 4fa9591 | 2019-01-11 16:01:14 +0200 | [diff] [blame] | 742 | goto exit; |
| 743 | } |
| 744 | Py_ssize_t baseName_length; |
| 745 | baseName = PyUnicode_AsUTF8AndSize(args[1], &baseName_length); |
| 746 | if (baseName == NULL) { |
| 747 | goto exit; |
| 748 | } |
| 749 | if (strlen(baseName) != (size_t)baseName_length) { |
| 750 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
| 751 | goto exit; |
| 752 | } |
| 753 | if (nargs < 3) { |
| 754 | goto skip_optional; |
| 755 | } |
| 756 | if (!PyUnicode_Check(args[2])) { |
Rémi Lapeyre | 4901fe2 | 2019-08-29 16:49:08 +0200 | [diff] [blame] | 757 | _PyArg_BadArgument("create", "argument 3", "str", args[2]); |
Serhiy Storchaka | 4fa9591 | 2019-01-11 16:01:14 +0200 | [diff] [blame] | 758 | goto exit; |
| 759 | } |
| 760 | Py_ssize_t className_length; |
| 761 | className = PyUnicode_AsUTF8AndSize(args[2], &className_length); |
| 762 | if (className == NULL) { |
| 763 | goto exit; |
| 764 | } |
| 765 | if (strlen(className) != (size_t)className_length) { |
| 766 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
| 767 | goto exit; |
| 768 | } |
| 769 | if (nargs < 4) { |
| 770 | goto skip_optional; |
| 771 | } |
| 772 | if (PyFloat_Check(args[3])) { |
| 773 | PyErr_SetString(PyExc_TypeError, |
| 774 | "integer argument expected, got float" ); |
| 775 | goto exit; |
| 776 | } |
| 777 | interactive = _PyLong_AsInt(args[3]); |
| 778 | if (interactive == -1 && PyErr_Occurred()) { |
| 779 | goto exit; |
| 780 | } |
| 781 | if (nargs < 5) { |
| 782 | goto skip_optional; |
| 783 | } |
| 784 | if (PyFloat_Check(args[4])) { |
| 785 | PyErr_SetString(PyExc_TypeError, |
| 786 | "integer argument expected, got float" ); |
| 787 | goto exit; |
| 788 | } |
| 789 | wantobjects = _PyLong_AsInt(args[4]); |
| 790 | if (wantobjects == -1 && PyErr_Occurred()) { |
| 791 | goto exit; |
| 792 | } |
| 793 | if (nargs < 6) { |
| 794 | goto skip_optional; |
| 795 | } |
| 796 | if (PyFloat_Check(args[5])) { |
| 797 | PyErr_SetString(PyExc_TypeError, |
| 798 | "integer argument expected, got float" ); |
| 799 | goto exit; |
| 800 | } |
| 801 | wantTk = _PyLong_AsInt(args[5]); |
| 802 | if (wantTk == -1 && PyErr_Occurred()) { |
| 803 | goto exit; |
| 804 | } |
| 805 | if (nargs < 7) { |
| 806 | goto skip_optional; |
| 807 | } |
| 808 | if (PyFloat_Check(args[6])) { |
| 809 | PyErr_SetString(PyExc_TypeError, |
| 810 | "integer argument expected, got float" ); |
| 811 | goto exit; |
| 812 | } |
| 813 | sync = _PyLong_AsInt(args[6]); |
| 814 | if (sync == -1 && PyErr_Occurred()) { |
| 815 | goto exit; |
| 816 | } |
| 817 | if (nargs < 8) { |
| 818 | goto skip_optional; |
| 819 | } |
| 820 | if (args[7] == Py_None) { |
| 821 | use = NULL; |
| 822 | } |
| 823 | else if (PyUnicode_Check(args[7])) { |
| 824 | Py_ssize_t use_length; |
| 825 | use = PyUnicode_AsUTF8AndSize(args[7], &use_length); |
| 826 | if (use == NULL) { |
| 827 | goto exit; |
| 828 | } |
| 829 | if (strlen(use) != (size_t)use_length) { |
| 830 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
| 831 | goto exit; |
| 832 | } |
| 833 | } |
| 834 | else { |
Rémi Lapeyre | 4901fe2 | 2019-08-29 16:49:08 +0200 | [diff] [blame] | 835 | _PyArg_BadArgument("create", "argument 8", "str or None", args[7]); |
Serhiy Storchaka | 4fa9591 | 2019-01-11 16:01:14 +0200 | [diff] [blame] | 836 | goto exit; |
| 837 | } |
| 838 | skip_optional: |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 839 | return_value = _tkinter_create_impl(module, screenName, baseName, className, interactive, wantobjects, wantTk, sync, use); |
| 840 | |
| 841 | exit: |
| 842 | return return_value; |
| 843 | } |
| 844 | |
| 845 | PyDoc_STRVAR(_tkinter_setbusywaitinterval__doc__, |
| 846 | "setbusywaitinterval($module, new_val, /)\n" |
| 847 | "--\n" |
| 848 | "\n" |
| 849 | "Set the busy-wait interval in milliseconds between successive calls to Tcl_DoOneEvent in a threaded Python interpreter.\n" |
| 850 | "\n" |
| 851 | "It should be set to a divisor of the maximum time between frames in an animation."); |
| 852 | |
| 853 | #define _TKINTER_SETBUSYWAITINTERVAL_METHODDEF \ |
| 854 | {"setbusywaitinterval", (PyCFunction)_tkinter_setbusywaitinterval, METH_O, _tkinter_setbusywaitinterval__doc__}, |
| 855 | |
| 856 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 857 | _tkinter_setbusywaitinterval_impl(PyObject *module, int new_val); |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 858 | |
| 859 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 860 | _tkinter_setbusywaitinterval(PyObject *module, PyObject *arg) |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 861 | { |
| 862 | PyObject *return_value = NULL; |
| 863 | int new_val; |
| 864 | |
Serhiy Storchaka | 32d96a2 | 2018-12-25 13:23:47 +0200 | [diff] [blame] | 865 | if (PyFloat_Check(arg)) { |
| 866 | PyErr_SetString(PyExc_TypeError, |
| 867 | "integer argument expected, got float" ); |
| 868 | goto exit; |
| 869 | } |
| 870 | new_val = _PyLong_AsInt(arg); |
| 871 | if (new_val == -1 && PyErr_Occurred()) { |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 872 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 873 | } |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 874 | return_value = _tkinter_setbusywaitinterval_impl(module, new_val); |
| 875 | |
| 876 | exit: |
| 877 | return return_value; |
| 878 | } |
| 879 | |
| 880 | PyDoc_STRVAR(_tkinter_getbusywaitinterval__doc__, |
| 881 | "getbusywaitinterval($module, /)\n" |
| 882 | "--\n" |
| 883 | "\n" |
| 884 | "Return the current busy-wait interval between successive calls to Tcl_DoOneEvent in a threaded Python interpreter."); |
| 885 | |
| 886 | #define _TKINTER_GETBUSYWAITINTERVAL_METHODDEF \ |
| 887 | {"getbusywaitinterval", (PyCFunction)_tkinter_getbusywaitinterval, METH_NOARGS, _tkinter_getbusywaitinterval__doc__}, |
| 888 | |
| 889 | static int |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 890 | _tkinter_getbusywaitinterval_impl(PyObject *module); |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 891 | |
| 892 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 893 | _tkinter_getbusywaitinterval(PyObject *module, PyObject *Py_UNUSED(ignored)) |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 894 | { |
| 895 | PyObject *return_value = NULL; |
| 896 | int _return_value; |
| 897 | |
| 898 | _return_value = _tkinter_getbusywaitinterval_impl(module); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 899 | if ((_return_value == -1) && PyErr_Occurred()) { |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 900 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 901 | } |
Serhiy Storchaka | 5abdf484 | 2015-05-03 15:49:47 +0300 | [diff] [blame] | 902 | return_value = PyLong_FromLong((long)_return_value); |
| 903 | |
| 904 | exit: |
| 905 | return return_value; |
| 906 | } |
| 907 | |
| 908 | #ifndef _TKINTER_TKAPP_CREATEFILEHANDLER_METHODDEF |
| 909 | #define _TKINTER_TKAPP_CREATEFILEHANDLER_METHODDEF |
| 910 | #endif /* !defined(_TKINTER_TKAPP_CREATEFILEHANDLER_METHODDEF) */ |
| 911 | |
| 912 | #ifndef _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF |
| 913 | #define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF |
| 914 | #endif /* !defined(_TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF) */ |
Serhiy Storchaka | 279f446 | 2019-09-14 12:24:05 +0300 | [diff] [blame] | 915 | /*[clinic end generated code: output=492b8b833fe54bc9 input=a9049054013a1b77]*/ |