Library
-------
+ - Issue #21951: Tkinter now most likely raises MemoryError instead of crash
+ if the memory allocation fails.
+
- Issue #22338: Fix a crash in the json module on memory allocation failure.
+- Issue #12410: imaplib.IMAP4 now supports the context management protocol.
+ Original patch by Tarek Ziadé.
+
+- Issue #16662: load_tests() is now unconditionally run when it is present in
+ a package's __init__.py. TestLoader.loadTestsFromModule() still accepts
+ use_load_tests, but it is deprecated and ignored. A new keyword-only
+ attribute `pattern` is added and documented. Patch given by Robert Collins,
+ tweaked by Barry Warsaw.
+
- Issue #22226: First letter no longer is stripped from the "status" key in
the result of Treeview.heading().
Tcl_Obj **argv;
Py_ssize_t size, i;
- size = PyTuple_Size(value);
+ size = PySequence_Fast_GET_SIZE(value);
if (!CHECK_SIZE(size, sizeof(Tcl_Obj *))) {
- PyErr_SetString(PyExc_OverflowError, "tuple is too long");
+ PyErr_SetString(PyExc_OverflowError,
+ PyTuple_Check(value) ? "tuple is too long" :
+ "list is too long");
return NULL;
}
- argv = (Tcl_Obj **) ckalloc(((size_t)size) * sizeof(Tcl_Obj *));
+ argv = (Tcl_Obj **) attemptckalloc(((size_t)size) * sizeof(Tcl_Obj *));
- if(!argv)
- return 0;
+ if(!argv) {
+ PyErr_NoMemory();
+ return NULL;
+ }
for (i = 0; i < size; i++)
- argv[i] = AsObj(PyTuple_GetItem(value,i));
- result = Tcl_NewListObj(PyTuple_Size(value), argv);
+ argv[i] = AsObj(PySequence_Fast_GET_ITEM(value,i));
+ result = Tcl_NewListObj(size, argv);
ckfree(FREECAST argv);
return result;
}
if (objc > ARGSZ) {
if (!CHECK_SIZE(objc, sizeof(Tcl_Obj *))) {
- PyErr_SetString(PyExc_OverflowError, "tuple is too long");
+ PyErr_SetString(PyExc_OverflowError,
+ PyTuple_Check(args) ? "tuple is too long" :
+ "list is too long");
return NULL;
}
- objv = (Tcl_Obj **)ckalloc(((size_t)objc) * sizeof(Tcl_Obj *));
+ objv = (Tcl_Obj **)attemptckalloc(((size_t)objc) * sizeof(Tcl_Obj *));
if (objv == NULL) {
PyErr_NoMemory();
objc = 0;