[pypy-svn] r61447 - pypy/trunk/pypy/lib

antocuni at codespeak.net antocuni at codespeak.net
Thu Jan 29 14:18:15 CET 2009


Author: antocuni
Date: Thu Jan 29 14:18:14 2009
New Revision: 61447

Modified:
   pypy/trunk/pypy/lib/_csv.py
Log:
cpython makes a difference between field_size_limit() and
field_size_limit(None).  This fixes one test in test_csv



Modified: pypy/trunk/pypy/lib/_csv.py
==============================================================================
--- pypy/trunk/pypy/lib/_csv.py	(original)
+++ pypy/trunk/pypy/lib/_csv.py	Thu Jan 29 14:18:14 2009
@@ -512,20 +512,19 @@
     The \"fileobj\" argument can be any object that supports the file API."""
     return Writer(*args, **kwargs)
 
-def field_size_limit(limit=None):
+
+undefined = object()
+def field_size_limit(limit=undefined):
     """Sets an upper limit on parsed fields.
     csv.field_size_limit([limit])
 
     Returns old limit. If limit is not given, no new limit is set and
     the old limit is returned"""
 
-    if not isinstance(limit, (long, int)):
-        raise TypeError("limit must be an integer")
-
     global _field_limit
     old_limit = _field_limit
     
-    if limit is not None:
+    if limit is not undefined:
         if not isinstance(limit, (int, long)):
             raise TypeError("int expected, got %s" %
                             (limit.__class__.__name__,))



More information about the Pypy-commit mailing list