Commit Graph

15 Commits

Author SHA1 Message Date
Andrew McNamara 31d8896ee2 Rename csv.set_field_limit to csv.field_size_limit (since it both sets and
gets).
2005-01-12 03:45:10 +00:00
Andrew McNamara e4d05c4f93 Set an upper limit on the size of the field buffer, raise an exception
when this limit is reached. Limit defaults to 128k, and is changed
by module set_field_limit() method. Previously, an unmatched quote
character could result in the entire file being read into the field
buffer, potentially exhausting virtual memory.
2005-01-11 07:32:02 +00:00
Andrew McNamara 7130ff5eb9 Replace python-coded validation of csv dialect with a call to the C
dialect type (which has a better idea of what is and isn't valid).
2005-01-11 02:22:47 +00:00
Andrew McNamara 1196cf185c Improved the implementation of the internal "dialect" type. The new
implementation features better error reporting, and better compliance
with the PEP.
2005-01-07 04:42:45 +00:00
Skip Montanaro f26285ce0b add a couple missing docstrings 2005-01-05 06:54:58 +00:00
Skip Montanaro dffeed3ffa Make the fieldnames argument optional in the DictReader. If self.fieldnames
is None, the next row read is used as the fieldnames.  In the common case,
this means the programmer doesn't need to know the fieldnames ahead of time.
The first row of the file will be used.  In the uncommon case, this means
the programmer can set the reader's fieldnames attribute to None at any time
and have the next row read as the next set of fieldnames, so a csv file can
contain several "sections", each with different fieldnames.
2003-10-03 14:03:01 +00:00
Skip Montanaro 3f7a94824e **kwds arg was missing from __init__ for Dict{Reader,Writer} classes.
will backport.
2003-09-06 19:52:12 +00:00
Fred Drake 6f7b213dda use the long names for re compilation options; this makes it easier to
figure out what the code is doing
2003-09-02 16:01:07 +00:00
Raymond Hettinger f31cb0cbcf One more multiple exception catch should be in a tuple. 2003-06-12 04:05:00 +00:00
Raymond Hettinger abe14e6f04 The multiple exception catch should be in a tuple. 2003-06-12 03:59:17 +00:00
Raymond Hettinger 39a5592001 SF Patch #744104: Remove eval() from csv
Eliminates the eval() step in the csv module resulting in better
security, more clarity, and a little speed.

The idea is to make successive attempts to coerce the string to
a python type:
    int(s), long(s), float(s), etc.

As a by-product, eliminates a bare 'except' statement.
2003-06-12 03:01:55 +00:00
Skip Montanaro 7789237331 * Correct Sniffer doc to correspond to the implementation.
* Add optional delimiters arg to Sniffer.sniff() which restricts the set of
  candidate field delimiters.
2003-05-19 15:33:36 +00:00
Skip Montanaro 1448d4719c rework Sniffer api significantly 2003-04-25 14:47:16 +00:00
Fred Drake 7c852f33a2 Attempt to deal with some obvious errors in the code. These were all
due to using a single module-level namespace where multiple namespaces
were used before.

There *really* need to be tests for the sniffer stuff.  This could
have been avoided.

Skip, please review, and add sniffer tests!
2003-04-25 14:27:00 +00:00
Skip Montanaro 04ae7056cf cvs is going to be a module again 2003-04-24 20:21:31 +00:00