Issue 703779: Fix strange warnings from interpreter if PYTHONSTARTUP used (original) (raw)
Issue703779
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.
This issue has been migrated to GitHub: https://github.com/python/cpython/issues/38163
classification
Title: | Fix strange warnings from interpreter if PYTHONSTARTUP used | ||
---|---|---|---|
Type: | Stage: | ||
Components: | Interpreter Core | Versions: | Python 2.5 |
process
Status: | closed | Resolution: | accepted |
---|---|---|---|
Dependencies: | Superseder: | ||
Assigned To: | Nosy List: | akuchling, georg.brandl, mbrierst, nnorwitz | |
Priority: | normal | Keywords: | patch |
Created on 2003-03-14 18:52 by mbrierst, last changed 2022-04-10 16:07 by admin. This issue is now closed.
Files | |||
---|---|---|---|
File name | Uploaded | Description | Edit |
patchwarnprob | mbrierst,2003-03-14 18:53 |
Messages (4) | ||
---|---|---|
msg43046 - (view) | Author: Michael Stone (mbrierst) | Date: 2003-03-14 18:52 |
If the PYTHONSTARTUP environment variable is used, warnings will look strange. The warnings module uses __file__ to try to find the line causing the warning and print it out. __file__ is never reset after being set when processing the startup file. The attached patch fixes this by changing PyRun_SimpleFileExFlags to unset __file__ in the __main__ module dictionary entry after running a file, when it had been set by the routine in the first place. | ||
msg43047 - (view) | Author: Neal Norwitz (nnorwitz) * ![]() |
Date: 2003-05-22 21:29 |
Logged In: YES user_id=33168 Moving to patches | ||
msg43048 - (view) | Author: A.M. Kuchling (akuchling) * ![]() |
Date: 2006-12-22 18:15 |
The patch looks reasonable, and should be applied. I don't think this API change (no longer setting __file__) matters to callers of PyRun_SimpleFileExFlags | ||
msg43049 - (view) | Author: Georg Brandl (georg.brandl) * ![]() |
Date: 2007-03-07 00:40 |
Committed as rev. 54189. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-10 16:07:39 | admin | set | github: 38163 |
2003-03-14 18:52:32 | mbrierst | create |