]> granicus.if.org Git - python/commitdiff
Fix bootstrap issue by importing the cgi module lazily
authorAntoine Pitrou <solipsis@pitrou.net>
Sun, 22 Dec 2013 18:37:17 +0000 (19:37 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Sun, 22 Dec 2013 18:37:17 +0000 (19:37 +0100)
Lib/distutils/config.py

index 7e10fff9d9d32f44d335370350c6a984d96debd8..106e1465988128b8937df255feee76e3c3bd1137 100644 (file)
@@ -3,7 +3,6 @@
 Provides the PyPIRCCommand class, the base class for the command classes
 that uses .pypirc in the distutils.command package.
 """
-import cgi
 import os
 from configparser import ConfigParser
 
@@ -104,6 +103,7 @@ class PyPIRCCommand(Command):
 
     def _read_pypi_response(self, response):
         """Read and decode a PyPI HTTP response."""
+        import cgi
         content_type = response.getheader('content-type', 'text/plain')
         encoding = cgi.parse_header(content_type)[1].get('charset', 'ascii')
         return response.read().decode(encoding)