Title: Define field prefixes for the various config structs
Type: enhancement Stage: needs patch
Components: Versions: Python 3.8, Python 3.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: BTaskaya, eric.snow, nanjekyejoannah, ncoghlan, vstinner
Priority: normal Keywords:

Created on 2018-03-25 06:10 by ncoghlan, last changed 2019-05-15 14:19 by vstinner.

Messages (3)
msg314398 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2018-03-25 06:10
While working on, I found it hard to keep track of which kind of config struct a particular piece of code was referencing.

As a particularly relevant example, we currently have 3 different "warnoptions" fields: the private-to-main one for reading the command line settings, the "wchar_t *" list in the core config, and the "PyObject *" list object in the main interpreter config (which is also the one aliased as sys.warnoptions).

What do you think of adopting a convention where:

* the command line fields all gain a "cmd_" prefix
* the core config fields all gain a "c_" prefix
* the interpreter config fields all gain a "py_" prefix

We'd then have "cmd_warnoptions", "c_warnoptions", and "py_warnoptions" as the field names, and it would be more self-evident which layer we were working at in any particular piece of code.
msg342562 - (view) Author: Batuhan (BTaskaya) * Date: 2019-05-15 11:17
+1 from me. But i dont understand why this issue triaged as "needs patch". Isn't it should be discussed first?
msg342574 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-05-15 14:19
In the master branch, the C function config_read_cmdline() uses:

* cmdline_warnoptions: -W command line arguments
* env_warnoptions: PYTHONWARNINGS environment variable

The config_init_warnoptions() uses these 2 list and combine it with other options, dev_mode and bytes_warnings.

The warnings options are now specified in my PEP 587:
Date User Action Args
2019-05-15 14:19:54vstinnersetmessages: + msg342574
2019-05-15 11:17:47BTaskayasetnosy: + BTaskaya
messages: + msg342562
2019-04-19 20:39:51nanjekyejoannahsetnosy: + nanjekyejoannah
2018-03-25 06:10:23ncoghlancreate