#15545: sort iterdump via SQL instead of in python code

Although there is not a regression in Python2, we make the same update here to
keep the code bases in sync.

(The fix for issue 9750 introduced a regression in Python 3 by sorting the row
objects returned by fetchall.  But if a row_factory such as sqlite3.Row is
used, the rows may not be sortable (in Python3), which leads to an exception.
The sorting is still a nice idea, so the patch moves the sort into the sql.)

Fix and test by Peter Otten.
use PyInt_FromSsize_t instead of PyLong_FromSsize_t (#10182)
#13934: document sqlite version strings.
#15109: revert '%'->'format' changes in 4b105d328fe7 to fix regression.

With '%', non-ascii worked because the '%' automatically got promoted to
unicode.  With format that doesn't happen, which led to encoding errors.  This
fix goes back to using %, and adds a test to make sure non-ascii string values
work in iterdump.
#13899: \A, \Z, and \B now correctly match the A, Z, and B literals when used inside character classes (e.g. [A]).  Patch by Matthew Barnett.
Issue #16874: fix formatting of setup.py upload options in documentation.
#16154: fix some doctests in Doc/library.  Patch by Ravi Sinha.
Merge heads.
grammatical fix; thanks to Alex Rudnick from docs@
Issue #15539: Fix a number of bugs in Tools/scripts/pindent.py.
Now pindent.py works with a "with" statement.  pindent.py no longer produces
improper indentation.  pindent.py now works with continued lines broken after
"class" or "def" keywords and with continuations at the start of line.  Added
regression tests for pindent.py.  Modernized pindent.py.
Merge heads
Add a note about checking refleaks to patchcheck.