Issue #18604: Consolidated checks for GUI availability.

test_support._is_gui_available is now defined the same way on every
platform, and now includes the Windows-specific check that had been in the
Windows version of _is_gui_available and the OSX-specific check that was
in tkinter.test.support.check_tk_availability.  Also, every platform
checks whether Tk can be instantiated (if the platform-specific checks
passed).
Closes #18604: Merge with 3.4
Issue #21393: random.c: on Windows, close the hCryptProv handle at exit
Issue #21233: Add new C functions: PyMem_RawCalloc(), PyMem_Calloc(),
PyObject_Calloc(), _PyObject_GC_Calloc(). bytes(int) and bytearray(int) are now
using ``calloc()`` instead of ``malloc()`` for large objects which is faster
and use less memory (until the bytearray buffer is filled with data).
Issue #21233: Oops, Fix _PyObject_Alloc(): initialize nbytes before going to
redirect.
Issue 21375:  Fix possible Py_ssizet overflow in heapq.
merge
Issue 21101:  Internal API for dict getitem and setitem where the hash value is known.
Issue #21101:  Eliminate double hashing in the C code for collections.Counter().
do not expose known hash api in stable API
improve test coverage of filecmp (closes #21357)

Patch by Diana Clarke.
merge 3.4 (#21357)
use with blocks to make sure files are closed
merge 3.4
improve idioms (closes #20642)

Patch by Claudiu Popa.
Simplify and speedup the internals of the heapq module.
Neaten-up a bit add add missing size change check.
Issue #21421:  Add __slots__ to the MappingViews ABCs.
Issue #18604: Skip the Tk instantiation test on OS X because it can
cause GUI tests to segfault in Cocoa Tk when run under regrtest -j
(multiple threads running subprocesses).
Issue #18604: merge from 3.4