Commit Graph

48 Commits

Author SHA1 Message Date
Tim Peters e7c053233f sizeof(char) is 1, by definition, so get rid of that expression in
places it's just noise.
2004-06-27 17:24:49 +00:00
Raymond Hettinger 6ec099658a SF patch #907403: Improvements to cStringIO.writelines()
The writelines() method now accepts any iterable argument and writes
the lines one at a time rather than using ''.join(lines) followed by
a single write.  Results in considerable memory savings and makes
the method suitable for use with generator expressions.
2004-03-08 18:17:31 +00:00
Raymond Hettinger bc72c5ae8b Speed-up the joiner call by avoiding Py_BuildValue(). 2004-02-27 10:30:49 +00:00
Raymond Hettinger 8ae4689657 Simplify and speedup uses of Py_BuildValue():
* Py_BuildValue("(OOO)",a,b,c)  -->  PyTuple_Pack(3,a,b,c)
* Py_BuildValue("()",a)         -->  PyTuple_New(0)
* Py_BuildValue("O", a)         -->  Py_INCREF(a)
2003-10-12 19:09:37 +00:00
Skip Montanaro eb2f0612e1 reverting to 2.41 version (distinct tp_names) - will add verbiage to the
docs
2003-08-11 14:51:15 +00:00
Skip Montanaro e138828d03 shit - just change the visible name, not the comments - strictly speaking,
the tp_name is not correct, but what's exposed to users is known visibly as
"StringIO", not "StringI" or "StringO".
2003-08-11 13:15:11 +00:00
Skip Montanaro 4a0d3d2e40 typos 2003-08-11 13:09:12 +00:00
Raymond Hettinger 5475f2394a SF bug #770485: cStringIO does not set closed attr 2003-08-08 12:20:03 +00:00
Raymond Hettinger 352f9477da SF patch 695710: fix bug 678519: cStringIO self iterator
(requested by GvR. patch contributed by Michael Stone)
2003-04-24 15:50:11 +00:00
Raymond Hettinger 36cd2bf459 SF patch 660559: Use METH_O and METH_NOARGS where possible
Simplify code and speed access by using PyArg_UnpackTuple, METH_O and
METH_NOARGS in three modules that can benefit from it.
2003-01-03 08:24:58 +00:00
Guido van Rossum 674deb2eea SF bug 601775 - some int results that should be bool. 2002-09-01 15:06:28 +00:00
Mark Hammond fe51c6d66e Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototype
for Py_Main().

Thanks to Kalle Svensson and Skip Montanaro for the patches.
2002-08-02 02:27:13 +00:00
Martin v. Löwis 14f8b4cfcb Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
Guido van Rossum a883a3d5fd See discussion at SF bug 547537.
Unicode objects are currently taken as binary data by the write()
method.  This is not what Unicode users expect, nor what the
StringIO.py code does.  Until somebody adds a way to specify binary or
text mode for cStringIO objects, change the format string to use "t#"
instead of "s#", so that it will request the "text buffer" version.
This will try the default encoding for Unicode objects.

This is *not* a 2.2 bugfix (since it *is* a semantic change).
2002-04-29 13:54:48 +00:00
Guido van Rossum 2e1c09c1fd Removed old Digital Creations copyright/license notices (with
permission from Paul Everitt).  Also removed a few other references to
Digital Creations and changed the remaining ones to Zope Corporation.
2002-04-04 17:52:50 +00:00
Jeremy Hylton b189b07dcc Fix SF bug #526518
The doc string for cStringIO suggested that str() of a StringIO object
was equivalent to getvalue().  This was never true, so repair the doc
string.  (doctest would have helped here.)

Bug fix candidate for any past versions.
2002-03-08 17:17:33 +00:00
Guido van Rossum 146483964e Patch supplied by Burton Radons for his own SF bug #487390: Modifying
type.__module__ behavior.

This adds the module name and a dot in front of the type name in every
type object initializer, except for built-in types (and those that
already had this).  Note that it touches lots of Mac modules -- I have
no way to test these but the changes look right.  Apologies if they're
not.  This also touches the weakref docs, which contains a sample type
object initializer.  It also touches the mmap test output, because the
mmap type's repr is included in that output.  It touches object.h to
put the correct description in a comment.
2001-12-08 18:02:58 +00:00
Guido van Rossum 2f09812efa O_cwrite(): rewrote for clarity, replacing all the (Oobject *)self
casts with a variable oself that has the proper type.  A smart
compiler may put this thing into a register.

(I'm not sure what good this does except satisfy my desire to
understand this function; I got a report about an uninitialized read
from Insure++ about this function and it hurt my eyes to even look at
it.  I gotta run away or I'll get tempted to reformat the entire
file...)
2001-12-07 20:20:28 +00:00
Marc-André Lemburg e47df7a211 StringIO patch #462596: let's [c]StringIO accept read buffers on
input to .write() too.
2001-09-24 17:34:52 +00:00
Barry Warsaw 3e8be722d9 I_getiter(): Function for the tp_iter slot of Itype so that
cStringIO's can participate in the iterator protocol.

Fill the Itype.tp_iter slot with I_getiter()
2001-09-22 04:36:49 +00:00
Jeremy Hylton cafd495dfe In O_writelines: Replace use of string.joinfields with "".join. 2001-02-09 23:44:22 +00:00
Jim Fulton e60de4d309 Added a new "base" type, IOobject for which most of the
operations are defined.  This will, hopefully clarify
some of the logic.

Added close test to raise proper error when operations
are performed on closed StringIOs.

Added a position argument to the truncate method.

Added a size argument to readline.

Added PyArg_Parse calls for methods that don't take arguments to
make sure they don't take arguments.
2000-10-06 19:24:23 +00:00
Martin v. Löwis c912a3a8fd Implement readlines function. Closes Bug #110686. 2000-09-19 11:06:46 +00:00
Andrew M. Kuchling e365fb8d1f Use METH_VARARGS instead of numeric constant 1 in method def. tables 2000-08-03 02:06:16 +00:00
Thomas Wouters 58d0510245 ANSIfy some more forward declarations. 2000-07-24 14:43:35 +00:00
Thomas Wouters 7e47402264 Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").

There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-07-16 12:04:32 +00:00
Jeremy Hylton 03657cfdb0 replace PyXXX_Length calls with PyXXX_Size calls 2000-07-12 13:05:33 +00:00
Fred Drake aef1000bff Fixed docstring typo, reported by Skip Montanaro <skip@mojam.com>. 2000-06-19 13:17:41 +00:00
Guido van Rossum b18618dab7 Vladimir Marangozov's long-awaited malloc restructuring.
For more comments, read the patches@python.org archives.
For documentation read the comments in mymalloc.h and objimpl.h.

(This is not exactly what Vladimir posted to the patches list; I've
made a few changes, and Vladimir sent me a fix in private email for a
problem that only occurs in debug mode.  I'm also holding back on his
change to main.c, which seems unnecessary to me.)
2000-05-03 23:44:39 +00:00
Jeremy Hylton 127b2ef2d5 raise TypeError when bad argument passed to cStringIO.StringIO 2000-04-12 22:04:01 +00:00
Guido van Rossum 43713e5a28 Massive patch by Skip Montanaro to add ":name" to as many
PyArg_ParseTuple() format string arguments as possible.
2000-02-29 13:59:29 +00:00
Guido van Rossum 17d53ecd8b New version from Jim: don't call Py_FatalError() when initialization fails. 1999-06-15 14:35:48 +00:00
Guido van Rossum 68de0641ce The writelines() function was never tested and contained numerous bugs
(including a docstring saying "blah").  Fixed all this.

(Please review for potential memory leaks!)
1999-02-08 17:03:27 +00:00
Guido van Rossum 476e49f055 Jim Fulton writes:
This fixes a bug that can cause core dumps when doing seeks in input
StringIO objects. This has a number of other clean-ups.
1998-12-15 21:43:15 +00:00
Guido van Rossum 3886bb6997 Add DL_EXPORT() to all modules that could possibly be used
on BeOS or Windows.
1998-12-04 18:50:17 +00:00
Guido van Rossum 7d9b4133eb New version from Jim Fulton:
- New copyright. (Open source)

  - Fixed problem in seek method.  The seek method should (and now does)
    fill with nulls when seeking past the end of the "file".
1998-11-25 16:17:32 +00:00
Guido van Rossum 2a502d8304 Use 'S' format character for the optional constructor argument, so we
get a decent error message when it's not a string (instead of
confusing errors when trying to use the thing).
1998-07-24 19:53:54 +00:00
Fred Drake 7589b71c4a I_getattr(),
O_getattr():  Added read-only access to the closed attribute, based on comment
	from Michael Scharf <Michael.Scharf@Rhein-Neckar.de>.
1998-07-17 14:30:58 +00:00
Fred Drake 10032ebb48 Module docstring indicated seek() isn't implemented, but it is. 1998-04-11 19:54:54 +00:00
Guido van Rossum fdde96ce98 New versions of cPickle and cStringIO, from Jim Fulton's cPickle 1.0b1
distribution.
1997-12-04 01:13:01 +00:00
Guido van Rossum 9efe8ef7a1 #Plug small memory leaks in constructors. 1997-09-03 18:19:40 +00:00
Guido van Rossum 15a40394b0 Fix the bug Jeremy was experiencing: both the close() and the
dealloc() functions contained code to free/DECREF the buffer
(there were differences between I and O objects but the logic bug was
the same).  Fixed this be setting the buffer pointer to NULL and
testing for that.  (This also makes it safe to call close() more than
once.)

XXX Worry: what if you try to read() or write() once the thing is
closed?
1997-09-03 00:09:26 +00:00
Guido van Rossum 142eeb8339 cPickle release 0.3 from Jim Fulton 1997-08-13 03:14:41 +00:00
Guido van Rossum 3dc35b0c66 My own patch: support writable 'softspace' attribute. 1997-04-11 19:56:06 +00:00
Guido van Rossum 154417e27b Unknown changes by Jim Fulton. 1997-04-09 17:35:33 +00:00
Barry Warsaw 61a63e152d Quieted gcc -Wall by removing unused local variables.
Suppressing my urge to reformat according to Python coding standards!
:-)
1997-01-14 17:38:28 +00:00
Guido van Rossum 55702f8d6a Jim's latest version. 1997-01-06 22:57:52 +00:00
Guido van Rossum 049cd90b93 Jim F's brainchild 1996-12-05 23:30:48 +00:00