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.
Created on 2014年02月13日 10:26 by vstinner, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| cleanenv.patch | vstinner, 2014年02月13日 10:27 | review | ||
| Messages (8) | |||
|---|---|---|---|
| msg211138 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2014年02月13日 10:26 | |
On Windows, if Python is started with an empty environment (no environment variable at all), Python fails with: "Fatal Python error: Failed to initialize Windows random API (CryptoGen)" It's the Windows error 0x80090006 which is not displayed in the error message :-( In fact, it's because Python 3 cannot be started without SYSTEMROOT environment variable. Otherwise, CryptAcquireContext() is unable to find some DLL. IMO the script_helper should be fixed to copy the variable. Recent example of this issue: http://bugs.python.org/issue20599#msg211111 |
|||
| msg211139 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2014年02月13日 10:27 | |
cleanenv.patch: untested test. |
|||
| msg211141 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2014年02月13日 10:37 | |
When Python is executed in an empty environement, not only it displays "Fatal Python error: Failed to initialize Windows random API (CryptoGen)", but it opens also the fatal error popup on Windows. The issue #19983 proposes a patch to not abort() at exit, but exit with an non-zero exit code instead. The same should be done for this error. By the way, we can maybe help the use to fix this issue with a better error message. For example, add in the message " (check if SYSTEMROOT environment variable is correctly set)", maybe only if the environment variable is not set. |
|||
| msg211143 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2014年02月13日 10:51 | |
Oh, another problem: if Python is compiled in shared module, libpython3.4.so cannot be found. LD_LIBRARY_PATH must also be copied if __cleanenv=True. Py_ENABLE_SHARED can be checked in sysconfig to decide if the environment variable should be copied or not. |
|||
| msg211295 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2014年02月15日 20:46 | |
Interesting, how isolation mode works on Windows or if Python is compiled in shared module? Should we keep these environment variables if the __isolated keyword is used? |
|||
| msg211304 - (view) | Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) | Date: 2014年02月16日 01:57 | |
> Oh, another problem: if Python is compiled in shared module, libpython3.4.so cannot be found. > LD_LIBRARY_PATH must also be copied if __cleanenv=True. Py_ENABLE_SHARED can be checked in > sysconfig to decide if the environment variable should be copied or not. The name of variable is specific to operating system. Potentially incomplete list based on value of RUNSHARED variable in configure.ac: AIX: LIBPATH HP-UX: SHLIB_PATH Linux, GNU Hurd, *BSD, SunOS: LD_LIBRARY_PATH Mac OS X (with --enable-shared): DYLD_LIBRARY_PATH Mac OS X (with --disable-shared and --enable-framework): DYLD_FRAMEWORK_PATH |
|||
| msg211369 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2014年02月16日 22:58 | |
Serhiy> Interesting, how isolation mode works on Windows or if Python is compiled in shared module? Should we keep these environment variables if the __isolated keyword is used? The __isolated parameter of script_helper._assert_python() don't start Python with an empty environment, it only adds -I to the command line. There is a single test which uses __cleanenv=True: test_hash. Arfrever> The name of variable is specific to operating system. Ah yes, right. It's probably safe to copy all these environment variables without taking care of the operating system. |
|||
| msg238432 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2015年03月18日 13:25 | |
> There is a single test which uses __cleanenv=True: test_hash. The test pass on Windows and this issue is old. I prefer to simplify close it. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:58 | admin | set | github: 64813 |
| 2015年03月18日 13:25:42 | vstinner | set | status: open -> closed resolution: out of date messages: + msg238432 |
| 2014年02月16日 23:03:03 | brian.curtin | set | nosy:
- brian.curtin |
| 2014年02月16日 22:58:10 | vstinner | set | messages: + msg211369 |
| 2014年02月16日 01:57:05 | Arfrever | set | nosy:
+ Arfrever messages: + msg211304 |
| 2014年02月15日 20:46:51 | serhiy.storchaka | set | messages: + msg211295 |
| 2014年02月13日 19:01:12 | serhiy.storchaka | set | stage: needs patch |
| 2014年02月13日 10:51:02 | vstinner | set | messages: + msg211143 |
| 2014年02月13日 10:37:51 | vstinner | set | messages: + msg211141 |
| 2014年02月13日 10:27:26 | vstinner | set | files:
+ cleanenv.patch keywords: + patch messages: + msg211139 |
| 2014年02月13日 10:26:05 | vstinner | create | |