comparison roundup/cgi/client.py @ 8555:98fb176224fc

bug(perf): move import tempfile to top of file
author John Rouillard <rouilj@ieee.org>
date Mon, 06 Apr 2026 01:27:39 -0400
parents 92aecf6c5c09
children dd0445649244
comparison
equal deleted inserted replaced
8554:92aecf6c5c09 8555:98fb176224fc
12 import os 12 import os
13 import re 13 import re
14 import socket 14 import socket
15 import stat 15 import stat
16 import sys 16 import sys
17 import tempfile
17 import time 18 import time
18 from email.mime.multipart import MIMEMultipart 19 from email.mime.multipart import MIMEMultipart
19 from traceback import format_exc 20 from traceback import format_exc
20 21
21 try: 22 try:
277 3. Under python 2, str and binary are interchangable, not so 278 3. Under python 2, str and binary are interchangable, not so
278 under 3. 279 under 3.
279 ''' 280 '''
280 def make_file(self, mode=None): 281 def make_file(self, mode=None):
281 ''' work around https://bugs.python.org/issue27777 ''' 282 ''' work around https://bugs.python.org/issue27777 '''
282 import tempfile
283 if self.length >= 0: 283 if self.length >= 0:
284 return tempfile.TemporaryFile("wb+") 284 return tempfile.TemporaryFile("wb+")
285 return super(BinaryFieldStorage, self).make_file() 285 return super(BinaryFieldStorage, self).make_file()
286 286
287 287

Roundup Issue Tracker: http://roundup-tracker.org/