消息 [301346]
Not quite. Looking a bit further down get_progname()'s weird logic, we see that it works like this:
1. prog = Py_GetProgramName()
2. progpath = GetModuleFileNameW()
3. if (prog is empty):
prog = "python"
4. if (slash in prog): # Or backslash, of course
progpath = prog
So it uses the host process name from step 2 (i.e. progpath) whenever Py_SetProgramName() has not been used and step 3 has set prog to a value not containing a directory separator (or if it *has* been used to set something with no such separator in it).
The logic makes sense, I think, but it is quite impenetrable. Any chance of PEP 432 ("Restructuring the CPython startup sequence") happening this century? |
|
| 日期 |
用户 |
动作 |
参数 |
| 2017-09-05 18:08:06 | chrullrich | 修改 | recipients:
+ chrullrich, paul.moore, tim.golden, zach.ware, steve.dower |
| 2017-09-05 18:08:06 | chrullrich | 修改 | messageid: <1504634886.22.0.658858777734.issue31349@psf.upfronthosting.co.za> |
| 2017-09-05 18:08:06 | chrullrich | 链接 | issue31349 messages |
| 2017-09-05 18:08:06 | chrullrich | 创建 | |
|