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: Move _Py_IDENTIFIER statics in Python/import.c to top of the file
Type: enhancement Stage: resolved
Components: Interpreter Core, Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: nanjekyejoannah Nosy List: Greg Price, eric.snow, nanjekyejoannah, serhiy.storchaka, vstinner
Priority: normal Keywords:

Created on 2019-08-16 13:21 by nanjekyejoannah, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (5)
msg349859 - (view) Author: Joannah Nanjekye (nanjekyejoannah) * (Python committer) Date: 2019-08-16 13:21
Following a PR review here: https://github.com/python/cpython/pull/15057 by @ericsnowcurrently i.e :

Please move both these statics to the top of the file (next to CACHEDIR) as globals.

To keep the diff in the above PR simple, I am tracking this refactor in this issue.
msg349860 - (view) Author: Joannah Nanjekye (nanjekyejoannah) * (Python committer) Date: 2019-08-16 13:23
Relevant comment from @gnprice.



I think it would be better to make that as a separate change. This style where they're block-local is the way the existing code works, which keeps the diff simple.

It's also the way that every use of _Py_IDENTIFIER in this file works. So I think the cleanest way to change the style would be to sweep through this whole file (or more) in one PR, separate from any substantive changes.
msg349861 - (view) Author: Joannah Nanjekye (nanjekyejoannah) * (Python committer) Date: 2019-08-16 13:24
Keeping this until the PR https://github.com/python/cpython/pull/15057 is merged.
msg350065 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-08-21 11:07
Why should we move static variables as globals? What is the rationale?

_Py_IDENTIFIER uses a linked list internally to be able to free all these strings at Python exit.
msg351878 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2019-09-11 13:44
Yeah, I'm fine with dropping this.  In the file we have some global and some local, so my suggestion was to consolidate a little.  However, it mostly doesn't matter. :)
History
Date User Action Args
2022-04-11 14:59:19adminsetgithub: 82053
2019-09-11 13:44:16eric.snowsetstatus: open -> closed
resolution: rejected
messages: + msg351878

stage: needs patch -> resolved
2019-08-21 11:07:31vstinnersetnosy: + vstinner
messages: + msg350065
2019-08-16 18:25:53Greg Pricesetcomponents: + Interpreter Core
2019-08-16 18:24:38Greg Pricesettitle: Move statics in Python/import.c to top of the file -> Move _Py_IDENTIFIER statics in Python/import.c to top of the file
2019-08-16 18:23:36Greg Pricesetnosy: + Greg Price
2019-08-16 14:02:56josh.rsettitle: Move statitics in Python/import.c to top of the file -> Move statics in Python/import.c to top of the file
2019-08-16 13:24:01nanjekyejoannahsetmessages: + msg349861
2019-08-16 13:23:10nanjekyejoannahsetmessages: + msg349860
2019-08-16 13:21:10nanjekyejoannahcreate