[Python-checkins] r73323 - in python/branches/release30-maint: Lib/test/test_cmd_line.py Misc/NEWS PC/getpathp.c

amaury.forgeotdarc python-checkins at python.org
Tue Jun 9 23:31:38 CEST 2009


Author: amaury.forgeotdarc
Date: Tue Jun 9 23:31:38 2009
New Revision: 73323
Log:
Merged revisions 73322 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
 r73322 | amaury.forgeotdarc | 2009年06月09日 23:30:01 +0200 (mar., 09 juin 2009) | 4 lines
 
 #5924: on Windows, a large PYTHONPATH (more than 255 chars) was completely ignored.
 
 Will backport to 3.0.
........
Modified:
 python/branches/release30-maint/ (props changed)
 python/branches/release30-maint/Lib/test/test_cmd_line.py
 python/branches/release30-maint/Misc/NEWS
 python/branches/release30-maint/PC/getpathp.c
Modified: python/branches/release30-maint/Lib/test/test_cmd_line.py
==============================================================================
--- python/branches/release30-maint/Lib/test/test_cmd_line.py	(original)
+++ python/branches/release30-maint/Lib/test/test_cmd_line.py	Tue Jun 9 23:31:38 2009
@@ -169,6 +169,16 @@
 self.assertEqual(rc, 0)
 self.assert_(data.startswith(b'x'), data)
 
+ def test_large_PYTHONPATH(self):
+ with test.support.EnvironmentVarGuard() as env:
+ path1 = "ABCDE" * 100
+ path2 = "FGHIJ" * 100
+ env['PYTHONPATH'] = path1 + os.pathsep + path2
+ p = _spawn_python('-S', '-c', 'import sys; print(sys.path)')
+ stdout, _ = p.communicate()
+ self.assert_(path1.encode('ascii') in stdout)
+ self.assert_(path2.encode('ascii') in stdout)
+
 
 def test_main():
 test.support.run_unittest(CmdLineTest)
Modified: python/branches/release30-maint/Misc/NEWS
==============================================================================
--- python/branches/release30-maint/Misc/NEWS	(original)
+++ python/branches/release30-maint/Misc/NEWS	Tue Jun 9 23:31:38 2009
@@ -12,6 +12,9 @@
 Core and Builtins
 -----------------
 
+- Issue #5924: On Windows, a large PYTHONPATH environment variable
+ (more than 255 characters) would be completely ignored.
+
 - Issue #4547: When debugging a very large function, it was not always
 possible to update the lineno attribute of the current frame.
 
Modified: python/branches/release30-maint/PC/getpathp.c
==============================================================================
--- python/branches/release30-maint/PC/getpathp.c	(original)
+++ python/branches/release30-maint/PC/getpathp.c	Tue Jun 9 23:31:38 2009
@@ -424,8 +424,6 @@
 	wchar_t *buf;
 	size_t bufsz;
 	wchar_t *pythonhome = Py_GetPythonHome();
-	char *_envpath = Py_GETENV("PYTHONPATH");
-	wchar_t wenvpath[MAXPATHLEN+1];
 	wchar_t *envpath = NULL;
 
 #ifdef MS_WINDOWS
@@ -434,13 +432,20 @@
 	wchar_t *userpath = NULL;
 	wchar_t zip_path[MAXPATHLEN+1];
 	size_t len;
-#endif
+
+	if (!Py_IgnoreEnvironmentFlag) {
+		envpath = _wgetenv(L"PYTHONPATH");
+	}
+#else
+	char *_envpath = Py_GETENV("PYTHONPATH");
+	wchar_t wenvpath[MAXPATHLEN+1];
 	if (_envpath) {
 		size_t r = mbstowcs(wenvpath, _envpath, MAXPATHLEN+1);
 		envpath = wenvpath;
 		if (r == (size_t)-1 || r >= MAXPATHLEN)
 			envpath = NULL;
 	}
+#endif
 
 	get_progpath();
 	/* progpath guaranteed 0円 terminated in MAXPATH+1 bytes. */


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /