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

typos in curses argument error messages #60056

Closed
cjerdonek opened this issue Sep 2, 2012 · 12 comments
Closed

typos in curses argument error messages #60056

cjerdonek opened this issue Sep 2, 2012 · 12 comments
Labels
3.7 (EOL) end of life easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@cjerdonek
Copy link
Member

BPO 15852
Nosy @ezio-melotti, @bitdancer, @cjerdonek, @berkerpeksag, @serhiy-storchaka, @phmc
PRs
  • bpo-15852: correct the typos #4950
  • [2.7] bpo-15852: correct the typos (GH-4950) #4952
  • [3.6] bpo-15852: correct the typos (GH-4950) #4951
  • Files
  • issue-15852-1.patch
  • 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 = None
    closed_at = <Date 2017-12-21.05:44:03.907>
    created_at = <Date 2012-09-02.21:41:42.360>
    labels = ['3.7', 'easy', 'type-bug', 'library']
    title = 'typos in curses argument error messages'
    updated_at = <Date 2017-12-21.07:29:59.760>
    user = 'https://github.com/cjerdonek'

    bugs.python.org fields:

    activity = <Date 2017-12-21.07:29:59.760>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-12-21.05:44:03.907>
    closer = 'asvetlov'
    components = ['Library (Lib)']
    creation = <Date 2012-09-02.21:41:42.360>
    creator = 'chris.jerdonek'
    dependencies = []
    files = ['27106']
    hgrepos = []
    issue_num = 15852
    keywords = ['patch', 'easy', 'needs review']
    message_count = 12.0
    messages = ['169725', '169727', '169729', '169730', '169736', '169737', '170871', '170900', '170927', '187287', '305388', '308857']
    nosy_count = 6.0
    nosy_names = ['ezio.melotti', 'r.david.murray', 'chris.jerdonek', 'berker.peksag', 'serhiy.storchaka', 'pconnell']
    pr_nums = ['4950', '4952', '4951']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue15852'
    versions = ['Python 2.7', 'Python 3.6', 'Python 3.7']

    @cjerdonek
    Copy link
    Member Author

    It seems like a couple error messages in the curses module need correcting:

    PyErr_SetString(PyExc_TypeError, "insch requires 1 or 4 arguments");

    http://hg.python.org/cpython/file/8ff2f4634ed8/Modules/_cursesmodule.c#l1322

    PyErr_SetString(PyExc_TypeError, "instr requires 0 or 3 arguments");

    http://hg.python.org/cpython/file/8ff2f4634ed8/Modules/_cursesmodule.c#l1385

    In both cases, "or" should be "to".

    @cjerdonek cjerdonek added stdlib Python modules in the Lib dir easy type-bug An unexpected behavior, bug, or error labels Sep 2, 2012
    @bitdancer
    Copy link
    Member

    Given their signatures in the docs, I suspect it is more complicated than that. Perhaps the error messages are even correct. What does the code implement?

    @cjerdonek
    Copy link
    Member Author

    I just completed a patch to improve the documentation of these signatures (along with many others) in bpo-15831. The correction here is consistent with my findings and revised documentation there.

    As for the code, they are straightforward switch statements similar to many of the other methods in that module. I also did a manual test on one of the methods as a sanity check. I am preparing unit tests.

    @cjerdonek
    Copy link
    Member Author

    The situation is the same in 2.7 (and probably 3.2).

    @cjerdonek
    Copy link
    Member Author

    Attaching a patch with tests and fix for the default branch.

    @cjerdonek
    Copy link
    Member Author

    Uploading correct file.

    @ezio-melotti
    Copy link
    Member

    Can't you use assertRaisesRegex?

    @cjerdonek
    Copy link
    Member Author

    Thanks for taking a look at this, and good question.

    Without restructuring how the tests are done, I believe the short answer is no. The funny thing about this test module is that it does not actually have any unittest test cases. It just calls some functions. Failure happens if an exception is raised in any one of those functions.

    See here, for example:

    http://hg.python.org/cpython/file/59a2807872d5/Lib/test/test_curses.py#l35

    @cjerdonek
    Copy link
    Member Author

    FYI, I created bpo-16000 :) to switch test_curses to using unittest.TestCase.

    @phmc
    Copy link
    Mannequin

    phmc mannequin commented Apr 18, 2013

    The patch looks correct and complete, and still patches and passes the tests.

    So, as far as I can see, this can be committed.

    @serhiy-storchaka
    Copy link
    Member

    Do you mind to create a pull request on GitHub Chris?

    In general the patch LGTM, but I don't think this minor typo fix needs tests for exact error messages. Adding new tests is good, but I think it is enough to test that corresponding functions accept the correct number of arguments and raise TypeError on incorrect number of arguments.

    @serhiy-storchaka serhiy-storchaka added the 3.7 (EOL) end of life label Nov 1, 2017
    @serhiy-storchaka
    Copy link
    Member

    It was worth to honor Chris as the author of the patch in the commit message.

    @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
    3.7 (EOL) end of life easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    5 participants