Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curses addch() argument position reverses in Python3.4.0 #65287

Closed
ma8ma mannequin opened this issue Mar 28, 2014 · 10 comments
Closed

curses addch() argument position reverses in Python3.4.0 #65287

ma8ma mannequin opened this issue Mar 28, 2014 · 10 comments
Assignees
Labels
release-blocker stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@ma8ma
Copy link
Mannequin

ma8ma mannequin commented Mar 28, 2014

BPO 21088
Nosy @vstinner, @larryhastings
Files
  • addch.patch
  • larry.curses.window.addch.y.x.1.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/larryhastings'
    closed_at = <Date 2014-05-13.08:53:52.051>
    created_at = <Date 2014-03-28.19:51:30.803>
    labels = ['type-bug', 'library', 'release-blocker']
    title = 'curses addch() argument position reverses in Python3.4.0'
    updated_at = <Date 2014-05-21.00:41:43.420>
    user = 'https://github.com/ma8ma'

    bugs.python.org fields:

    activity = <Date 2014-05-21.00:41:43.420>
    actor = 'masamoto'
    assignee = 'larry'
    closed = True
    closed_date = <Date 2014-05-13.08:53:52.051>
    closer = 'larry'
    components = ['Library (Lib)']
    creation = <Date 2014-03-28.19:51:30.803>
    creator = 'masamoto'
    dependencies = []
    files = ['34770', '34939']
    hgrepos = []
    issue_num = 21088
    keywords = ['patch', '3.4regression']
    message_count = 10.0
    messages = ['215074', '215076', '215077', '215791', '215792', '215804', '216626', '217867', '217868', '218381']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'larry', 'python-dev']
    pr_nums = []
    priority = 'release blocker'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue21088'
    versions = ['Python 3.4', 'Python 3.5']

    @ma8ma
    Copy link
    Mannequin Author

    ma8ma mannequin commented Mar 28, 2014

    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')
        stdscr.refresh()
        stdscr.getch()
    
    curses.wrapper(test)

    Please make sure of issues, and fix it.
    Thanks.

    @ma8ma ma8ma mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Mar 28, 2014
    @ned-deily
    Copy link
    Member

    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.

      x
        X-coordinate.
      y
        Y-coordinate.
      ch
        Character to add.
      attr
        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?

    @larryhastings
    Copy link
    Contributor

    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.)

    @vstinner
    Copy link
    Member

    vstinner commented Apr 9, 2014

    Here is a patch. I don't see how to write a unit test.

    @vstinner
    Copy link
    Member

    vstinner commented Apr 9, 2014

    Redirecting the test to a file fails because curses complains stdio isn't a tty.

    You may create a the pty module for that.
    https://docs.python.org/dev/library/pty.html#pty.openpty

    @larryhastings
    Copy link
    Contributor

    How about examining the inspect.Signature?

    @larryhastings
    Copy link
    Contributor

    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.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 4, 2014

    New changeset 4f26430b03fd by Larry Hastings in branch '3.4':
    Issue bpo-21088: Bugfix for curses.window.addch() regression in 3.4.0.
    http://hg.python.org/cpython/rev/4f26430b03fd

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 4, 2014

    New changeset 3aa5fae8c313 by Larry Hastings in branch 'default':
    Issue bpo-21088: Merge from 3.4.
    http://hg.python.org/cpython/rev/3aa5fae8c313

    @larryhastings larryhastings self-assigned this May 4, 2014
    @vstinner
    Copy link
    Member

    Can we now close this issue?

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    release-blocker stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants