[Patches] [ python-Patches-1630118 ] Patch to add tempfile.SpooledTemporaryFile (for #415692)

SourceForge.net noreply at sourceforge.net
Mon Jan 8 09:26:44 CET 2007


Patches item #1630118, was opened at 2007-01-07 20:36
Message generated for change (Comment added) made by arigo
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1630118&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: Library (Lib)
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Dustin J. Mitchell (djmitche)
Assigned to: Nobody/Anonymous (nobody)
Summary: Patch to add tempfile.SpooledTemporaryFile (for #415692)

Initial Comment:
Attached please find a patch that adds a SpooledTemporaryFile class to tempfile, along with the corresponding documentation (optimistically labeling the feature as added in Python 2.5) and some test cases.

----------------------------------------------------------------------

>Comment By: Armin Rigo (arigo)
Date: 2007-01-08 08:26

Message:
Logged In: YES 
user_id=4771
Originator: NO

The __getattr__ magic makes the following kind of code fail with
SpooledTemporaryFile:

  f = SpooledTemporaryFile(max_size=something)
  rd = f.read
  wr = f.write
  for x in y:
      ...use rd(size) and wr(data)...

The problem is that the captured 'f.read' method is the one from the
StringIO instance, even after the write() rolled the file over to disk. 
Given that capturing bound methods is a semi-official speed hack advertised
in some respected places, we might have to be careful about it.  About such
matters I am biased towards first getting it right and then getting it
fast...

Also, Python 2.5 is already out, so this will probably be a 2.6 addition.

----------------------------------------------------------------------

Comment By: Dustin J. Mitchell (djmitche)
Date: 2007-01-07 20:37

Message:
Logged In: YES 
user_id=7446
Originator: YES

File Added: SpooledTemporaryFile.patch

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1630118&group_id=5470


More information about the Patches mailing list