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: ast.c duplicates STR(CHILD)
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Christopher Aycock, emilyemorehouse
Priority: normal Keywords:

Created on 2017-06-27 08:01 by Christopher Aycock, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg297018 - (view) Author: Christopher Aycock (Christopher Aycock) Date: 2017-06-27 08:01
The function alias_for_import_name() duplicates logic starting at Python/ast.c:3237

    char *sch = STR(CHILD(n, i));
    strcpy(s, STR(CHILD(n, i)));
    s += strlen(sch);
    *s++ = '.';

I assume the strcpy() is supposed to use the sch value from the line above. There shouldn't be any consequence to the code as it currently is; I just noticed it while reading through the source.
msg297202 - (view) Author: Emily Morehouse (emilyemorehouse) * (Python committer) Date: 2017-06-28 17:34
Thanks Christopher, you are absolutely correct. There are a few ways in which this code could be optimized (and many other small optimizations probably exist elsewhere in the code).

If you are interested in submitting a PR for this, you are more than welcome to and I can re-open the issue. Otherwise, I'm going to close it out as this is not a critical optimization.
Date User Action Args
2022-04-11 14:58:48adminsetgithub: 74968
2017-06-28 17:34:28emilyemorehousesetstatus: open -> closed

nosy: + emilyemorehouse
messages: + msg297202

resolution: not a bug
stage: resolved
2017-06-27 08:01:37Christopher Aycockcreate