Commit graph

2671 commits

Author SHA1 Message Date
Gustavo Niemeyer
786ddb29c9 Fixed bug
[#521782] unreliable file.read() error handling

* Objects/fileobject.c
  (file_read): Clear errors before leaving the loop in all situations,
  and also check if some data was read before exiting the loop with an
  EWOULDBLOCK exception.

* Doc/lib/libstdtypes.tex
* Objects/fileobject.c
  Document that sometimes a read() operation can return less data than
  what the user asked, if running in non-blocking mode.

* Misc/NEWS
  Document the fix.
2002-12-16 18:12:53 +00:00
Just van Rossum
edd179ee77 typo fix. 2002-12-15 13:14:22 +00:00
Raymond Hettinger
866964c3a3 Apply SF patch 652930: Add optional base argument to math.log(x[, base]). 2002-12-14 19:51:34 +00:00
Walter Dörwald
d9a6ad3beb Enhance issubclass() and PyObject_IsSubclass() so that a tuple is
supported as the second argument. This has the same meaning as
for isinstance(), i.e. issubclass(X, (A, B)) is equivalent
to issubclass(X, A) or issubclass(X, B). Compared to isinstance(),
this patch does not search the tuple recursively for classes, i.e.
any entry in the tuple that is not a class, will result in a
TypeError.

This closes SF patch #649608.
2002-12-12 16:41:44 +00:00
Just van Rossum
b083cb3901 Patch #651621, approved by MvL.
This patch allows ZipFile.writestr() to be called with
an archive file name instead of a ZipInfo instance:

z = ZipFile("myarchive.zip", "w")
z.writestr("foo/baz/file.ext", data)
z.close()

I found the old writestr() method very inconvenient
for simple (but common) things.

If called with a file name instead of a ZipInfo
instance, the date_time is set to the current date/time,
which makes sense to me for anonymous data.
2002-12-12 12:23:32 +00:00
Martin v. Löwis
0479104a91 Patch #651006: Better explain what component might be empty. 2002-12-11 12:55:53 +00:00
Raymond Hettinger
d2bef8256b Update comments about the performance of xrange(). 2002-12-11 07:14:03 +00:00
Skip Montanaro
3bf99e3e87 Add support for binary pickles to the shelve module. In some situations
this can result in significantly smaller files.  All classes as well as the
open function now accept an optional binary parameter, which defaults to
False for backward compatibility.  Added a small test suite, updated the
libref documentation (including documenting the exported classes and fixing
a few other nits) and added a note about the change to Misc/NEWS.
2002-12-08 18:36:24 +00:00
Fred Drake
edb635ff5c Remove extra ")" in example. 2002-12-06 18:52:28 +00:00
Fred Drake
08d10f985e Typo: "dead lock" --> "deadlock" 2002-12-06 16:45:05 +00:00
Fred Drake
a41b2bb981 Fix problem in example code. It's minor in this particular example,
but can lead to mysterious problems in real applications.
2002-12-03 22:57:37 +00:00
Fred Drake
7af24bd237 Fix example regular expressions that simulate scanf() constructs. 2002-12-03 18:49:17 +00:00
Martin v. Löwis
71aa6d6db9 Patch #646824: Remove extra \end. 2002-12-03 18:09:02 +00:00
Just van Rossum
3eb166b49b Slightly improved version of patch #642578: "Expose PyImport_FrozenModules
in imp". This adds two functions to the imp module: get_frozenmodules()
and set_frozenmodules().
2002-11-29 20:47:40 +00:00
Raymond Hettinger
e33d3df030 SF Patch 643443. Added dict.fromkeys(iterable, value=None), a class
method for constructing new dictionaries from sequences of keys.
2002-11-27 07:29:33 +00:00
Fred Drake
e9cfcef71e Clarify the interpretation of the __getstate__() return value for
new-style classes.
Closes SF bug #637941.
2002-11-27 05:26:46 +00:00
Gustavo Niemeyer
057ab14e7d * libbz2.tex
Fixed minor typo, suggested by Drew Perttula <drewp@bigasterisk.com>.
2002-11-25 18:51:43 +00:00
Andrew M. Kuchling
15353f5c64 Remove extra word 2002-11-25 16:01:08 +00:00
Martin v. Löwis
b5c980b802 Add unidata_version. Bump generator version number. 2002-11-25 09:13:37 +00:00
Martin v. Löwis
677bde2dd1 Patch #626485: Support Unicode normalization. 2002-11-23 22:08:15 +00:00
Fred Drake
6e596b6895 Added change note about returning a dictionary based on keyword
arguments.
2002-11-23 15:02:13 +00:00
Just van Rossum
a797d8150d Patch #642500 with slight modifications: allow keyword arguments in
dict() constructor. Example:
  >>> dict(a=1, b=2)
  {'a': 1, 'b': 2}
  >>>
2002-11-23 09:45:04 +00:00
Fred Drake
a191befb2d Clarify the default setting for daemon_threads. 2002-11-22 14:29:42 +00:00
Fred Drake
74f5a56c2c Fix markup. 2002-11-22 14:28:53 +00:00
Martin v. Löwis
4581cfa326 Patch #486438: Make module argument to testmod optional. 2002-11-22 08:23:09 +00:00
Martin v. Löwis
f86e8ef33e Patch #550765: Add daemon_threads flag. 2002-11-22 08:08:44 +00:00
Piers Lauder
d3c821ee71 added details of new IMAP4_stream class; emphasised meaning of data part of command results; added proxyauth command description 2002-11-22 05:47:39 +00:00
Martin v. Löwis
d899605e30 Patch #633547: Support plural forms. Do TODOs in test suite. 2002-11-21 21:45:32 +00:00
Tim Peters
3350b5bfd9 NamedTemporaryFile: clarify behavior based on confusions noted by a
user, and spell out a x-platform use limitation.
2002-11-21 16:32:11 +00:00
Walter Dörwald
72f861657a Document additional error handling names available through PEP 293. 2002-11-19 21:51:35 +00:00
Walter Dörwald
f171540ab8 Change int() so that passing a string, unicode, float or long argument
that is outside the integer range no longer raises OverflowError, but
returns a long object instead.

This fixes SF bug http://www.python.org/sf/635115
2002-11-19 20:49:15 +00:00
Raymond Hettinger
311f419628 Improve comments. Clarify docs.
Replace "type(0)" with "int".
Replace "while 1" with "while True"
2002-11-18 09:01:24 +00:00
Raymond Hettinger
8ddc176e2e Improve DictMixin.
Replaced docstring with comments.  Prevents subclass contamination.
Added the missing __cmp__() method and a test for __cmp__().
Used try/except style in preference to has_key() followed by a look-up.
Used iteritem() where possible to save creating a long key list and
   to save redundant lookups.
Expanded .update() to look for the most helpful methods first and gradually
   work down to a mininum expected interface.
Expanded documentation to be more clear on how to use the class.
2002-11-18 04:34:10 +00:00
Skip Montanaro
6141812820 correct typo detected by Lee Hansen 2002-11-17 11:09:50 +00:00
Fred Drake
e55bec2566 Better note that str.zfill() was added in 2.2.2 as well. ;-( 2002-11-16 00:44:00 +00:00
Fred Drake
9171801de9 Document that a minor feature was added in 2.2.2. ;-(
Closes SF bug #639170.
2002-11-16 00:41:55 +00:00
Neal Norwitz
5654cc215a SF 639138, Ref. calendar module in time docs by John J Lee
Will backport.
2002-11-15 23:00:30 +00:00
Fred Drake
c734b01759 Fix critical markup errors. 2002-11-15 18:49:57 +00:00
Fred Drake
3a2cda876b Minor revisions to clarify the status of xreadlines(), change the way
iteration support was documented; the docs for __iter__() were just
confusing.
2002-11-15 16:38:06 +00:00
Raymond Hettinger
7994716b6b SF patch #520382: Expand shelve.py to have a full dictionary interface
and add a mixin to UserDict.py to make it easier to implement a full
dictionary interface.
2002-11-15 06:46:14 +00:00
Skip Montanaro
4ebe2e3914 add liblogging 2002-11-14 03:58:20 +00:00
Skip Montanaro
649698f72e initial rough cut at documentation of logging module. This is basically
just a conversion of pydoc.help(logging).
2002-11-14 03:57:19 +00:00
Fred Drake
bad460790e Document struct_time and the field names. 2002-11-13 19:05:01 +00:00
Fred Drake
a5a173efbf Fix broken markup.
Closes SF bug #637807.
2002-11-13 17:48:15 +00:00
Fred Drake
2c184e7eea Typo: it's --> its
Closes SF bug #637810.
2002-11-13 15:56:13 +00:00
Fred Drake
3d03968c75 Clarified meaning of \w and \W with respect to the UNICODE and LOCALE flags.
Closes SF bug #635595.
2002-11-12 23:12:54 +00:00
Tim Peters
b9099c3df4 SF patch 637176: list.sort crasher
Armin Rigo's Draconian but effective fix for

SF bug 453523: list.sort crasher

slightly fiddled to catch more cases of list mutation.  The dreaded
internal "immutable list type" is gone!  OTOH, if you look at a list
*while* it's being sorted now, it will appear to be empty.  Better
than a core dump.
2002-11-12 22:08:10 +00:00
Fred Drake
4b9ed2f346 Clarified documentation of tempnam().
Closes SF bug #635656.
2002-11-12 22:07:11 +00:00
Raymond Hettinger
f24eb35d18 SF patch 629637: Add sample(population, k) method to the random module.
Used for random sampling without replacement.
2002-11-12 17:41:57 +00:00
Walter Dörwald
430b1563dd Add documentation for the PEP 293 functionality:
The errors attribute can be changed after the reader/writer
is created.

For encoding there are two additional errors values:
"xmlcharrefreplace" and "backslashreplace".

These values can be extended via register_error().
2002-11-07 22:33:17 +00:00