Revert unneccessary changes made in bpo-30296 and apply other improvements. (GH-2624)
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 2b76942..5b962f7 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -1286,7 +1286,8 @@
h.set_debuglevel(self._debuglevel)
headers = dict(req.unredirected_hdrs)
- headers.update((k, v) for k, v in req.headers.items() if k not in headers)
+ headers.update({k: v for k, v in req.headers.items()
+ if k not in headers})
# TODO(jhylton): Should this be redesigned to handle
# persistent connections?