Commit Graph

3570 Commits

Author SHA1 Message Date
Martin v. Löwis fe33d0ba87 Default stat_float_times to true. 2005-01-16 08:57:39 +00:00
Andrew McNamara f69d94f6c0 Moved reader \r and \n processing from the iterator to the state machine -
this allows for better handling of newline characters in quoted fields (and
hopefully resolves Bug 967934).
2005-01-13 11:30:54 +00:00
Skip Montanaro 0af3ade6aa Add strptime() constructor to datetime class. Thanks to Josh Spoerri for
the changes.
2005-01-13 04:12:31 +00:00
Andrew McNamara 5cfd83748a Improve wording of parser error message. 2005-01-12 11:39:50 +00:00
Andrew McNamara 7f2053eff3 Add counting of source iterator lines to the reader object - handy for
user error messages (otherwise difficult to do without instrumenting
the source).
2005-01-12 11:17:16 +00:00
Andrew McNamara 0f0599ddc1 When quoting=QUOTE_NONNUMERIC, the reader now casts unquoted fields
to floats.
2005-01-12 09:45:18 +00:00
Andrew McNamara 5d45a8dc22 Fix logic problem in quoting=csv.QUOTE_ALL, quotechar=None check, add test. 2005-01-12 08:16:17 +00:00
Andrew McNamara c89f284df8 When using QUOTE_NONNUMERIC, we now test for "numericness" with
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).
2005-01-12 07:44:42 +00:00
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 cf0fd5ab29 Add belt and braces check of PyString_AsString return. 2005-01-12 01:16:35 +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 29bf4e44f6 Now that internal dialect type is immutable, and the dialect registry
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.
2005-01-11 04:49:53 +00:00
Andrew McNamara 8c94b42f31 No longer attempt to instantiate python classes describing dialects. This
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.
2005-01-11 02:18:36 +00:00
Andrew McNamara 86625972a1 Allow dialect-describing keywords to be supplied to register_dialect,
record objects of internal dialect type, rather than instances of
python objects.
2005-01-11 01:28:33 +00:00
Andrew McNamara 91b97463cd Factor out the code for making a dialect instance. 2005-01-11 01:07:23 +00:00
Andrew McNamara dbce2618b1 Only set error string when dict lookup found no matching key (was setting
it for all failures, potentially masking other exceptions).
2005-01-10 23:17:35 +00:00
Andrew McNamara a8292636c6 When parsing args that return a single character, treat null string the
same as None.
2005-01-10 12:25:11 +00:00
Andrew McNamara 37d2bdfa76 Where a string is desired, test for PyBaseString_Type derived type,
rather than using PyString_Check/PyUnicode_Check.
2005-01-10 12:22:48 +00:00
Andrew McNamara 77ead87f30 Add missing PyObject_GC_Track and PyObject_GC_UnTrack calls to csv reader and
writer objects (other GC infrastructure already in place).
2005-01-10 02:09:41 +00:00
Andrew McNamara 36a7691c2d Fix parsing of csv files with escapes (escape character previously would be
left in stream).
2005-01-10 01:04:40 +00:00
Andrew McNamara dd3e6cb213 Fix to use PEP7 brace style. 2005-01-07 06:46:50 +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
Andrew McNamara 575a00b575 Delete Reader_getiter and replace with PyObject_SelfIter. 2005-01-06 02:25:41 +00:00
Andrew M. Kuchling 3b585b30c0 [Bug #1083110] calling .flush() on decompress objects causes a segfault due to an uninitialized pointer: fixes the problem and adds a test case 2004-12-28 20:10:48 +00:00
Raymond Hettinger 3a4231dd74 Bug #1087216: datetime module documentation missing critical detail 2004-12-19 20:13:24 +00:00
Andrew MacIntyre a3be258477 fix unterminated comment 2004-12-18 09:51:05 +00:00
Raymond Hettinger 6f5b741a46 SF bug #1086555: refcount problem in syslog 2004-12-16 23:52:04 +00:00
Raymond Hettinger b0900e6a21 SF #1085304: Make array.array pickle-able 2004-12-16 16:23:40 +00:00
Gregory P. Smith 8a6a59c58b fixed compilation against BerkeleyDB 3.2.9 (sf bug # 1077040) 2004-12-16 09:47:28 +00:00
Gregory P. Smith 8b7e917ab2 * Adds support for building against BerkeleyDB 4.3.21
* bumped the module version number up to 4.3.0
2004-12-13 09:51:23 +00:00
Andrew MacIntyre a4a8afb4e1 OS/2 specific fixes related to SF bug # 1003471.
Also revise a related function to minimise file handle/pipe leakage
and improve reliability.
2004-12-12 08:30:51 +00:00
Raymond Hettinger a6b45cc31d Eliminate the deprecated option to return None instead of a tuple of arguments in __reduce__(). 2004-12-07 07:05:57 +00:00
Raymond Hettinger b2594050ea Added optional None arguments to itertools.islice(). 2004-12-05 09:25:51 +00:00
Gustavo Niemeyer 166878f544 Fixing bug #1072259 in SRE. 2004-12-02 16:15:39 +00:00
Michael W. Hudson 02d74f68c6 Hear the #error: change the default value of the mutable_arg argument
to ioctl() and remove the warning when it is not supplied.
2004-11-30 14:31:54 +00:00
Hye-Shik Chang 7a8173a477 Rename a static variable "history_length" to "_history_length".
GNU readline exports a global variable that has such a name already
and the collision makes gcc4 doesn't compile the source.
2004-11-25 04:04:20 +00:00
Marc-André Lemburg a9cadcd41b Correct the handling of 0-termination of PyUnicode_AsWideChar()
and its usage in PyLocale_strcoll().

Clarify the documentation on this.

Thanks to Andreas Degert for pointing this out.
2004-11-22 13:02:31 +00:00
Martin v. Löwis fba7369824 Patch #1050475: Fix various x86_64 build issues
regrtest.py: skip rgbimg and imageop as they are not built on 64-bit systems.
_tkinter.c: replace %.8x with %p for printing pointers.
setup.py: add lib64 into the library directories.
2004-11-13 11:13:35 +00:00
Raymond Hettinger 2c45c9ae57 SF patch 1062495: Modules/zipimport.c does not compile on solaris
(Contributed by Niki W. Waibel.)

Simple renaming to avoid a conflict that prevented compilation on Solaris.
2004-11-10 13:08:35 +00:00
Raymond Hettinger 952f8808b2 SF patch #1062279: deque pickling problems
(Contributed by Dima Dorfman.)

* Support pickling of dictionaries in instances of deque subclasses.
* Support pickling of recursive deques.
2004-11-09 07:27:35 +00:00
Jeremy Hylton 80961f3ca9 Fix apparently trivial buffer overflow (SF bug 1060396).
memset() wrote one past the end of the buffer, which was likely to be unused padding or a yet-to-be-initialized local variable.  This routine is already tested by test_socket.
2004-11-07 14:24:25 +00:00
Raymond Hettinger 7d112df94f Bump-up block size. 2004-11-02 02:11:35 +00:00
Walter Dörwald bb9c739806 Add error checks for the bz2, cStringIO and operator modules.
Add function names to various PyArg_ParseTuple calls in bz2module.c.
2004-11-01 17:10:19 +00:00
Tim Peters bc1d1b80d1 gc_list_move(): Make this truly equivalent to remove+append. While
nothing in gc currently cares, the original coding could screw up if,
e.g., you tried to move a node to the list it's already in, and the node
was already the last in its list.
2004-11-01 16:39:57 +00:00
Tim Peters e2d591847c gc list function cleanup.
Introduced gc_list_move(), which captures the common gc_list_remove() +
gc_list_append() sequence.  In fact, no uses of gc_list_append() remained
(they were all in a gc_list_move() sequence), so commented that one out.

gc_list_merge():  assert that `from` != `to`; that was an implicit
precondition, now verified in a debug build.

Others:  added comments about their purpose.
2004-11-01 01:39:08 +00:00
Tim Peters cc2a866cb7 handle_weakrefs(): Simplification -- there's no need to make a second
pass over the unreachable weakrefs-with-callbacks to unreachable objects.
2004-10-31 22:12:43 +00:00
Tim Peters ead8b7ab30 SF 1055820: weakref callback vs gc vs threads
In cyclic gc, clear weakrefs to unreachable objects before allowing any
Python code (weakref callbacks or __del__ methods) to run.

This is a critical bugfix, affecting all versions of Python since weakrefs
were introduced.  I'll backport to 2.3.
2004-10-30 23:09:22 +00:00
Fred Drake 08ebfec75e some platforms still need offsetof() from structmember.h 2004-10-17 19:36:57 +00:00
Raymond Hettinger a9f6092904 Fix and test weak referencing of itertools.tee objects. 2004-10-17 16:40:14 +00:00
Michael W. Hudson 3079391b8d Just remove the #include of signal.h. That it was C++-commented out
was a mistake of mine in updating patch #975056 (I think).
2004-10-14 13:27:14 +00:00