This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: FancyGetopt.generate_help crashes with TypeError
Type: behavior Stage: resolved
Components: Distutils, Library (Lib) Versions: Python 3.8
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: SilentGhost, crztssr, dstufft, eric.araujo
Priority: normal Keywords: patch

Created on 2019-03-19 19:28 by crztssr, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 12447 closed crztssr, 2019-03-19 19:33
Messages (2)
msg338401 - (view) Author: Maxim (crztssr) * Date: 2019-03-19 19:28
Hi!

FancyGetopt.generate_help crashes if help text in option_table is None:

instance = FancyGetopt([('long', 'l', None)])
help_text = instance.generate_help()

TypeError                                 Traceback (most recent call last)
<ipython-input-40-04e4e328455e> in <module>
----> 1 a.generate_help()

/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/fancy_getopt.py in generate_help(self, header)
    352                                  (max_opt, opt_names, text[0]))
    353                 else:
--> 354                     lines.append("  --%-*s" % opt_names)
    355
    356             for l in text[1:]:

TypeError: * wants int

This code is in master branch too.

And if help_text is empty string code behavior is like a help_text is actually pass and added 2 whitespaces.
msg338407 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2019-03-19 19:58
I'm not sure why you're using distutils, but two extra spaces at the end of string is not likely to be fixed. The module is frozen and only present in the tree for historical reasons.
History
Date User Action Args
2022-04-11 14:59:12adminsetgithub: 80552
2019-03-19 19:58:12SilentGhostsetstatus: open -> closed

components: + Distutils

nosy: + eric.araujo, SilentGhost, dstufft
messages: + msg338407
resolution: rejected
stage: patch review -> resolved
2019-03-19 19:33:06crztssrsetkeywords: + patch
stage: patch review
pull_requests: + pull_request12400
2019-03-19 19:28:41crztssrcreate