homepage

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.

Author vstinner
Recipients belopolsky, doerwalter, ncoghlan, pitrou, vstinner
Date 2010年11月06日.10:51:00
SpamBayes Score 2.2656854e-10
Marked as misclassified No
Message-id <201011061150.54315.victor.stinner@haypocalc.com>
In-reply-to <1289016600.21.0.75147972422.issue10329@psf.upfronthosting.co.za>
Content
> 1. It opens the source file one more time. This is probably acceptable
> because existing code already opens it at least four times when -m (show
> missing) option is selected. (Twice in find_executable_linenos() and
> twice in linecache.getlines(). Fixing that would require refactoring of
> linecache code.
Create a function like linecache.getencoding() seems to be overkill.
I created issue #10335 to add a function tokenize.open_python(): open a Python 
script in read mode without opening the file twice and get the encoding with 
detect_encoding(). This issue is more generic than trying to optimize the 
trace module.
> 2. This will not work for source code not stored in a file, but provided by
> a __loader__.get_source() method. However it looks like trace will not
> work at all in this case, so fixing that is a separate issue.
For this case, I think that we can add a try/except IOError with a fallback to 
encoding = 'utf-8'.
History
Date User Action Args
2010年11月06日 10:51:04vstinnersetrecipients: + vstinner, doerwalter, ncoghlan, belopolsky, pitrou
2010年11月06日 10:51:01vstinnerlinkissue10329 messages
2010年11月06日 10:51:00vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /