Roundup Robot added the comment:
New changeset bdd1df816f84 by Serhiy Storchaka in branch '3.5':
Issue #24824: Signatures of codecs.encode() and codecs.decode() now are
https://hg.python.org/cpython/rev/bdd1df816f84
New changeset ad65cad76331 by Serhiy Storchaka in branch 'default':
Issue
Larry Hastings added the comment:
Fixed. Thanks, Serhiy!
--
resolution: - fixed
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24824
___
Larry Hastings added the comment:
This is a legitimate problem and I'd definitely like it fixed.
However, the angle brackets and the quote marks are ugly:
decode(obj, encoding='sys.getdefaultencoding()', errors='strict')
Attached is a tweaked version of the patch that sidesteps the
Serhiy Storchaka added the comment:
How with more complex expressions, like sys.getdefaultencoding() or 'utf-8'.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24824
___
Yury Selivanov added the comment:
Larry, Serhiy,
After giving this some thought I think that my initial patch is a wrong
approach here -- inspect module should not be touched to fix this issue.
With this patch applied, signature object for codecs.encode would have a
Parameter with a bogus
Larry Hastings added the comment:
Can we do better? How about a new field on the Parameter object,
symbolic_default_value, which shows you the expression used to compute the
value? We could then set default_value to the result of the expression, pydoc
could print the symbolic expression,
Yury Selivanov added the comment:
Can we do better? How about a new field on the Parameter object,
symbolic_default_value, which shows you the expression used to compute the
value? We could then set default_value to the result of the expression,
pydoc could print the symbolic
Larry Hastings added the comment:
I just tried every module, simulating pydoc on it. codecs is the only one that
failed. So, I can live with just changing codecs for now. But let's do it
properly in 3.6. Go ahead and check in for 3.5--or, if you don't get it done
before I want to tag the
Serhiy Storchaka added the comment:
sys.getdefaultencoding() always returns utf-8 in 3.x (it left for
compatibility with 2.x). I suggested to set defaults to literal utf-8. This
matches documentation and signatures of str.encode() and bytes.decode().
--
Larry Hastings added the comment:
That's a fine change for 3.5. For 3.6 I want to solve the general problem, at
which point we can switch back to calling sys.getdefaultencoding() if we like.
Serhiy, can you make a patch a post it here? I want to tag 3.5.0rc1 in one or
two hours.
--
Serhiy Storchaka added the comment:
The patch is easy.
In future we should unify docstrings for codecs.encode() and codecs.decode()
with str.encode(), bytes.decode() and like.
--
Added file: http://bugs.python.org/file40153/codecs_default_encoding.patch
Marc-Andre Lemburg added the comment:
Please use encoding='utf-8' as definition for codecs.encode() and
codecs.decode().
There is no adjustable default encoding in Python 3 anymore.
For Python 3.6 this should probably be fixed everywhere.
--
___
Larry Hastings added the comment:
Please change Default encoding is to The default encoding is. Apart from
that, LGTM, please check in!
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24824
New submission from Serhiy Storchaka:
Pydoc fails with the codecs module in 3.5+. All works in 3.4.
$ ./python -m pydoc codecs
Traceback (most recent call last):
File /home/serhiy/py/cpython-3.5/Lib/runpy.py, line 170, in
_run_module_as_main
__main__, mod_spec)
File
Yury Selivanov added the comment:
This is related to Arguments Clinic and Larry's implementation of signature
parsing for built-in functions.
This particular bug is caused by 'codecs.encode' 'codecs.decode' functions
with the AC signatures defined as follows:
_codecs.encode
obj:
15 matches
Mail list logo