[New-bugs-announce] [issue24691] out of memory in distutils.upload with large files

Jan Stürtz report at bugs.python.org
Thu Jul 23 11:44:12 CEST 2015

New submission from Jan Stürtz:

We tried to upload a very large (350MB) bdist egg via distutils to our internal package server. 
And received following crash.

Traceback (most recent call last):
  File "setup.py", line 1, in <module>
    import os
  File "C:\devel\cdb\10.1.tag\cdb\python\cdb\comparch\pkgtools.py", line 120, in setup
    def setup(**kwargs):
  File "C:\devel\cdb\10.1.tag\win32\debug\img\lib\distutils\core.py", line 60, in setup
    def setup(**attrs):
  File "C:\devel\cdb\10.1.tag\win32\debug\img\lib\distutils\dist.py", line 947, in run_commands
    def run_commands(self):
  File "C:\devel\cdb\10.1.tag\win32\debug\img\lib\distutils\dist.py", line 957, in run_command
    def run_command(self, command):
  File "C:\devel\cdb\10.1.tag\win32\debug\img\lib\distutils\command\upload.py", line 56, in run
    def run(self):
  File "C:\devel\cdb\10.1.tag\win32\debug\img\lib\distutils\command\upload.py", line 154, in upload_file
    body.write('\r\nContent-Disposition: form-data; name="%s"' % key)
MemoryError: out of memory

A patch could be very easy using tempfile.SpooledTemporaryFile()

components: Distutils
messages: 247179
nosy: Jan.Stürtz, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: out of memory in distutils.upload with large files
type: crash
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list