[Python-checkins] cpython (merge 3.3 -> default): Merge #14984: only import pwd on POSIX.

r.david.murray python-checkins at python.org
Wed Sep 18 15:00:24 CEST 2013


http://hg.python.org/cpython/rev/ad9a5ded5cf6
changeset:   85754:ad9a5ded5cf6
parent:      85748:261910257af6
parent:      85753:b8206cb2c4ee
user:        R David Murray <rdmurray at bitdance.com>
date:        Wed Sep 18 08:59:47 2013 -0400
summary:
  Merge #14984: only import pwd on POSIX.

Since we have fine grained import locks in 3.4, I moved the
import to where it is actually needed.

files:
  Lib/netrc.py |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Lib/netrc.py b/Lib/netrc.py
--- a/Lib/netrc.py
+++ b/Lib/netrc.py
@@ -2,7 +2,7 @@
 
 # Module and documentation by Eric S. Raymond, 21 Dec 1998
 
-import io, os, shlex, stat, pwd
+import os, shlex, stat
 
 __all__ = ["netrc", "NetrcParseError"]
 
@@ -90,6 +90,7 @@
                     if os.name == 'posix' and default_netrc:
                         prop = os.fstat(fp.fileno())
                         if prop.st_uid != os.getuid():
+                            import pwd
                             try:
                                 fowner = pwd.getpwuid(prop.st_uid)[0]
                             except KeyError:

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list