[3.8] bpo-36373: Fix deprecation warnings (GH-15889) (GH-15901)

https://bugs.python.org/issue36373
(cherry picked from commit 7264e92b718d307cc499b2f10eab7644b00f0499)

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