(merge 3.2) Issue #12451: doctest.debug_script() doesn't create a temporary
file anymore to avoid encoding issues (it used the locale encoding, whereas
UTF-8 should be).

Remove also an unused import (warnings).