Avoid UnicodeEncodeError by only printing ASCII.

This fixes running test_decimal in verbose mode on Windows,
which I broke in issue #19572.
Do not discard const qualifier without a reason.
Issue #14432: Generator now clears the borrowed reference to the thread state

Fix a crash when a generator is created in a C thread that is destroyed while
the generator is still used. The issue was that a generator contains a frame,
and the frame kept a reference to the Python state of the destroyed C thread.
The crash occurs when a trace function is setup.
Issue #14432: Fix compilation when thread support is disabled