[3.8] bpo-39191: Don't spawn a task before failing (GH-17796) (GH-17820)

(cherry picked from commit 3a5de511596f17575de082dcb8d43d63b2bd2da9)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2 files changed