[ python-Bugs-1046077 ] urllib2: better import ftplib and gopherlib etc late

SourceForge.net noreply at sourceforge.net
Sun Nov 7 15:42:36 CET 2004


Bugs item #1046077, was opened at 2004-10-13 09:41
Message generated for change (Comment added) made by jhylton
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1046077&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Robert Kiendl (kxroberto)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib2: better import ftplib and gopherlib etc late

Initial Comment:
I've always trouble shrinking a py2exe'd package,
because of this. its also a speed issue. urllib2 is
most time used only with http(s) ...?

*** urllib2_old.py	Tue May 11 16:14:34 2004
--- urllib2.py	Wed Oct 13 11:32:44 2004
*************** f = urllib2.urlopen('http://www.python.o
*** 88,95 ****
  # check digest against correct (i.e. non-apache)
implementation
  
  import base64
- import ftplib
- import gopherlib
  import httplib
  import inspect
  import md5
--- 88,93 ----
*************** class FileHandler(BaseHandler):
*** 1009,1014 ****
--- 1007,1013 ----
  
  class FTPHandler(BaseHandler):
      def ftp_open(self, req):
+         import ftplib
          host = req.get_host()
          if not host:
              raise IOError, ('ftp error', 'no host given')
*************** class CacheFTPHandler(FTPHandler):
*** 1110,1115 ****
--- 1109,1115 ----
  
  class GopherHandler(BaseHandler):
      def gopher_open(self, req):
+         import gopherlib
          host = req.get_host()
          if not host:
              raise GopherError('no host given')


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

>Comment By: Jeremy Hylton (jhylton)
Date: 2004-11-07 14:42

Message:
Logged In: YES 
user_id=31392

I'd rather not move imports from their typical place for a
small performance chance in an unusual use case.


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

Comment By: Terry J. Reedy (tjreedy)
Date: 2004-10-15 22:55

Message:
Logged In: YES 
user_id=593130

Since you have a patch, this should have been submitted as 
a patch rather than a bug.  In any case, the patch needs to 
be submitted as separate file

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

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


More information about the Python-bugs-list mailing list