Skip to content

Commit 057e968

Browse files
authored
Update some of changed libs and tests from 3.14.5 -> 3.14.6 (part 2) (RustPython#8085)
1 parent 404ee2a commit 057e968

22 files changed

Lines changed: 832 additions & 267 deletions

Lib/http/cookies.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,18 +391,18 @@ def __repr__(self):
391391
return '<%s: %s>' % (self.__class__.__name__, self.OutputString())
392392

393393
def js_output(self, attrs=None):
394-
import base64
394+
import urllib.parse
395395
# Print javascript
396396
output_string = self.OutputString(attrs)
397397
if _has_control_character(output_string):
398398
raise CookieError("Control characters are not allowed in cookies")
399399
# Base64-encode value to avoid template
400400
# injection in cookie values.
401-
output_encoded = base64.b64encode(output_string.encode('utf-8')).decode("ascii")
401+
output_encoded = urllib.parse.quote(output_string, safe='', encoding='utf-8')
402402
return """
403403
<script type="text/javascript">
404404
<!-- begin hiding
405-
document.cookie = atob(\"%s\");
405+
document.cookie = decodeURIComponent(\"%s\");
406406
// end hiding -->
407407
</script>
408408
""" % (output_encoded,)

Lib/imaplib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ def login(self, user, password):
706706
"""
707707
typ, dat = self._simple_command('LOGIN', user, self._quote(password))
708708
if typ != 'OK':
709-
raise self.error(dat[-1])
709+
raise self.error(dat[-1].decode('UTF-8', 'replace'))
710710
self.state = 'AUTH'
711711
return typ, dat
712712

Lib/json/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ def dump(obj, fp, *, skipkeys=False, ensure_ascii=True, check_circular=True,
143143
144144
If ``indent`` is a non-negative integer, then JSON array elements and
145145
object members will be pretty-printed with that indent level. An indent
146-
level of 0 will only insert newlines. ``None`` is the most compact
147-
representation.
146+
level of 0 will only insert newlines. ``None`` is the default and gives
147+
a representation with no newlines inserted.
148148
149149
If specified, ``separators`` should be an ``(item_separator,
150150
key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is
@@ -207,8 +207,8 @@ def dumps(obj, *, skipkeys=False, ensure_ascii=True, check_circular=True,
207207
208208
If ``indent`` is a non-negative integer, then JSON array elements and
209209
object members will be pretty-printed with that indent level. An indent
210-
level of 0 will only insert newlines. ``None`` is the most compact
211-
representation.
210+
level of 0 will only insert newlines. ``None`` is the default and gives
211+
a representation with no newlines inserted.
212212
213213
If specified, ``separators`` should be an ``(item_separator,
214214
key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is

Lib/json/tool.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ def main():
8888
infile = open(options.infile, encoding='utf-8')
8989
try:
9090
if options.json_lines:
91-
objs = (json.loads(line) for line in infile)
91+
lines = infile.readlines()
92+
objs = (json.loads(line) for line in lines)
9293
else:
9394
objs = (json.load(infile),)
9495
finally:

0 commit comments

Comments
 (0)