[Python-checkins] r51138 - python/trunk/Objects/abstract.c

georg.brandl python-checkins at python.org
Tue Aug 8 13:56:21 CEST 2006


Author: georg.brandl
Date: Tue Aug  8 13:56:21 2006
New Revision: 51138

Modified:
   python/trunk/Objects/abstract.c
Log:
Remove "non-mapping" and "non-sequence" from TypeErrors raised by
PyMapping_Size and PySequence_Size.

Because len() tries first sequence, then mapping size, it will always
raise a "non-mapping object has no len" error which is confusing.



Modified: python/trunk/Objects/abstract.c
==============================================================================
--- python/trunk/Objects/abstract.c	(original)
+++ python/trunk/Objects/abstract.c	Tue Aug  8 13:56:21 2006
@@ -1114,7 +1114,7 @@
 	if (m && m->sq_length)
 		return m->sq_length(s);
 
-	type_error("non-sequence object of type '%.200s' has no len()", s);
+	type_error("object of type '%.200s' has no len()", s);
 	return -1;
 }
 
@@ -1705,7 +1705,7 @@
 	if (m && m->mp_length)
 		return m->mp_length(o);
 
-	type_error("non-mapping object of type '%.200s' has no len()", o);
+	type_error("object of type '%.200s' has no len()", o);
 	return -1;
 }
 


More information about the Python-checkins mailing list