[issue42681] mistake in curses documentation
New submission from Robert T McQuaid <rtmq@fixcas.com>: The description of color_pair starts with curses.color_pair(color_number) It should be curses.color_pair(pair_number) ---------- assignee: docs@python components: Documentation messages: 383344 nosy: arbor, docs@python priority: normal severity: normal status: open title: mistake in curses documentation versions: Python 3.10 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Zackery Spytz <zspytz@gmail.com> added the comment: Please explain why you believe this is a mistake. ---------- nosy: +ZackerySpytz _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Change by Raymond Hettinger <raymond.hettinger@gmail.com>: ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment: Good catch! And it is not only documentation issue now. Since color numbers and pair numbers use different range checks, this prevents using this function with pair numbers larger that COLORS (should be accepted up to COLOR_PAIRS-1). Seems there is also other bug which prevents using pair number 0 (constant white on black). ---------- assignee: docs@python -> serhiy.storchaka components: +Library (Lib) versions: +Python 3.8, Python 3.9 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Change by Serhiy Storchaka <storchaka+cpython@gmail.com>: ---------- keywords: +patch pull_requests: +22736 stage: -> patch review pull_request: https://github.com/python/cpython/pull/23874 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment: New changeset 1470edd6131c29b8a09ce012cdfee3afa269d553 by Serhiy Storchaka in branch 'master': bpo-42681: Fix range checks for color and pair numbers in curses (GH-23874) https://github.com/python/cpython/commit/1470edd6131c29b8a09ce012cdfee3afa26... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Change by Serhiy Storchaka <storchaka+cpython@gmail.com>: ---------- pull_requests: +22911 pull_request: https://github.com/python/cpython/pull/24077 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Change by Serhiy Storchaka <storchaka+cpython@gmail.com>: ---------- title: mistake in curses documentation -> Incorrect range checks/documentation in curses _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment: New changeset b0ee2b492dbf550fbd2a63b82de0a4dc9d67f32e by Serhiy Storchaka in branch '3.9': [3.9] bpo-42681: Fix range checks for color and pair numbers in curses (GH-23874). (GH-24077) https://github.com/python/cpython/commit/b0ee2b492dbf550fbd2a63b82de0a4dc9d6... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Change by Serhiy Storchaka <storchaka+cpython@gmail.com>: ---------- pull_requests: +22913 pull_request: https://github.com/python/cpython/pull/24079 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Pablo Galindo Salgado <pablogsal@gmail.com> added the comment: This change seems to broke some buildbots. For instance: https://buildbot.python.org/all/#/builders/119/builds/153 ====================================================================== ERROR: test_colors_funcs (test.test_curses.TestCurses) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/dje/cpython-buildarea/3.8.edelsohn-rhel8-z/build/Lib/test/test_curses.py", line 310, in test_colors_funcs curses.pair_content(min(curses.COLOR_PAIRS - 1, 0x7fff)) _curses.error: Argument 1 was out of range. (1..COLOR_PAIRS-1) ---------------------------------------------------------------------- Ran 28 tests in 0.337s FAILED (errors=1) 1 test failed again: test_curses == Tests result: FAILURE then FAILURE == ---------- nosy: +pablogsal _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
STINNER Victor <vstinner@python.org> added the comment:
This change seems to broke some buildbots.
Yep, see also bpo-42789. ---------- nosy: +vstinner _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment: New changeset 82794cacc6073af9bc2b792a5ee21397f4c9037f by Serhiy Storchaka in branch '3.8': [3.8] [3.9] bpo-42681: Fix range checks for color and pair numbers in curses (GH-23874). (GH-24077) (GH-24079) https://github.com/python/cpython/commit/82794cacc6073af9bc2b792a5ee21397f4c... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Change by Serhiy Storchaka <storchaka+cpython@gmail.com>: ---------- pull_requests: +22920 pull_request: https://github.com/python/cpython/pull/24089 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment: New changeset 59f9b4e4509be67494f3d45489fa55523175ff69 by Serhiy Storchaka in branch 'master': bpo-42681: Fix test_curses failures related to color pairs (GH-24089) https://github.com/python/cpython/commit/59f9b4e4509be67494f3d45489fa5552317... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Change by Serhiy Storchaka <storchaka+cpython@gmail.com>: ---------- pull_requests: +22943 pull_request: https://github.com/python/cpython/pull/24113 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment: New changeset 9b3a53a8264d4c469a3f3d8c037e74c010be3e5c by Serhiy Storchaka in branch '3.9': [3.9] bpo-42681: Fix test_curses failures related to color pairs (GH-24089) (GH-24113) https://github.com/python/cpython/commit/9b3a53a8264d4c469a3f3d8c037e74c010b... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Change by Serhiy Storchaka <storchaka+cpython@gmail.com>: ---------- pull_requests: +22946 pull_request: https://github.com/python/cpython/pull/24116 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment: New changeset e2c847e0c518dd6c63a898b8265ba54b71548bd6 by Serhiy Storchaka in branch '3.8': [3.8] [3.9] bpo-42681: Fix test_curses failures related to color pairs (GH-24089) (GH-24113) (GH-24116) https://github.com/python/cpython/commit/e2c847e0c518dd6c63a898b8265ba54b715... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment: Well, a simple documentation issue has grown into large and complex changes that fix several bugs. * Incorrect parameter name in color_pair(). * Incorrectly documented ranges for color and pair numbers. * Based on incorrect documentation, incorrect checks was implemented in the code. * It was not caught earlier because most tests were skipped on buildbots. * BTW ncurses accepts some values outside of the documented ranges. * But ncurses 6.1 does not accept all values in the documented ranges. * There were other minor bugs introduced in issue36982. ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
Pablo Galindo Salgado <pablogsal@gmail.com> added the comment: Thanks a lot Serhiy for the fantastic work! ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
STINNER Victor <vstinner@python.org> added the comment: Great work, thank you Serhiy! ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42681> _______________________________________
participants (6)
-
Pablo Galindo Salgado -
Raymond Hettinger -
Robert T McQuaid -
Serhiy Storchaka -
STINNER Victor -
Zackery Spytz