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.

Title: curses addch() argument position reverses in Python3.4.0
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.4, Python 3.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: larry Nosy List: larry, python-dev, vstinner
Priority: release blocker Keywords: 3.4regression, patch

Created on 2014-03-28 19:51 by masamoto, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
addch.patch vstinner, 2014-04-09 01:15 review
larry.curses.window.addch.y.x.1.diff larry, 2014-04-16 23:53 review
Messages (10)
msg215074 - (view) Author: Masayuki Yamamoto (masamoto) * Date: 2014-03-28 19:51
There is a test code that is "RB" characters display on screen. I expected displaying "R" to right, and displaying "B" to bottom. It was run as expected in Python 2.7.3 and 3.2.3 on Cygwin.
But they were displayed reverse in Python 3.4.0. And when addch() arguments reversed, they were displayed in expected positions.

import curses

def test(stdscr):
    stdscr.addch(0, 5, b'R')
    stdscr.addch(5, 0, b'B')


Please make sure of issues, and fix it.
msg215076 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-03-28 20:42
It looks like the arguments were inadvertently swapped during the conversion to Argument Clinic.  The Library Reference doc says:

window.addch(y, x, ch[, attr])

but the Argument Clinic docstring for 3.4.0 says:

Help on built-in function addch:

addch(...) method of _curses.curses window instance
    addch([x, y,] ch, [attr])
    Paint character ch at (y, x) with attributes attr.

        Character to add.
        Attributes for the character.

    Paint character ch at (y, x) with attributes attr,
    overwriting any character previously painted at that location.
    By default, the character position and attributes are the
    current settings for the window object.

Perhaps we should check for others?
msg215077 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-03-28 21:12
That's my fault.  That conversion was done at a time when there were a lot fewer eyes looking at AC.

It should obviously be fixed, and a test added to the regression test suite.

It'd also be nice if running the curses test didn't make reading the result impossible.  Running "python -m test -u curses test_curses" leaves my terminal window cleared, with no text to scroll back to, and the result of the regression test gone.  Redirecting the test to a file fails because curses complains stdio isn't a tty.

(I specifically ran the curses regression test suite several times during the development of 3.4 and I don't recall it ever complaining, so I'm assuming there is no test for this function.  But it's possible there is a test, but the irritating behavior of test_curses means it's impossible to see the result.)
msg215791 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-04-09 01:15
Here is a patch. I don't see how to write a unit test.
msg215792 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-04-09 01:16
> Redirecting the test to a file fails because curses complains stdio isn't a tty.

You may create a the pty module for that.
msg215804 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-04-09 05:17
How about examining the inspect.Signature?
msg216626 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-04-16 23:53
Here's my version of the patch, which is like Victor's patch but adds a test.

For what it's worth, I'll make sure this issue is fixed before I release 3.4.1.
msg217867 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-05-04 11:41
New changeset 4f26430b03fd by Larry Hastings in branch '3.4':
Issue #21088: Bugfix for curses.window.addch() regression in 3.4.0.
msg217868 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-05-04 11:48
New changeset 3aa5fae8c313 by Larry Hastings in branch 'default':
Issue #21088: Merge from 3.4.
msg218381 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-05-12 23:37
Can we now close this issue?
Date User Action Args
2022-04-11 14:58:00adminsetgithub: 65287
2014-05-21 00:41:43masamotosetnosy: - masamoto
2014-05-13 08:53:52larrysetstatus: open -> closed
2014-05-12 23:37:50vstinnersetmessages: + msg218381
2014-05-04 11:48:50larrysetassignee: larry
resolution: fixed
stage: needs patch -> resolved
2014-05-04 11:48:28python-devsetmessages: + msg217868
2014-05-04 11:41:31python-devsetnosy: + python-dev
messages: + msg217867
2014-04-16 23:53:10larrysetfiles: + larry.curses.window.addch.y.x.1.diff

messages: + msg216626
2014-04-09 05:17:16larrysetmessages: + msg215804
2014-04-09 01:16:16vstinnersetmessages: + msg215792
2014-04-09 01:15:29vstinnersetfiles: + addch.patch
keywords: + patch
messages: + msg215791
2014-04-04 18:59:59ned.deilysetnosy: - ned.deily
2014-04-04 16:17:38vstinnersetnosy: + vstinner
2014-03-28 21:12:41larrysetmessages: + msg215077
2014-03-28 20:42:24ned.deilysetkeywords: + 3.4regression
2014-03-28 20:42:14ned.deilysetpriority: normal -> release blocker
versions: + Python 3.5
nosy: + larry, ned.deily

messages: + msg215076

stage: needs patch
2014-03-28 19:51:30masamotocreate