[Python-checkins] r51765 - in python/trunk: Misc/NEWS Python/import.c

georg.brandl python-checkins at python.org
Wed Sep 6 08:09:31 CEST 2006


Author: georg.brandl
Date: Wed Sep 6 08:09:31 2006
New Revision: 51765
Modified:
 python/trunk/Misc/NEWS
 python/trunk/Python/import.c
Log:
Bug #1550983: emit better error messages for erroneous relative
imports (if not in package and if beyond toplevel package).
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Wed Sep 6 08:09:31 2006
@@ -12,6 +12,9 @@
 Core and builtins
 -----------------
 
+- Bug #1550983: emit better error messages for erroneous relative
+ imports (if not in package and if beyond toplevel package).
+
 - Overflow checking code in integer division ran afoul of new gcc
 optimizations. Changed to be more standard-conforming.
 
Modified: python/trunk/Python/import.c
==============================================================================
--- python/trunk/Python/import.c	(original)
+++ python/trunk/Python/import.c	Wed Sep 6 08:09:31 2006
@@ -2114,7 +2114,7 @@
 		size_t len;
 		if (lastdot == NULL && level > 0) {
 			PyErr_SetString(PyExc_ValueError,
-					"Relative importpath too deep");
+				"Attempted relative import in non-package");
 			return NULL;
 		}
 		if (lastdot == NULL)
@@ -2133,7 +2133,8 @@
 		char *dot = strrchr(buf, '.');
 		if (dot == NULL) {
 			PyErr_SetString(PyExc_ValueError,
-					"Relative importpath too deep");
+				"Attempted relative import beyond "
+				"toplevel package");
 			return NULL;
 		}
 		*dot = '0円';


More information about the Python-checkins mailing list

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