[Patches] [ python-Patches-703779 ] Fix strange warnings from interpreter if PYTHONSTARTUP used
SourceForge.net
noreply at sourceforge.net
Fri Dec 22 19:15:34 CET 2006
Patches item #703779, was opened at 2003-03-14 13:52
Message generated for change (Comment added) made by akuchling
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=703779&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
>Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Michael Stone (mbrierst)
Assigned to: Nobody/Anonymous (nobody)
Summary: Fix strange warnings from interpreter if PYTHONSTARTUP used
Initial Comment:
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.
----------------------------------------------------------------------
>Comment By: A.M. Kuchling (akuchling)
Date: 2006-12-22 13:15
Message:
Logged In: YES
user_id=11375
Originator: NO
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
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2003-05-22 17:29
Message:
Logged In: YES
user_id=33168
Moving to patches
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=703779&group_id=5470
More information about the Patches
mailing list