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.

classification
Title: Remove redundant paragraphs from getargs.c skipitem()
Type: enhancement Stage: resolved
Components: Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: larry Nosy List: larry, mark.dickinson, pitrou, python-dev
Priority: low Keywords: patch

Created on 2012-05-07 23:24 by larry, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
larry.prune.skipitem.1.diff larry, 2012-05-09 06:36 review
Messages (6)
msg160179 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2012-05-07 23:24
There's code like this in skipitem() in Python/getargs.c:

    case 'b': /* byte -- very short int */
    /* ... a zillion more case statements here ... */
    case 'C': /* unicode char */
    case 'p': /* boolean predicate */
        {
            (void) va_arg(*p_va, void *);
            break;
        }

    case 'n': /* Py_ssize_t */
        {
            (void) va_arg(*p_va, Py_ssize_t *);
            break;
        }

    /* ... a bunch of other stuff here ... */

    case 'S': /* string object */
    case 'Y': /* string object */
    case 'U': /* unicode string object */
        {
            (void) va_arg(*p_va, PyObject **);
            break;
        }


I cannot for the life of me imagine a platform where the size of a "Py_ssize_t *" or a "PyObject **" would be different from the size of a "void *".  I've programmed on platforms where code pointers and data pointers were different sizes--but data pointers to different sizes of data?  Never heard of it.

But I've been wrong before!  So, rather than simply make the change, I'm posting this bug just as a double check.

It's safe to fold 'n', 'S', 'Y', and 'U' into the initial paragraph of case statements simply skipping a pointer... isn't it?
msg160247 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-05-09 06:29
I'm not sure what you're proposing to fix. It seems to save at most a couple of lines of (obvious) code?
At least Py_ssize_t *could* have a different width from "PyObject *".
msg160248 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2012-05-09 06:36
> I'm not sure what you're proposing to fix. It seems to save at
> most a couple of lines of (obvious) code?

Well, I *did* specify low priority.

Attached is the patch for what I had in mind.


> At least Py_ssize_t *could* have a different width from "PyObject *".

Not "Py_ssize_t", "Py_ssize_t *".
msg160249 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-05-09 06:44
> > At least Py_ssize_t *could* have a different width from "PyObject *".
> 
> Not "Py_ssize_t", "Py_ssize_t *".

Ah, fair enough then. Looks ok to me.
msg160250 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-05-09 06:52
New changeset 8ab37fa24e58 by Larry Hastings in branch 'default':
Issue #14746: Remove redundant paragraphs from skipitem() in Python/getargs.c.
http://hg.python.org/cpython/rev/8ab37fa24e58
msg160251 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2012-05-09 06:53
Thanks for the double-check.  I should have more confidence!
History
Date User Action Args
2022-04-11 14:57:30adminsetgithub: 58951
2012-05-09 06:53:15larrysetstatus: open -> closed
resolution: fixed
messages: + msg160251

stage: needs patch -> resolved
2012-05-09 06:52:26python-devsetnosy: + python-dev
messages: + msg160250
2012-05-09 06:44:42pitrousetmessages: + msg160249
2012-05-09 06:36:30larrysetfiles: + larry.prune.skipitem.1.diff
keywords: + patch
messages: + msg160248
2012-05-09 06:29:22pitrousetnosy: + mark.dickinson, pitrou
messages: + msg160247
2012-05-07 23:24:51larrycreate