[pypy-commit] pypy unicode-utf8: always re-encode unexpected kwd argument
mattip
pypy.commits at gmail.com
Mon Dec 24 10:28:14 EST 2018
Author: Matti Picus <matti.picus at gmail.com>
Branch: unicode-utf8
Changeset: r95522:be8caf00c728
Date: 2018-12-24 12:24 +0200
http://bitbucket.org/pypy/pypy/changeset/be8caf00c728/
Log: always re-encode unexpected kwd argument
diff --git a/pypy/interpreter/argument.py b/pypy/interpreter/argument.py
--- a/pypy/interpreter/argument.py
+++ b/pypy/interpreter/argument.py
@@ -535,24 +535,23 @@
if num_remainingkwds == 1:
for i in range(len(keywords)):
if i not in kwds_mapping:
- name = keywords[i]
- if name is None:
- # We'll assume it's unicode. Encode it.
- # Careful, I *think* it should not be possible to
- # get an IndexError here but you never know.
- try:
- if keyword_names_w is None:
- raise IndexError
- # note: negative-based indexing from the end
- w_name = keyword_names_w[i - len(keywords)]
- except IndexError:
- name = '?'
- else:
- w_enc = space.newtext(space.sys.defaultencoding)
- w_err = space.newtext("replace")
- w_name = space.call_method(w_name, "encode", w_enc,
- w_err)
- name = space.text_w(w_name)
+ name = '?'
+ # We'll assume it's unicode. Encode it.
+ # Careful, I *think* it should not be possible to
+ # get an IndexError here but you never know.
+ try:
+ if keyword_names_w is None:
+ raise IndexError
+ # note: negative-based indexing from the end
+ w_name = keyword_names_w[i - len(keywords)]
+ except IndexError:
+ name = '?'
+ else:
+ w_enc = space.newtext(space.sys.defaultencoding)
+ w_err = space.newtext("replace")
+ w_name = space.call_method(w_name, "encode", w_enc,
+ w_err)
+ name = space.text_w(w_name)
break
self.kwd_name = name
More information about the pypy-commit
mailing list