summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libfuncs.tex
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-08-08 07:17:39 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-08-08 07:17:39 (GMT)
commitfeec4533e21a612e9a5b665c27b1a3eb84e04bb3 (patch)
treee721c83b44443f2cbda66a7acab7ddd4cd30a9d6 /Doc/lib/libfuncs.tex
parentd976ab7caf098eecf44173bbce8101f13ce79d86 (diff)
downloadcpython-feec4533e21a612e9a5b665c27b1a3eb84e04bb3.zip
cpython-feec4533e21a612e9a5b665c27b1a3eb84e04bb3.tar.gz
cpython-feec4533e21a612e9a5b665c27b1a3eb84e04bb3.tar.bz2
Bug 1003935: xrange overflows
Added XXX comment about why the undocumented PyRange_New() API function is too broken to be worth the considerable pain of repairing. Changed range_new() to stop using PyRange_New(). This fixes a variety of bogus errors. Nothing in the core uses PyRange_New() now. Documented that xrange() is intended to be simple and fast, and that CPython restricts its arguments, and length of its result sequence, to native C longs. Added some tests that failed before the patch, and repaired a test that relied on a bogus OverflowError getting raised.
Diffstat (limited to 'Doc/lib/libfuncs.tex')
-rw-r--r--Doc/lib/libfuncs.tex24
1 files changed, 15 insertions, 9 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex
index 062e3e8..1d4df67 100644
--- a/Doc/lib/libfuncs.tex
+++ b/Doc/lib/libfuncs.tex
@@ -79,7 +79,7 @@ def my_import(name):
\indexii{Boolean}{type}
\versionadded{2.2.1}
- \versionchanged[If no argument is given, this function returns
+ \versionchanged[If no argument is given, this function returns
\constant{False}]{2.3}
\end{funcdesc}
@@ -379,7 +379,7 @@ class C:
that differentiate between binary and text files (else it is
ignored). If the file cannot be opened, \exception{IOError} is
raised.
-
+
In addition to the standard \cfunction{fopen()} values \var{mode}
may be \code{'U'} or \code{'rU'}. If Python is built with universal
newline support (the default) the file is opened as a text file, but
@@ -392,7 +392,7 @@ class C:
\var{mode} \code{'U'} is the same as normal text mode. Note that
file objects so opened also have an attribute called
\member{newlines} which has a value of \code{None} (if no newlines
- have yet been seen), \code{'\e n'}, \code{'\e r'}, \code{'\e r\e n'},
+ have yet been seen), \code{'\e n'}, \code{'\e r'}, \code{'\e r\e n'},
or a tuple containing all the newline types seen.
If \var{mode} is omitted, it defaults to \code{'r'}. When opening a
@@ -459,7 +459,7 @@ class C:
the inner sets should also be \class{frozenset} objects. If
\var{iterable} is not specified, returns a new empty set,
\code{frozenset([])}.
- \versionadded{2.4}
+ \versionadded{2.4}
\end{funcdesc}
\begin{funcdesc}{getattr}{object, name\optional{, default}}
@@ -659,7 +659,7 @@ class C:
\end{funcdesc}
\begin{funcdesc}{object}{}
- Return a new featureless object. \function{object()} is a base
+ Return a new featureless object. \function{object()} is a base
for all new style classes. It has the methods that are common
to all instances of new style classes.
\versionadded{2.2}
@@ -901,7 +901,7 @@ except NameError:
must be immutable. To represent sets of sets, the inner sets should
be \class{frozenset} objects. If \var{iterable} is not specified,
returns a new empty set, \code{set([])}.
- \versionadded{2.4}
+ \versionadded{2.4}
\end{funcdesc}
\begin{funcdesc}{setattr}{object, name, value}
@@ -931,7 +931,7 @@ except NameError:
Return a new sorted list from the items in \var{iterable}.
The optional arguments \var{cmp}, \var{key}, and \var{reverse}
have the same meaning as those for the \method{list.sort()} method.
- \versionadded{2.4}
+ \versionadded{2.4}
\end{funcdesc}
\begin{funcdesc}{staticmethod}{function}
@@ -1099,6 +1099,12 @@ It's a function
them) except when a very large range is used on a memory-starved
machine or when all of the range's elements are never used (such as
when the loop is usually terminated with \keyword{break}).
+
+ \note{\function{xrange()} is intended to be simple and fast.
+ Implementations may impose restrictions to achieve this.
+ The C implementation of Python restricts all arguments to
+ native C longs ("short" Python integers), and also requires
+ that that number of elements fit in a native C long.}
\end{funcdesc}
\begin{funcdesc}{zip}{\optional{seq1, \moreargs}}
@@ -1114,11 +1120,11 @@ It's a function
\versionchanged[Formerly, \function{zip()} required at least one argument
and \code{zip()} raised a \exception{TypeError} instead of returning
- an empty list.]{2.4}
+ an empty list.]{2.4}
\end{funcdesc}
-% ---------------------------------------------------------------------------
+% ---------------------------------------------------------------------------
\section{Non-essential Built-in Functions \label{non-essential-built-in-funcs}}