[New-bugs-announce] [issue34193] Fix pluralization in TypeError messages in getargs.c

Karthikeyan Singaravelan report at bugs.python.org
Mon Jul 23 01:54:16 EDT 2018


New submission from Karthikeyan Singaravelan <tir.karthi at gmail.com>:

This ticket is to address comments by @terry.reedy on GitHub for PR https://github.com/python/cpython/pull/8395.

Ref : https://github.com/python/cpython/pull/8395#issuecomment-406894241

Tests: In the 3 tests before this, the suffix 0, 2, or 3 is the number of arguments given. This would suggest 0a, 0b, 2a, and 3a for the suffixes here. I like 1min, 2min, 1max, and 2max even better. You can wait a bit for other reviews before changing.

Blurb:

Let us be more specific. For the patch as is,
Fix pluralization of 'argument' in TypeError message with 'expected at least/most 1 argument', instead of '1 arguments'.

But if we add all the remaining fixes needed in this file (see below), we could write.
Fix pluralization in TypeError messages in getargs.c: '1 argument' instead of '1 arguments' and '1 element' instead of '1 elements'.

Fixes: This patch follows existing expressions formatted into argument%s:
line 380: (nargs < min ? min : max) == 1 ? "" : "s",
lines 1667 and 2093: (len == 1) ? "" : "s", (parens not needed)

Scope: I think we should finish the job in the file. The next line in both else clauses,
"unpacked tuple should have %s%zd elements,"
should get the same treatment. This may break existing tests. (These are the only two formatted 'elements'.

Fixes for the following will break some test, which will then need fixing also.
542: "expected %d arguments, not %" PY_FORMAT_SIZE_T "d",
1720, "%.200s%s takes %s %d positional arguments"
1799, "%.200s%s takes %s %d positional arguments"
2106, "%200s%s takes %s %d positional arguments (%d given)",
2154: "%.200s%s takes %s %d positional arguments"

I checked all PyErr_Format entries and did not see anything other than %d arguments and %d elements.

----------
components: Interpreter Core
messages: 322176
nosy: rhettinger, terry.reedy, xtreak
priority: normal
severity: normal
status: open
title: Fix pluralization in TypeError messages in getargs.c
type: enhancement
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34193>
_______________________________________


More information about the New-bugs-announce mailing list