Fix scripts for Python 3.10
There was a change in Python 3.10 that causes these scripts to
crash with the following error:
File "gcompute-tools/./git-cookie-authdaemon", line 148, in update_cookie
cj.save()
File "/usr/lib/python3.10/http/cookiejar.py", line 2120, in save
if cookie.has_nonstandard_attr(HTTPONLY_ATTR):
File "/usr/lib/python3.10/http/cookiejar.py", line 805, in has_nonstandard_attr
return name in self._rest
TypeError: argument of type 'NoneType' is not iterable
Looking at the source for Cookie in both Python 2.7[1] and
Python 3.10[2], it looks like it expects the rest parameter to be
a dictionary. I've tested this change in Python 3.10 and it fixes the
issue.
[1] https://github.com/python/cpython/blob/v2.7.18/Lib/cookielib.py#L794
[2] https://github.com/python/cpython/blob/v3.10.5/Lib/http/cookiejar.py#L809
Change-Id: I2a917022d5a096696b48231dd95d4b9131734b54
diff --git a/git-cookie-authdaemon b/git-cookie-authdaemon
index d4fc036..d16651f 100755
--- a/git-cookie-authdaemon
+++ b/git-cookie-authdaemon
@@ -143,7 +143,7 @@
discard = False,
comment = None,
comment_url = None,
- rest = None))
+ rest = {}))
cj.save()
if '--debug' in sys.argv:
diff --git a/git-googlesource-login b/git-googlesource-login
index ec90104..f710795 100755
--- a/git-googlesource-login
+++ b/git-googlesource-login
@@ -78,7 +78,7 @@
discard = False,
comment = None,
comment_url = None,
- rest = None))
+ rest = {}))
cj.save()
os.chmod(cj.filename, 0o600)
if set_config: