summaryrefslogtreecommitdiffstats
path: root/Modules/_csv.c
Commit message (Collapse)AuthorAgeFilesLines
* #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and ↵Christian Heimes2007-12-191-2/+2
| | | | Py_REFCNT. Macros for b/w compatibility are available.
* PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis2007-07-211-8/+5
| | | | | backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
* Fix problems found by Coverity.Neal Norwitz2006-05-101-0/+2
| | | | | | | | | | | | | longobject.c: also fix an ssize_t problem <a> could have been NULL, so hoist the size calc to not use <a>. _ssl.c: under fail: self is DECREF'd, but it would have been NULL. _elementtree.c: delete self if there was an error. _csv.c: I'm not sure if lineterminator could have been anything other than a string. However, other string method calls are checked, so check this one too.
* Use Py_VISIT in all tp_traverse methods, instead of traversing manually orThomas Wouters2006-04-151-20/+15
| | | | | | | | using a custom, nearly-identical macro. This probably changes how some of these functions are compiled, which may result in fractionally slower (or faster) execution. Considering the nature of traversal, visiting much of the address space in unpredictable patterns, I'd argue the code readability and maintainability is well worth it ;P
* Remove partial change (don't edit, commit and think at the same time :P)Thomas Wouters2006-04-151-1/+0
|
* Re-instate backward compatibility by defining Py_CLEAR if it isn'tThomas Wouters2006-04-151-0/+14
| | | | available.
* Use Py_CLEAR instead of in-place DECREF/XDECREF or custom macros, forThomas Wouters2006-04-151-10/+5
| | | | tp_clear methods.
* docstring tweakFredrik Lundh2006-04-041-1/+1
|
* More unconsting.Martin v. Löwis2006-02-271-1/+1
|
* Add const to several API functions that take char *.Jeremy Hylton2005-12-101-1/+1
| | | | | | | | | | | | | | | | | | | In C++, it's an error to pass a string literal to a char* function without a const_cast(). Rather than require every C++ extension module to put a cast around string literals, fix the API to state the const-ness. I focused on parts of the API where people usually pass literals: PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type slots, etc. Predictably, there were a large set of functions that needed to be fixed as a result of these changes. The most pervasive change was to make the keyword args list passed to PyArg_ParseTupleAndKewords() to be a const char *kwlist[]. One cast was required as a result of the changes: A type object mallocs the memory for its tp_doc slot and later frees it. PyTypeObject says that tp_doc is const char *; but if the type was created by type_new(), we know it is safe to cast to char *.
* Michael Hudson pointed out that the Dialect_Type object isn't INCREF'd. WhySkip Montanaro2005-06-151-0/+1
| | | | | this worked is a bit mystical. Perhaps it never gets freed because the object just happens never to be DECREF'd (but that seems unlikely).
* Leak fix from Michael Hudson. Fix memory leak when dialect doesn'tSkip Montanaro2005-06-151-0/+2
| | | | validate. Closes 1220242.
* Moved reader \r and \n processing from the iterator to the state machine -Andrew McNamara2005-01-131-97/+75
| | | | | this allows for better handling of newline characters in quoted fields (and hopefully resolves Bug 967934).
* Improve wording of parser error message.Andrew McNamara2005-01-121-2/+2
|
* Add counting of source iterator lines to the reader object - handy forAndrew McNamara2005-01-121-0/+4
| | | | | user error messages (otherwise difficult to do without instrumenting the source).
* When quoting=QUOTE_NONNUMERIC, the reader now casts unquoted fieldsAndrew McNamara2005-01-121-30/+59
| | | | to floats.
* Fix logic problem in quoting=csv.QUOTE_ALL, quotechar=None check, add test.Andrew McNamara2005-01-121-1/+1
|
* When using QUOTE_NONNUMERIC, we now test for "numericness" withAndrew McNamara2005-01-121-82/+58
| | | | | | | | PyNumber_Check, rather than trying to convert to a float. Reimplemented writer - now raises exceptions when it sees a quotechar but neither doublequote or escapechar are set. Doublequote results are now more consistent (eg, single quote should generate """", rather than "", which is ambiguous).
* Rename csv.set_field_limit to csv.field_size_limit (since it both sets andAndrew McNamara2005-01-121-6/+6
| | | | gets).
* Add belt and braces check of PyString_AsString return.Andrew McNamara2005-01-121-4/+5
|
* Set an upper limit on the size of the field buffer, raise an exceptionAndrew McNamara2005-01-111-30/+77
| | | | | | | 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.
* Now that internal dialect type is immutable, and the dialect registryAndrew McNamara2005-01-111-29/+40
| | | | | | | only contains instances of the dialect type, we can refer directly to the dialect instances rather than creating new ones. In other words, if the dialect comes from the registry, and we apply no further modifications, the reader/writer can use the dialect object directly.
* No longer attempt to instantiate python classes describing dialects. ThisAndrew McNamara2005-01-111-37/+6
| | | | | | was done because we were previously performing validation of the dialect from python, but this is now down within the C module. Also, the method we were using to detect classes did not work with new-style classes.
* Allow dialect-describing keywords to be supplied to register_dialect,Andrew McNamara2005-01-111-27/+11
| | | | | record objects of internal dialect type, rather than instances of python objects.
* Factor out the code for making a dialect instance.Andrew McNamara2005-01-111-18/+22
|
* Only set error string when dict lookup found no matching key (was settingAndrew McNamara2005-01-101-3/+6
| | | | it for all failures, potentially masking other exceptions).
* When parsing args that return a single character, treat null string theAndrew McNamara2005-01-101-1/+1
| | | | same as None.
* Where a string is desired, test for PyBaseString_Type derived type,Andrew McNamara2005-01-101-15/+6
| | | | rather than using PyString_Check/PyUnicode_Check.
* Add missing PyObject_GC_Track and PyObject_GC_UnTrack calls to csv reader andAndrew McNamara2005-01-101-0/+4
| | | | writer objects (other GC infrastructure already in place).
* Fix parsing of csv files with escapes (escape character previously would beAndrew McNamara2005-01-101-8/+0
| | | | left in stream).
* Fix to use PEP7 brace style.Andrew McNamara2005-01-071-2/+4
|
* Improved the implementation of the internal "dialect" type. The newAndrew McNamara2005-01-071-187/+239
| | | | | implementation features better error reporting, and better compliance with the PEP.
* Delete Reader_getiter and replace with PyObject_SelfIter.Andrew McNamara2005-01-061-8/+1
|
* Quote \r\n correctly, remove random indentation (patch #1009384). ThanksJohannes Gijsbers2004-08-151-2/+2
| | | | Cherniavsky Beni!
* Use PyArg_UnpackTuple() where possible.Raymond Hettinger2004-06-201-4/+4
|
* doc nitSkip Montanaro2003-12-021-1/+2
|
* Fix potential leaks identified by Neal Norwitz.Andrew McNamara2003-06-091-0/+8
|
* Make readers and writers participate in garbage collection.Jeremy Hylton2003-04-141-14/+71
| | | | Fix memory leak in dialect_init().
* Must declare vrbls at the tops of blocks in C89 (wouldn't compile).Tim Peters2003-04-131-1/+2
|
* use PyModule_Add{Int,String}Constant() where appropriateSkip Montanaro2003-04-121-12/+6
| | | | (thanks to Neal Norwitz for the code review, BTW)
* tighten up string checksSkip Montanaro2003-04-121-17/+18
| | | | make csv_{get,unregister}_dialect METH_O functions to avoid PyArg_ParseTuple
* add writerows docstringSkip Montanaro2003-04-121-6/+24
| | | | conditionally exclude Unicode functions
* typoSkip Montanaro2003-04-111-1/+1
|
* typoSkip Montanaro2003-04-111-1/+1
|
* zap commented out bit of codeSkip Montanaro2003-04-111-2/+1
|
* add comment about 2.2 compatibilitySkip Montanaro2003-03-231-1/+13
| | | | dump empty TODO comment
* Squash compiler wng about signed-vs-unsigned mismatch.Tim Peters2003-03-211-1/+1
|
* new CSV file processing module - see PEP 305Skip Montanaro2003-03-201-0/+1465