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 eric.snow
Recipients belopolsky, brett.cannon, christian.heimes, eric.snow, facundobatista, georg.brandl, ncoghlan, python-dev, stocker81
Date 2012-08-24.17:03:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1345827797.5.0.815979361234.issue2051@psf.upfronthosting.co.za>
In-reply-to
Content
My patch was very similar.  _cache_bytecode() is a good addition.  Good point about the cache, too.

I'm not convinced that source_path is the right thing to add to the API (even just for SourceFileLoader).  I would have thought mode would have been more appropriate:

  def set_data(self, path, data, *, mode=0o666):

Then the "mode = _os.stat(source_path).st_mode" bit would get moved to _cache_bytecode().

My reasoning is that set_data() is useful to write any data relative to the Loader.  The concrete use case in the stdlib is for writing the .pyc files.  Otherwise I'm not certain why the idea of "source_path" should be associated with set_data().  On the other hand, the idea of "mode" likewise may not be univeral enough to enshrine in the API, but I'd think it's more so than source_path.

I was going to ask about backward compatability, but then I realized that SourceFileLoader is new in 3.3 (SourceLoader is new in 3.2).  I'm also wondering why set_data() is not a part of the FileLoader API, but that's a question for another time (and version).  :)
History
Date User Action Args
2012-08-24 17:03:17eric.snowsetrecipients: + eric.snow, brett.cannon, georg.brandl, facundobatista, ncoghlan, belopolsky, christian.heimes, stocker81, python-dev
2012-08-24 17:03:17eric.snowsetmessageid: <1345827797.5.0.815979361234.issue2051@psf.upfronthosting.co.za>
2012-08-24 17:03:17eric.snowlinkissue2051 messages
2012-08-24 17:03:16eric.snowcreate