[issue10515] csv sniffer does not recognize quotes at the end of line

Skip Montanaro report at bugs.python.org
Sun Dec 19 15:19:41 CET 2010


Skip Montanaro <skip at pobox.com> added the comment:

I get two failures with David's latest patch.  Abstracting from
a lightly modified patch:

    sample was: 'a,b,"c,d"\r\ne,f,g', got: '', expected: ','
    sample was: '"a,b,c,d"\r\ne', got: '\r', expected: ''

In both cases I think the expected delimiter should be comma.
The code or regular expressions need to be fixed for the first
failure.  As I indicated earlier \r\n should never be split.
Also, for a single column CSV file I think the expected/default
delimiter should be a comma.

That said, does anyone think I should change the expected delimiter
for the first two tests at this point for 2.7?  The inputs and
expected delimiters are

    ('abcde', 'e'),
    ('a', 'e'),

Both seem wrong to me, but I understand that the behavior of 2.7
probably shouldn't change to accommodate fixing broken test cases.

I'm also a bit concerned about this construct:

    locals()['some name'] = f

I thought locals() wasn't guaranteed to actually refer to a 
persistent dictionary.  That is, it's fine if locals() builds
its dictionary on-the-fly then discards it.  Do we know for
a fact that when called during a class definition that locals()
returns the class's dictionary?  (This might only matter if
other dialects of Python try to reuse test_csv.py.)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10515>
_______________________________________


More information about the Python-bugs-list mailing list