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 belopolsky
Recipients belopolsky, eric.araujo, vstinner
Date 2010-11-06.16:00:11
SpamBayes Score 2.7843524e-05
Marked as misclassified No
Message-id <1289059215.52.0.745533650542.issue10335@psf.upfronthosting.co.za>
In-reply-to
Content
+1 on adding the function.

Note that it is useful for opening any text file with an encoding cookie, not only python source code, so "tokenize.open()" sounds attractive.

Once we are at it, I would like to factor out and document code that extracts the cookie from a decoded string.  This functionality is useful for tools that produce annotated source code and want to preserve source encoding in their output.  See issue10329.

Also, to answer Victor's comment on issue10329, msg120601, while using this function simplifies dealing with source files in trace module, it does not solve all the issues: source file will still be opened separately in linecache.gettines() and find_executable_linenos() and  find_executable_linenos() still does not respect __loader__ interface.  See issue 10342.
History
Date User Action Args
2010-11-06 16:00:15belopolskysetrecipients: + belopolsky, vstinner, eric.araujo
2010-11-06 16:00:15belopolskysetmessageid: <1289059215.52.0.745533650542.issue10335@psf.upfronthosting.co.za>
2010-11-06 16:00:12belopolskylinkissue10335 messages
2010-11-06 16:00:11belopolskycreate