Roundup Robot added the comment:
New changeset 8a3e896f0681 by Serhiy Storchaka in branch 'default':
Issue #20654: Fixed pydoc for enums with zero value. Patch by Vajrasky Kok.
http://hg.python.org/cpython/rev/8a3e896f0681
--
nosy: +python-dev
___
Serhiy Storchaka added the comment:
Thank you Vajrasky!
--
resolution: - fixed
stage: needs patch - committed/rejected
status: open - closed
type: - behavior
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20654
Vajrasky Kok added the comment:
This is the preliminary patch for this bug.
The bug happens because AddressFamily.AF_UNSPEC is 0. Then you have this if
condition:
getattr(object, name, None) or homecls.__dict__[name]
I'll contemplate whether we should add unit test for this or not.
Vajrasky Kok added the comment:
I just realized that Enum member could be None. I'll think how to improve this
patch.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20654
___
Serhiy Storchaka added the comment:
Just use getattr() without third argument and catch AttributeError.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20654
___
Changes by Serhiy Storchaka storch...@gmail.com:
--
assignee: - serhiy.storchaka
keywords: +easy
stage: - needs patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20654
___
Vajrasky Kok added the comment:
Here is the second preliminary patch. I'll think about the way to avoid
dependency to socket module.
--
Added file:
http://bugs.python.org/file34119/pydoc_display_enum_member_value_0.patch
___
Python tracker
Vajrasky Kok added the comment:
Here is the second patch, avoiding dependency to socket.AddressFamily (though
it adds dependency to enum library) in test.
--
Added file:
http://bugs.python.org/file34120/pydoc_display_enum_member_value_0_v2.patch
Serhiy Storchaka added the comment:
The fix itself looks good, but the test can be better. You write temporary file
in current directory. this can fail for different reasons, Python can crash and
left undeleted file, this file can overwrite existing file. The render_doc()
function is last
Serhiy Storchaka added the comment:
Interesting, that the documentation for AddressFamily (unlike to SocketType)
isn't generated in html doc. May be this is unrelated issue, but if this is
related, it would be good to fix it too. Otherwise it needs separate issue.
--
Vajrasky Kok added the comment:
Thanks for the review, Serhiy! Here is the patch addressing Serhiy's concern.
--
Added file:
http://bugs.python.org/file34126/pydoc_display_enum_member_value_0_v3.patch
___
Python tracker rep...@bugs.python.org
New submission from Serhiy Storchaka:
$ ./python -m pydoc socket.AddressFamily
Traceback (most recent call last):
File /home/serhiy/py/cpython/Lib/runpy.py, line 171, in _run_module_as_main
__main__, mod_spec)
File /home/serhiy/py/cpython/Lib/runpy.py, line 86, in _run_code
12 matches
Mail list logo