]> granicus.if.org Git - python/commitdiff
Merge #14984: only import pwd on POSIX.
authorR David Murray <rdmurray@bitdance.com>
Wed, 18 Sep 2013 12:59:47 +0000 (08:59 -0400)
committerR David Murray <rdmurray@bitdance.com>
Wed, 18 Sep 2013 12:59:47 +0000 (08:59 -0400)
Since we have fine grained import locks in 3.4, I moved the
import to where it is actually needed.

1  2 
Lib/netrc.py

diff --cc Lib/netrc.py
index 050a17468918d413684008d305cd4eb25c09e047,2aa48f32cd508538b8e883c4df7e1a2e7bd9df54..bbb3d23b5433433ec89c07dfb6a7ddbd5027e9ec
@@@ -2,7 -2,9 +2,7 @@@
  
  # Module and documentation by Eric S. Raymond, 21 Dec 1998
  
- import io, os, shlex, stat, pwd
+ import os, shlex, stat
 -if os.name == 'posix':
 -    import pwd
  
  __all__ = ["netrc", "NetrcParseError"]
  
@@@ -90,6 -92,6 +90,7 @@@ class netrc
                      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: