| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b8d3e40 commit 696c8af
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -462,7 +462,7 @@ Split(const char *list) | |||
| 462 | 462 | v = NULL; | |
| 463 | 463 | break; | |
| 464 | 464 | } | |
| 465 | - PyTuple_SetItem(v, i, w); | ||
| 465 | + PyTuple_SET_ITEM(v, i, w); | ||
| 466 | 466 | } | |
| 467 | 467 | } | |
| 468 | 468 | Tcl_Free(FREECAST argv); | |
@@ -480,13 +480,13 @@ SplitObj(PyObject *arg) | |||
| 480 | 480 | Py_ssize_t i, size; | |
| 481 | 481 | PyObject *elem, *newelem, *result; | |
| 482 | 482 | ||
| 483 | - size = PyTuple_Size(arg); | ||
| 483 | + size = PyTuple_GET_SIZE(arg); | ||
| 484 | 484 | result = NULL; | |
| 485 | 485 | /* Recursively invoke SplitObj for all tuple items. | |
| 486 | 486 | If this does not return a new object, no action is | |
| 487 | 487 | needed. */ | |
| 488 | 488 | for(i = 0; i < size; i++) { | |
| 489 | - elem = PyTuple_GetItem(arg, i); | ||
| 489 | + elem = PyTuple_GET_ITEM(arg, i); | ||
| 490 | 490 | newelem = SplitObj(elem); | |
| 491 | 491 | if (!newelem) { | |
| 492 | 492 | Py_XDECREF(result); | |
@@ -502,12 +502,12 @@ SplitObj(PyObject *arg) | |||
| 502 | 502 | if (!result) | |
| 503 | 503 | return NULL; | |
| 504 | 504 | for(k = 0; k < i; k++) { | |
| 505 | - elem = PyTuple_GetItem(arg, k); | ||
| 505 | + elem = PyTuple_GET_ITEM(arg, k); | ||
| 506 | 506 | Py_INCREF(elem); | |
| 507 | - PyTuple_SetItem(result, k, elem); | ||
| 507 | + PyTuple_SET_ITEM(result, k, elem); | ||
| 508 | 508 | } | |
| 509 | 509 | } | |
| 510 | - PyTuple_SetItem(result, i, newelem); | ||
| 510 | + PyTuple_SET_ITEM(result, i, newelem); | ||
| 511 | 511 | } | |
| 512 | 512 | if (result) | |
| 513 | 513 | return result; | |
@@ -529,7 +529,7 @@ SplitObj(PyObject *arg) | |||
| 529 | 529 | Py_XDECREF(result); | |
| 530 | 530 | return NULL; | |
| 531 | 531 | } | |
| 532 | - PyTuple_SetItem(result, i, newelem); | ||
| 532 | + PyTuple_SET_ITEM(result, i, newelem); | ||
| 533 | 533 | } | |
| 534 | 534 | return result; | |
| 535 | 535 | } | |
@@ -551,15 +551,15 @@ SplitObj(PyObject *arg) | |||
| 551 | 551 | else if (PyBytes_Check(arg)) { | |
| 552 | 552 | int argc; | |
| 553 | 553 | const char **argv; | |
| 554 | - char *list = PyBytes_AsString(arg); | ||
| 554 | + char *list = PyBytes_AS_STRING(arg); | ||
| 555 | 555 | ||
| 556 | 556 | if (Tcl_SplitList((Tcl_Interp *)NULL, list, &argc, &argv) != TCL_OK) { | |
| 557 | 557 | Py_INCREF(arg); | |
| 558 | 558 | return arg; | |
| 559 | 559 | } | |
| 560 | 560 | Tcl_Free(FREECAST argv); | |
| 561 | 561 | if (argc > 1) | |
| 562 | - return Split(PyBytes_AsString(arg)); | ||
| 562 | + return Split(PyBytes_AS_STRING(arg)); | ||
| 563 | 563 | /* Fall through, returning arg. */ | |
| 564 | 564 | } | |
| 565 | 565 | Py_INCREF(arg); | |
@@ -758,7 +758,7 @@ Tkapp_New(const char *screenName, const char *className, | |||
| 758 | 758 | } | |
| 759 | 759 | Tcl_SetVar(v->interp, | |
| 760 | 760 | "tcl_library", | |
| 761 | - PyBytes_AsString(utf8_path), | ||
| 761 | + PyBytes_AS_STRING(utf8_path), | ||
| 762 | 762 | TCL_GLOBAL_ONLY); | |
| 763 | 763 | Py_DECREF(utf8_path); | |
| 764 | 764 | } | |
@@ -1306,7 +1306,7 @@ FromObj(PyObject* tkapp, Tcl_Obj *value) | |||
| 1306 | 1306 | Py_DECREF(result); | |
| 1307 | 1307 | return NULL; | |
| 1308 | 1308 | } | |
| 1309 | - PyTuple_SetItem(result, i, elem); | ||
| 1309 | + PyTuple_SET_ITEM(result, i, elem); | ||
| 1310 | 1310 | } | |
| 1311 | 1311 | return result; | |
| 1312 | 1312 | } | |
@@ -1517,8 +1517,8 @@ Tkapp_Call(PyObject *selfptr, PyObject *args) | |||
| 1517 | 1517 | int flags = TCL_EVAL_DIRECT | TCL_EVAL_GLOBAL; | |
| 1518 | 1518 | ||
| 1519 | 1519 | /* If args is a single tuple, replace with contents of tuple */ | |
| 1520 | - if (1 == PyTuple_Size(args)){ | ||
| 1521 | - PyObject* item = PyTuple_GetItem(args, 0); | ||
| 1520 | + if (PyTuple_GET_SIZE(args) == 1) { | ||
| 1521 | + PyObject *item = PyTuple_GET_ITEM(args, 0); | ||
| 1522 | 1522 | if (PyTuple_Check(item)) | |
| 1523 | 1523 | args = item; | |
| 1524 | 1524 | } | |
@@ -1728,12 +1728,12 @@ varname_converter(PyObject *in, void *_out) | |||
| 1728 | 1728 | char *s; | |
| 1729 | 1729 | const char **out = (const char**)_out; | |
| 1730 | 1730 | if (PyBytes_Check(in)) { | |
| 1731 | - if (PyBytes_Size(in) > INT_MAX) { | ||
| 1731 | + if (PyBytes_GET_SIZE(in) > INT_MAX) { | ||
| 1732 | 1732 | PyErr_SetString(PyExc_OverflowError, "bytes object is too long"); | |
| 1733 | 1733 | return 0; | |
| 1734 | 1734 | } | |
| 1735 | - s = PyBytes_AsString(in); | ||
| 1736 | - if (strlen(s) != (size_t)PyBytes_Size(in)) { | ||
| 1735 | + s = PyBytes_AS_STRING(in); | ||
| 1736 | + if (strlen(s) != (size_t)PyBytes_GET_SIZE(in)) { | ||
| 1737 | 1737 | PyErr_SetString(PyExc_ValueError, "embedded null byte"); | |
| 1738 | 1738 | return 0; | |
| 1739 | 1739 | } | |
@@ -2274,10 +2274,11 @@ _tkinter_tkapp_splitlist(TkappObject *self, PyObject *arg) | |||
| 2274 | 2274 | return NULL; | |
| 2275 | 2275 | for (i = 0; i < objc; i++) { | |
| 2276 | 2276 | PyObject *s = FromObj((PyObject*)self, objv[i]); | |
| 2277 | - if (!s || PyTuple_SetItem(v, i, s)) { | ||
| 2277 | + if (!s) { | ||
| 2278 | 2278 | Py_DECREF(v); | |
| 2279 | 2279 | return NULL; | |
| 2280 | 2280 | } | |
| 2281 | + PyTuple_SET_ITEM(v, i, s); | ||
| 2281 | 2282 | } | |
| 2282 | 2283 | return v; | |
| 2283 | 2284 | } | |
@@ -2304,11 +2305,12 @@ _tkinter_tkapp_splitlist(TkappObject *self, PyObject *arg) | |||
| 2304 | 2305 | ||
| 2305 | 2306 | for (i = 0; i < argc; i++) { | |
| 2306 | 2307 | PyObject *s = unicodeFromTclString(argv[i]); | |
| 2307 | - if (!s || PyTuple_SetItem(v, i, s)) { | ||
| 2308 | + if (!s) { | ||
| 2308 | 2309 | Py_DECREF(v); | |
| 2309 | 2310 | v = NULL; | |
| 2310 | 2311 | goto finally; | |
| 2311 | 2312 | } | |
| 2313 | + PyTuple_SET_ITEM(v, i, s); | ||
| 2312 | 2314 | } | |
| 2313 | 2315 | ||
| 2314 | 2316 | finally: | |
@@ -2349,10 +2351,11 @@ _tkinter_tkapp_split(TkappObject *self, PyObject *arg) | |||
| 2349 | 2351 | return NULL; | |
| 2350 | 2352 | for (i = 0; i < objc; i++) { | |
| 2351 | 2353 | PyObject *s = FromObj((PyObject*)self, objv[i]); | |
| 2352 | - if (!s || PyTuple_SetItem(v, i, s)) { | ||
| 2354 | + if (!s) { | ||
| 2353 | 2355 | Py_DECREF(v); | |
| 2354 | 2356 | return NULL; | |
| 2355 | 2357 | } | |
| 2358 | + PyTuple_SET_ITEM(v, i, s); | ||
| 2356 | 2359 | } | |
| 2357 | 2360 | return v; | |
| 2358 | 2361 | } | |
@@ -2410,10 +2413,11 @@ PythonCmd(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[ | |||
| 2410 | 2413 | ||
| 2411 | 2414 | for (i = 0; i < (argc - 1); i++) { | |
| 2412 | 2415 | PyObject *s = unicodeFromTclString(argv[i + 1]); | |
| 2413 | - if (!s || PyTuple_SetItem(arg, i, s)) { | ||
| 2416 | + if (!s) { | ||
| 2414 | 2417 | Py_DECREF(arg); | |
| 2415 | 2418 | return PythonCmd_Error(interp); | |
| 2416 | 2419 | } | |
| 2420 | + PyTuple_SET_ITEM(arg, i, s); | ||
| 2417 | 2421 | } | |
| 2418 | 2422 | res = PyEval_CallObject(func, arg); | |
| 2419 | 2423 | Py_DECREF(arg); | |
@@ -3622,14 +3626,14 @@ PyInit__tkinter(void) | |||
| 3622 | 3626 | } | |
| 3623 | 3627 | } | |
| 3624 | 3628 | ||
| 3625 | - Tcl_FindExecutable(PyBytes_AsString(cexe)); | ||
| 3629 | + Tcl_FindExecutable(PyBytes_AS_STRING(cexe)); | ||
| 3626 | 3630 | ||
| 3627 | 3631 | if (set_var) { | |
| 3628 | 3632 | SetEnvironmentVariableW(L"TCL_LIBRARY", NULL); | |
| 3629 | 3633 | PyMem_Free(wcs_path); | |
| 3630 | 3634 | } | |
| 3631 | 3635 | #else | |
| 3632 | - Tcl_FindExecutable(PyBytes_AsString(cexe)); | ||
| 3636 | + Tcl_FindExecutable(PyBytes_AS_STRING(cexe)); | ||
| 3633 | 3637 | #endif /* MS_WINDOWS */ | |
| 3634 | 3638 | } | |
| 3635 | 3639 | Py_XDECREF(cexe); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments