Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
55faeb6
clock_nanosleep() implementation for time.sleep()
Livius90 Sep 1, 2021
c7bae3b
Follow PEP 7 rules in time.sleep()
Livius90 Sep 1, 2021
b3a5c5f
Adjust braces to PEP 7
Livius90 Sep 1, 2021
3e07f39
clock_nanosleep check placed after clock_settime
Livius90 Sep 1, 2021
e06ba84
Fix EINTR issue for clock_nanosleep()
Livius90 Sep 1, 2021
6e6d4a3
📜🤖 Added by blurb_it.
blurb-it[bot] Sep 1, 2021
238f073
nanosleep() is available for Unix systems like OSX, FreeBSD
Livius90 Sep 1, 2021
b5a5c6e
Update news rst file
Livius90 Sep 1, 2021
d064255
replace select() with nanosleep()
Livius90 Sep 2, 2021
b70f187
📜🤖 Added by blurb_it.
blurb-it[bot] Sep 2, 2021
6ad7c14
Fix test_eintr issue for macOS
Livius90 Sep 2, 2021
74c45e1
Remove news rst and regenerate
Livius90 Sep 2, 2021
5988222
📜🤖 Added by blurb_it.
blurb-it[bot] Sep 2, 2021
129b0a0
Use waitable timer from Win32 for time.sleep() in Windows
Livius90 Sep 3, 2021
d89e13b
Finalized waitable timer for time.sleep() in Windows
Livius90 Sep 3, 2021
47249f5
📜🤖 Added by blurb_it.
blurb-it[bot] Sep 3, 2021
0bf8330
Fix macOS build issue
Livius90 Sep 3, 2021
085cbed
📜🤖 Added by blurb_it.
blurb-it[bot] Sep 3, 2021
2242638
Final optimization in Waitable timer object implementation
Livius90 Sep 4, 2021
db7851b
📜🤖 Added by blurb_it.
blurb-it[bot] Sep 4, 2021
f7387e8
revert to original
Livius90 Sep 9, 2021
a35b0b4
remove news
Livius90 Sep 9, 2021
3abf812
add clock_nanosleep() only
Livius90 Sep 9, 2021
4cbfde2
📜🤖 Added by blurb_it.
blurb-it[bot] Sep 10, 2021
d99c06e
Update Misc/NEWS.d/next/Library/2021-09-10-00-24-08.bpo-21302.XS_frc.rst
Livius90 Sep 10, 2021
117dc62
timeout_abs renaming
Livius90 Sep 10, 2021
92061f3
Simplified HAVE_CLOCK_NANOSLEEP macro blocks
Livius90 Sep 10, 2021
f045047
remake news
Livius90 Sep 10, 2021
24f9975
📜🤖 Added by blurb_it.
blurb-it[bot] Sep 10, 2021
34e3883
Fix err checking
Livius90 Sep 10, 2021
fec634f
📜🤖 Added by blurb_it.
blurb-it[bot] Sep 10, 2021
8022062
revert changes
Livius90 Sep 10, 2021
4685ec7
get_monotonic() and secs re-calculation are useless for clock_nanosle…
Livius90 Sep 10, 2021
0ad19e0
📜🤖 Added by blurb_it.
blurb-it[bot] Sep 10, 2021
0839d0d
merge errno in HAVE_CLOCK_NANOSLEEP
Livius90 Sep 11, 2021
39cff8f
remake news rst
Livius90 Sep 11, 2021
87d5712
📜🤖 Added by blurb_it.
blurb-it[bot] Sep 11, 2021
56cb8e1
Try to fix Address sanitizer test issue
Livius90 Sep 11, 2021
8ec03be
📜🤖 Added by blurb_it.
blurb-it[bot] Sep 11, 2021
b1ccdba
#2 Try to fix Address sanitizer test issue
Livius90 Sep 11, 2021
c8372c8
📜🤖 Added by blurb_it.
blurb-it[bot] Sep 11, 2021
1cf2205
remake news rst
Livius90 Sep 11, 2021
1e725da
📜🤖 Added by blurb_it.
blurb-it[bot] Sep 11, 2021
3566c59
re-make news rst
Livius90 Sep 11, 2021
278aaa2
📜🤖 Added by blurb_it.
blurb-it[bot] Sep 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove news
  • Loading branch information
Livius90 committed Sep 9, 2021
commit a35b0b4606bf4b0d4038f1978fc0b6d225bdcfe6

This file was deleted.

202 changes: 202 additions & 0 deletions Modules/_tkinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,145 @@ unicodeFromTclObj(Tcl_Obj *value)
#endif
}


static PyObject *
Split(const char *list)
{
int argc;
const char **argv;
PyObject *v;

if (list == NULL) {
Py_RETURN_NONE;
}

if (Tcl_SplitList((Tcl_Interp *)NULL, list, &argc, &argv) != TCL_OK) {
/* Not a list.
* Could be a quoted string containing funnies, e.g. {"}.
* Return the string itself.
*/
return unicodeFromTclString(list);
}

if (argc == 0)
v = PyUnicode_FromString("");
else if (argc == 1)
v = unicodeFromTclString(argv[0]);
else if ((v = PyTuple_New(argc)) != NULL) {
int i;
PyObject *w;

for (i = 0; i < argc; i++) {
if ((w = Split(argv[i])) == NULL) {
Py_DECREF(v);
v = NULL;
break;
}
PyTuple_SET_ITEM(v, i, w);
}
}
Tcl_Free(FREECAST argv);
return v;
}

/* In some cases, Tcl will still return strings that are supposed to
be lists. SplitObj walks through a nested tuple, finding string
objects that need to be split. */

static PyObject *
SplitObj(PyObject *arg)
{
if (PyTuple_Check(arg)) {
Py_ssize_t i, size;
PyObject *elem, *newelem, *result;

size = PyTuple_GET_SIZE(arg);
result = NULL;
/* Recursively invoke SplitObj for all tuple items.
If this does not return a new object, no action is
needed. */
for(i = 0; i < size; i++) {
elem = PyTuple_GET_ITEM(arg, i);
newelem = SplitObj(elem);
if (!newelem) {
Py_XDECREF(result);
return NULL;
}
if (!result) {
Py_ssize_t k;
if (newelem == elem) {
Py_DECREF(newelem);
continue;
}
result = PyTuple_New(size);
if (!result)
return NULL;
for(k = 0; k < i; k++) {
elem = PyTuple_GET_ITEM(arg, k);
Py_INCREF(elem);
PyTuple_SET_ITEM(result, k, elem);
}
}
PyTuple_SET_ITEM(result, i, newelem);
}
if (result)
return result;
/* Fall through, returning arg. */
}
else if (PyList_Check(arg)) {
Py_ssize_t i, size;
PyObject *elem, *newelem, *result;

size = PyList_GET_SIZE(arg);
result = PyTuple_New(size);
if (!result)
return NULL;
/* Recursively invoke SplitObj for all list items. */
for(i = 0; i < size; i++) {
elem = PyList_GET_ITEM(arg, i);
newelem = SplitObj(elem);
if (!newelem) {
Py_XDECREF(result);
return NULL;
}
PyTuple_SET_ITEM(result, i, newelem);
}
return result;
}
else if (PyUnicode_Check(arg)) {
int argc;
const char **argv;
const char *list = PyUnicode_AsUTF8(arg);

if (list == NULL ||
Tcl_SplitList((Tcl_Interp *)NULL, list, &argc, &argv) != TCL_OK) {
Py_INCREF(arg);
return arg;
}
Tcl_Free(FREECAST argv);
if (argc > 1)
return Split(list);
/* Fall through, returning arg. */
}
else if (PyBytes_Check(arg)) {
int argc;
const char **argv;
const char *list = PyBytes_AS_STRING(arg);

if (Tcl_SplitList((Tcl_Interp *)NULL, (char *)list, &argc, &argv) != TCL_OK) {
Py_INCREF(arg);
return arg;
}
Tcl_Free(FREECAST argv);
if (argc > 1)
return Split(PyBytes_AS_STRING(arg));
/* Fall through, returning arg. */
}
Py_INCREF(arg);
return arg;
}


/*[clinic input]
module _tkinter
class _tkinter.tkapp "TkappObject *" "&Tkapp_Type_spec"
Expand Down Expand Up @@ -2203,6 +2342,68 @@ _tkinter_tkapp_splitlist(TkappObject *self, PyObject *arg)
return v;
}

/*[clinic input]
_tkinter.tkapp.split

arg: object
/

[clinic start generated code]*/

static PyObject *
_tkinter_tkapp_split(TkappObject *self, PyObject *arg)
/*[clinic end generated code: output=e08ad832363facfd input=a1c78349eacaa140]*/
{
PyObject *v;
char *list;

if (PyErr_WarnEx(PyExc_DeprecationWarning,
"split() is deprecated; consider using splitlist() instead", 1))
{
return NULL;
}

if (PyTclObject_Check(arg)) {
Tcl_Obj *value = ((PyTclObject*)arg)->value;
int objc;
Tcl_Obj **objv;
int i;
if (Tcl_ListObjGetElements(Tkapp_Interp(self), value,
&objc, &objv) == TCL_ERROR) {
return FromObj(self, value);
}
if (objc == 0)
return PyUnicode_FromString("");
if (objc == 1)
return FromObj(self, objv[0]);
if (!(v = PyTuple_New(objc)))
return NULL;
for (i = 0; i < objc; i++) {
PyObject *s = FromObj(self, objv[i]);
if (!s) {
Py_DECREF(v);
return NULL;
}
PyTuple_SET_ITEM(v, i, s);
}
return v;
}
if (PyTuple_Check(arg) || PyList_Check(arg))
return SplitObj(arg);

if (!PyArg_Parse(arg, "et:split", "utf-8", &list))
return NULL;
if (strlen(list) >= INT_MAX) {
PyErr_SetString(PyExc_OverflowError, "string is too long");
PyMem_Free(list);
return NULL;
}
v = Split(list);
PyMem_Free(list);
return v;
}



/** Tcl Command **/

Expand Down Expand Up @@ -3130,6 +3331,7 @@ static PyMethodDef Tkapp_methods[] =
_TKINTER_TKAPP_EXPRDOUBLE_METHODDEF
_TKINTER_TKAPP_EXPRBOOLEAN_METHODDEF
_TKINTER_TKAPP_SPLITLIST_METHODDEF
_TKINTER_TKAPP_SPLIT_METHODDEF
_TKINTER_TKAPP_CREATECOMMAND_METHODDEF
_TKINTER_TKAPP_DELETECOMMAND_METHODDEF
_TKINTER_TKAPP_CREATEFILEHANDLER_METHODDEF
Expand Down