Commit Graph

105 Commits

Author SHA1 Message Date
Alexandre Vassalotti 5f8ced2b95 Merged revisions 62998-63003,63005-63006,63009-63012,63014-63017,63019-63020,63022-63024,63026-63029,63031-63041,63043-63045,63047-63054,63056-63062 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r62998 | andrew.kuchling | 2008-05-10 15:51:55 -0400 (Sat, 10 May 2008) | 7 lines

  #1858 from Tarek Ziade:
  Allow multiple repositories in .pypirc; see http://wiki.python.org/moin/EnhancedPyPI
  for discussion.

  The patch is slightly revised from Tarek's last patch: I've simplified
  the PyPIRCCommand.finalize_options() method to not look at sys.argv.
  Tests still pass.
........
  r63000 | alexandre.vassalotti | 2008-05-10 15:59:16 -0400 (Sat, 10 May 2008) | 5 lines

  Cleaned up io._BytesIO.write().

  I am amazed that the old code, for inserting null-bytes, actually
  worked. Who wrote that thing? Oh, it is me... doh.
........
  r63002 | brett.cannon | 2008-05-10 16:52:01 -0400 (Sat, 10 May 2008) | 2 lines

  Revert r62998 as it broke the build (seems distutils.config is missing).
........
  r63014 | andrew.kuchling | 2008-05-10 18:12:38 -0400 (Sat, 10 May 2008) | 1 line

  #1858: add distutils.config module
........
  r63027 | brett.cannon | 2008-05-10 21:09:32 -0400 (Sat, 10 May 2008) | 2 lines

  Flesh out the 3.0 deprecation to suggest using the ctypes module.
........
  r63028 | skip.montanaro | 2008-05-10 22:59:30 -0400 (Sat, 10 May 2008) | 4 lines

  Copied two versions of the example from the interactive session.  Delete
  one.
........
  r63037 | georg.brandl | 2008-05-11 03:02:17 -0400 (Sun, 11 May 2008) | 2 lines

  reload() takes the module itself.
........
  r63038 | alexandre.vassalotti | 2008-05-11 03:06:04 -0400 (Sun, 11 May 2008) | 4 lines

  Added test framework for handling module renames.
  Factored the import guard in test_py3kwarn.TestStdlibRemovals into
  a context manager, namely test_support.CleanImport.
........
  r63039 | georg.brandl | 2008-05-11 03:06:05 -0400 (Sun, 11 May 2008) | 2 lines

  #2742: ``''`` is not converted to NULL in getaddrinfo.
........
  r63040 | alexandre.vassalotti | 2008-05-11 03:08:12 -0400 (Sun, 11 May 2008) | 2 lines

  Fixed typo in a comment of test_support.CleanImport.
........
  r63041 | alexandre.vassalotti | 2008-05-11 03:10:25 -0400 (Sun, 11 May 2008) | 2 lines

  Removed a dead line of code.
........
  r63043 | georg.brandl | 2008-05-11 04:47:53 -0400 (Sun, 11 May 2008) | 2 lines

  #2812: document property.getter/setter/deleter.
........
  r63049 | georg.brandl | 2008-05-11 05:06:30 -0400 (Sun, 11 May 2008) | 2 lines

  #1153769: document PEP 237 changes to string formatting.
........
  r63050 | georg.brandl | 2008-05-11 05:11:40 -0400 (Sun, 11 May 2008) | 2 lines

  #2809: elaborate str.split docstring a bit.
........
  r63051 | georg.brandl | 2008-05-11 06:13:59 -0400 (Sun, 11 May 2008) | 2 lines

  Fix typo.
........
  r63052 | georg.brandl | 2008-05-11 06:33:27 -0400 (Sun, 11 May 2008) | 2 lines

  #2709: clarification.
........
  r63053 | georg.brandl | 2008-05-11 06:42:28 -0400 (Sun, 11 May 2008) | 2 lines

  #2659: add ``break_on_hyphens`` to TextWrapper.
........
  r63057 | georg.brandl | 2008-05-11 06:59:39 -0400 (Sun, 11 May 2008) | 2 lines

  #2741: clarification of value range for address_family.
........
  r63058 | georg.brandl | 2008-05-11 07:09:35 -0400 (Sun, 11 May 2008) | 2 lines

  #2452: timeout is used for all blocking operations.
........
  r63059 | andrew.kuchling | 2008-05-11 09:33:56 -0400 (Sun, 11 May 2008) | 2 lines

  #1792: Improve performance of marshal.dumps() on large objects by increasing
  the size of the buffer more quickly.
........
  r63060 | andrew.kuchling | 2008-05-11 10:00:00 -0400 (Sun, 11 May 2008) | 1 line

  #1858: re-apply patch for this, adding the missing files
........
  r63061 | benjamin.peterson | 2008-05-11 10:13:25 -0400 (Sun, 11 May 2008) | 2 lines

  Add the "until" command to pdb
........
  r63062 | georg.brandl | 2008-05-11 10:17:13 -0400 (Sun, 11 May 2008) | 2 lines

  Add some sentence endings.
........
2008-05-16 00:03:33 +00:00
Alexandre Vassalotti f0c0ff6ce4 Removed redundant max() call.
Change suggested by Nick Coghlan.
2008-05-09 21:21:21 +00:00
Alexandre Vassalotti 8130f7c3c4 Fixed the negative value check in io._BytesIO.seek(). 2008-05-08 01:39:38 +00:00
Alexandre Vassalotti 2e0419dcd6 Cleaned how _BytesIO.read() returns an empty bytes object.
Thank you, Guido, for noticing!
2008-05-07 00:09:04 +00:00
Alexandre Vassalotti 4833b3c37f Fixed a small bug introduced by r62778.
One of the codepaths of _BytesIO.read() returned a bytearray
object, by mistake, when it should always return a bytes object.
Interestingly, the fact this bug shown up probably means that
some platforms are not using the new C-accelerated io.BytesIO.
2008-05-06 23:47:23 +00:00
Alexandre Vassalotti 77250f4df7 Added fast alternate io.BytesIO implementation and its test suite.
Removed old test suite for StringIO.
Modified truncate() to imply a seek to given argument value.
2008-05-06 19:48:38 +00:00
Christian Heimes 5d8da20dd1 Merged revisions 62713,62715,62728,62737,62740,62744,62749,62756 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r62713 | georg.brandl | 2008-05-04 23:40:44 +0200 (Sun, 04 May 2008) | 2 lines

  #2695: Do case-insensitive check for algorithms.
........
  r62715 | benjamin.peterson | 2008-05-05 00:39:33 +0200 (Mon, 05 May 2008) | 2 lines

  Remove method signatures from the docstrings of io.py
........
  r62728 | martin.v.loewis | 2008-05-05 19:54:01 +0200 (Mon, 05 May 2008) | 2 lines

  Revert bogus checkin in r62724 to that file.
........
  r62737 | georg.brandl | 2008-05-05 22:59:05 +0200 (Mon, 05 May 2008) | 2 lines

  #2769: markup glitch.
........
  r62740 | georg.brandl | 2008-05-05 23:06:48 +0200 (Mon, 05 May 2008) | 2 lines

  #2752: fix second example too.
........
  r62744 | gregory.p.smith | 2008-05-05 23:53:45 +0200 (Mon, 05 May 2008) | 13 lines

  Fix a bug introduced in r62627.  see issue2760 and issue2632.

  An assertion in readline() would fail as data was already in the
  internal buffer even though the socket was in unbuffered read mode.
  That case is now handled.  More importantly, read() has been fixed to
  not over-recv() and leave newly recv()d data in the _fileobject buffer.

  The max() vs min() issue in read() is now gone.  Neither was correct.
  On bounded reads, always ask recv() for the exact amount of data we
  still need.

  Candidate for backporting to release25-maint along with r62627.
........
  r62749 | brett.cannon | 2008-05-06 06:37:31 +0200 (Tue, 06 May 2008) | 3 lines

  Fix a bug in the handling of the stacklevel argument in warnings.warn() where
  the stack was being unwound by two levels instead of one each time.
........
  r62756 | gregory.p.smith | 2008-05-06 09:05:18 +0200 (Tue, 06 May 2008) | 2 lines

  fix issue2707 - os.walk docstring example correctness typo.
........
2008-05-06 13:58:24 +00:00
Benjamin Peterson 9efcc4b319 Fix problems in the io docs noted by Alexandre Vassalotti 2008-04-14 21:30:21 +00:00
Benjamin Peterson 2c5f828283 Fleshed out docstrings in the io module, improving the reST one as I went. 2008-04-13 00:27:46 +00:00
Georg Brandl 8e2f755cb4 Remove __repr__ that doesn't have any advantage compared to the standard one. 2008-04-09 18:40:09 +00:00
Georg Brandl f91197c6d5 More docstring fixes, and an XXX. 2008-04-09 07:33:01 +00:00
Benjamin Peterson ca2b01515b fixed outdated annotation of readinto in io 2008-04-07 22:27:34 +00:00
Georg Brandl 5358434fd3 Docstring fix. 2008-04-06 20:27:02 +00:00
Benjamin Peterson 9a89e96f9f fix typo in doc string 2008-04-06 16:47:13 +00:00
Ka-Ping Yee 593cd6b843 Clean up the TextIOWrapper code; pick better names; improve documentation. 2008-03-20 10:37:32 +00:00
Ka-Ping Yee dbe28e573e This is r61508 plus additional fixes to the handling of 'limit'
in TextIOWrapper.readline().

All tests now pass for me (except for expected skips on darwin:
bsddb, bsddb3, cProfile, codecmaps_*, curses, gdbm, largefile,
locale, normalization, ossaudiodev, pep277, socketserver,
startfile, timeout, urllib2net, urllibnet, winreg, winsound,
xmlrpc_net, zipfile64, and the -u largefile part of test_io).
2008-03-20 10:34:07 +00:00
Neal Norwitz e2b070558c Revert r61508: it caused test_mailbox to fail on all platforms. 2008-03-18 19:52:05 +00:00
Ka-Ping Yee 30cc83832d In TextIOWrapper:
- Switch from consuming _decoded_text to advancing an offset into it.
  - Fix readline() interaction with seek/tell.
  - Fix readline() handling of 'limit' argument.

Add tests for seek/tell after readline().
2008-03-18 07:01:49 +00:00
Ka-Ping Yee f44c7e8996 Make TextIOWrapper's seek/tell work properly with stateful decoders;
document and rename things to make seek/tell workings a little clearer.

Add a weird decoder for testing TextIOWrapper's seek/tell methods.

Document the getstate/setstate protocol conventions for IncrementalDecoders.
2008-03-18 04:51:32 +00:00
Ka-Ping Yee ddaa7064ee Patch from jbalogh fixes issue #2282 (misnamed seekable() method). 2008-03-17 20:35:15 +00:00
Ka-Ping Yee 7a0d3980ed Remove the "unsafe" flag on peek() -- it is no longer used, because
self._read_buf is an immutable bytes object.
2008-03-17 17:34:48 +00:00
Christian Heimes 3ecfea71ff Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678-60695 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r60679 | raymond.hettinger | 2008-02-09 02:18:42 +0100 (Sat, 09 Feb 2008) | 1 line

  Make ABC containers inherit as documented.
........
  r60684 | raymond.hettinger | 2008-02-09 04:34:52 +0100 (Sat, 09 Feb 2008) | 1 line

  Merge with r60683.
........
  r60687 | raymond.hettinger | 2008-02-09 05:37:49 +0100 (Sat, 09 Feb 2008) | 1 line

  Add -3 warnings that set.copy(), dict.copy(), and defaultdict.copy() will go away in Py3.x
........
  r60689 | raymond.hettinger | 2008-02-09 11:04:19 +0100 (Sat, 09 Feb 2008) | 1 line

  Metaclass declaration is inherited
........
  r60691 | raymond.hettinger | 2008-02-09 11:06:20 +0100 (Sat, 09 Feb 2008) | 1 line

  Temporarily disable this test. It's been broken for a week.
........
  r60695 | nick.coghlan | 2008-02-09 16:28:09 +0100 (Sat, 09 Feb 2008) | 1 line

  Issue 2021: Allow NamedTemporaryFile and SpooledTemporaryFile to be used as context managers. (The NamedTemporaryFile fix should be considered for backporting to 2.5)
........
2008-02-09 20:51:34 +00:00
Alexandre Vassalotti a38f73b1bb Fix issue1753: TextIOWrapper.write writes utf BOM for every string.
Patch by Erick Tryzelaar, with slight modifications by me.
2008-01-07 18:30:48 +00:00
Alexandre Vassalotti c3d7fe0dbe Fix the reset() method of IncrementalNewlineDecoder to
also reset self.seennl.
2007-12-28 01:24:22 +00:00
Christian Heimes a33eb06e3b Added descriptor for builtins.open.__doc__
Before the change help(open) didn't return anything helpful but the doc string of io.OpenWrapper. Now it shows the user the documentation of io.open.
2007-12-08 17:47:40 +00:00
Guido van Rossum f64db9f6db Fix the rest of issue 1400, by introducing a proper implementation of
line buffering.  The TextIOWrapper class no longer calls isatty() on
every write() call.
2007-12-06 01:04:26 +00:00
Guido van Rossum e7fc50f2d0 Add an errors parameter to open() and TextIOWrapper() to specify error handling. 2007-12-03 22:54:21 +00:00
Georg Brandl 1a3284ed69 #1535: rename __builtin__ module to builtins. 2007-12-02 09:40:06 +00:00
Guido van Rossum 254348e201 Rename buffer -> bytearray. 2007-11-21 19:29:53 +00:00
Amaury Forgeot d'Arc a2d1d7e3b2 Oops, I missed this one again (test_univnewlines fails):
Some incremental decoders return multiple characters, even when fed with
only one more byte. In this case the tell() state must subtract the
number of extra characters.
2007-11-19 21:14:47 +00:00
Amaury Forgeot d'Arc 1ff9910f59 Issue1395: Universal mode used to duplicate newlines when using read(1).
"Universal newline" is now an incremental decoder wrapping the initial one,
with its own additional buffer (if '\r' is seen at the end of the input).

A decoder allows the tell() funtion to record the state of the translation.
This also simplifies the readline() process.

Now test_netrc passes on Windows, as well as many new tests in test_io.py
2007-11-19 20:34:10 +00:00
Christian Heimes 3ab4f651b9 seek() has to accept any int-like number 2007-11-09 01:27:29 +00:00
Christian Heimes 8e42a0a0e0 Fixed bug #1081: file.seek allows float arguments 2007-11-08 18:04:45 +00:00
Christian Heimes 8bd14fb398 Fixed #1403 where compileall and py_compile choked on an encoding header in a py file. Both modules need more unit tests. 2007-11-08 16:34:32 +00:00
Guido van Rossum 98297ee781 Merging the py3k-pep3137 branch back into the py3k branch.
No detailed change log; just check out the change log for the py3k-pep3137
branch.  The most obvious changes:

  - str8 renamed to bytes (PyString at the C level);
  - bytes renamed to buffer (PyBytes at the C level);
  - PyString and PyUnicode are no longer compatible.

I.e. we now have an immutable bytes type and a mutable bytes type.

The behavior of PyString was modified quite a bit, to make it more
bytes-like.  Some changes are still on the to-do list.
2007-11-06 21:34:58 +00:00
Georg Brandl 316414e435 Fix typo. 2007-10-30 17:42:20 +00:00
Guido van Rossum 2dced8b602 Patch 1329 (partial) by Christian Heimes.
Add a closefd flag to open() which can be set to False to prevent closing
the file descriptor when close() is called or when the object is destroyed.
Useful to ensure that sys.std{in,out,err} keep their file descriptors open
when Python is uninitialized.  (This was always a feature in 2.x, it just
wasn't implemented in 3.0 yet.)
2007-10-30 17:27:30 +00:00
Guido van Rossum 57233cb3f9 Patch 1330 by Christian Heimes (with some TLC applied by myself).
Move most of the messiness with truncate() on Windows into _fileio.c.
Still keep the flush() call in io.py though.
2007-10-26 17:19:33 +00:00
Guido van Rossum 79b79eeab2 Patch # 1323 by Amaury Forgeot d'Arc.
This patch corrects a problem in test_file.py on Windows:
f.truncate() seeks to the truncation point, but does not empty the
buffers. In the test, f.tell() returns -1...
2007-10-25 23:21:03 +00:00
Guido van Rossum ce3a72aec6 Patch 1267 by Christian Heimes.
Move the initialization of sys.std{in,out,err} and __builtin__.open
to C code.
This solves the problem that "python -S" wouldn't work.
2007-10-19 23:16:50 +00:00
Guido van Rossum 3172c5d263 Patch# 1258 by Christian Heimes: kill basestring.
I like this because it makes the code shorter! :-)
2007-10-16 18:12:55 +00:00
Brett Cannon 7648ba83f2 Make the docstring for io.open() a raw string so that the explanation for the
'newline' argument is not a jumbled mess of newlines.
2007-10-15 20:52:41 +00:00
Brett Cannon 041683df42 Remove self-referential import. 2007-10-11 23:08:53 +00:00
Guido van Rossum e86254e256 In rseponse to bug# 1029, force the newline default for StringIO to "\n",
so that even on Windows, after s.write("x\n"), s.getvalue() == "x\n".
2007-08-29 18:31:16 +00:00
Guido van Rossum dcce8391d1 Insist that the argument to TextIOWrapper.write() is a basestring
instance.  This was effectively already the case, but the error
reporting was lousy.
2007-08-29 18:10:08 +00:00
Guido van Rossum a74184eb1d Commit strict str/bytes distinction.
From now on, trying to write str to a binary stream
is an error (I'm still working on the reverse).
There are still (at least) two failing tests:
- test_asynchat
- test_urllib2_localnet
but I'm sure these will be fixed by someone.
2007-08-29 04:05:57 +00:00
Guido van Rossum 5abbf750a2 Changes to io.py and socket.py by Christian Heimes.
- Replace all asserts by ValuleErrors or TypeErrors as appropriate.
- Add _checkReadable, _checkWritable methods; these check self.closed too.
- Add a test that everything exported by io.py exists, and is either
  an exception or an IOBase instance (except for the open function).
- Default buffering to 1 if isatty() (I had to tweak this to enforce
  the *default* bit -- GvR).
2007-08-27 17:39:33 +00:00
Guido van Rossum b7f136e73e Make IOBase (and hence all other classes in io.py) use ABCMeta as its metaclass,
so you can use their class .register() method to register virtual subclasses.
2007-08-22 18:14:10 +00:00
Guido van Rossum 8358db22fa New I/O code from Tony Lownds implement newline feature correctly,
and implements .newlines attribute in a 2.x-compatible fashion.
2007-08-18 21:39:55 +00:00
Neal Norwitz 1e50a9f7cc Fix test_wsgiref that used StringIO and a BufferedReader rather than
real files.  This code assumed that fileno() would succeed which wasn't
the case.
2007-08-11 18:37:05 +00:00