Commit 0daf79bd authored by Benjamin Peterson's avatar Benjamin Peterson

merge from trunk

parent 5783bdd1
......@@ -111,7 +111,7 @@ dist:
# archive the HTML
make html
cp -a build/html dist/python$(DISTVERSION)-docs-html
cp -pPR build/html dist/python$(DISTVERSION)-docs-html
tar -C dist -cf dist/python$(DISTVERSION)-docs-html.tar python$(DISTVERSION)-docs-html
bzip2 -9 -k dist/python$(DISTVERSION)-docs-html.tar
(cd dist; zip -q -r -9 python$(DISTVERSION)-docs-html.zip python$(DISTVERSION)-docs-html)
......@@ -120,7 +120,7 @@ dist:
# archive the text build
make text
cp -a build/text dist/python$(DISTVERSION)-docs-text
cp -pPR build/text dist/python$(DISTVERSION)-docs-text
tar -C dist -cf dist/python$(DISTVERSION)-docs-text.tar python$(DISTVERSION)-docs-text
bzip2 -9 -k dist/python$(DISTVERSION)-docs-text.tar
(cd dist; zip -q -r -9 python$(DISTVERSION)-docs-text.zip python$(DISTVERSION)-docs-text)
......
......@@ -744,11 +744,11 @@ created.
:cmacro:`Py_END_ALLOW_THREADS` macros is acceptable.
The return value is an opaque "handle" to the thread state when
:cfunc:`PyGILState_Acquire` was called, and must be passed to
:cfunc:`PyGILState_Ensure` was called, and must be passed to
:cfunc:`PyGILState_Release` to ensure Python is left in the same state. Even
though recursive calls are allowed, these handles *cannot* be shared - each
unique call to :cfunc:`PyGILState_Ensure` must save the handle for its call to
:cfunc:`PyGILState_Release`.
unique call to :cfunc:`PyGILState_Ensure` must save the handle for its call
to :cfunc:`PyGILState_Release`.
When the function returns, the current thread will hold the GIL. Failure is a
fatal error.
......
......@@ -41,13 +41,6 @@ today_fmt = '%B %d, %Y'
# List of files that shouldn't be included in the build.
unused_docs = [
'whatsnew/2.0',
'whatsnew/2.1',
'whatsnew/2.2',
'whatsnew/2.3',
'whatsnew/2.4',
'whatsnew/2.5',
'whatsnew/2.6',
'maclib/scrap',
'library/xmllib',
'library/xml.etree',
......
......@@ -4,7 +4,7 @@
.. toctree::
whatsnew/3.0.rst
whatsnew/index.rst
tutorial/index.rst
using/index.rst
reference/index.rst
......
......@@ -299,7 +299,7 @@ followed by ``lines`` for the text version or ``binary`` for the binary version.
.. method:: FTP.quit()
Send a ``QUIT`` command to the server and close the connection. This is the
"polite" way to close a connection, but it may raise an exception of the server
"polite" way to close a connection, but it may raise an exception if the server
responds with an error to the ``QUIT`` command. This implies a call to the
:meth:`close` method which renders the :class:`FTP` instance useless for
subsequent calls (see below).
......
......@@ -22,9 +22,8 @@ are always available. They are listed here in alphabetical order.
The function is invoked by the :keyword:`import` statement. It mainly exists
so that you can replace it with another function that has a compatible
interface, in order to change the semantics of the :keyword:`import`
statement. See also the built-in module :mod:`imp`, which
defines some useful operations out of which you can build your own
:func:`__import__` function.
statement. See the built-in module :mod:`imp`, which defines some useful
operations out of which you can build your own :func:`__import__` function.
For example, the statement ``import spam`` results in the following call:
``__import__('spam', globals(), locals(), [], -1)``; the statement
......@@ -1201,6 +1200,18 @@ are always available. They are listed here in alphabetical order.
care about trailing, unmatched values from the longer iterables. If those
values are important, use :func:`itertools.zip_longest` instead.
:func:`zip` in conjunction with the ``*`` operator can be used to unzip a
list::
>>> x = [1, 2, 3]
>>> y = [4, 5, 6]
>>> zipped = zip(x, y)
>>> zipped
[(1, 4), (2, 5), (3, 6)]
>>> x2, y2 = zip(*zipped)
>>> x == x2, y == y2
True
.. rubric:: Footnotes
......
This diff is collapsed.
......@@ -334,8 +334,8 @@ Replacing /bin/sh shell backquote
output = Popen(["mycmd", "myarg"], stdout=PIPE).communicate()[0]
Replacing shell pipe line
^^^^^^^^^^^^^^^^^^^^^^^^^
Replacing shell pipeline
^^^^^^^^^^^^^^^^^^^^^^^^
::
......
......@@ -775,9 +775,9 @@ can appear before a future statement are:
.. XXX change this if future is cleaned out
The features recognized by Python 3.0 are ``absolute_import``, ``division``,
``generators``, ``nested_scopes`` and ``with_statement``. They are all
redundant because they are always enabled, and only kept for backwards
compatibility.
``generators``, ``unicode_literals``, ``print_function``, ``nested_scopes`` and
``with_statement``. They are all redundant because they are always enabled, and
only kept for backwards compatibility.
A future statement is recognized and treated specially at compile time: Changes
to the semantics of core constructs are often implemented by generating
......
......@@ -31,8 +31,8 @@ in the table are the size of the download files in Kilobytes.</p>
<td><a href="{{ dlbase }}/python-docs-html.tar.bz2">Download</a> (ca. 4 MB)</td>
</tr>
<tr><td>Plain Text</td>
<td><a href="{{ dlbase }}/python-docs-pdf-text.zip">Download</a> (ca. 2 MB)</td>
<td><a href="{{ dlbase }}/python-docs-pdf-text.tar.bz2">Download</a> (ca. 1.5 MB)</td>
<td><a href="{{ dlbase }}/python-docs-text.zip">Download</a> (ca. 2 MB)</td>
<td><a href="{{ dlbase }}/python-docs-text.tar.bz2">Download</a> (ca. 1.5 MB)</td>
</tr>
</table>
......
......@@ -4,7 +4,7 @@
<table class="contentstable" align="center"><tr>
<td width="50%">
<p class="biglink"><a class="biglink" href="{{ pathto("whatsnew/" + version) }}">What's new in Python {{ version }}?</a><br/>
<span class="linkdescr">changes since previous major release</span></p>
<span class="linkdescr">or <a href="{{ pathto("whatsnew/index") }}">all "What's new" documents</a> since 2.0</span></span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("tutorial/index") }}">Tutorial</a><br/>
<span class="linkdescr">start here</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("using/index") }}">Using Python</a><br/>
......
{% extends "!layout.html" %}
{% block rootrellink %}
<li><img src="{{ pathto('_static/py.png', 1) }}" alt="" style="vertical-align: middle; margin-top: -1px"/></li>
{{ super() }}
<li><img src="{{ pathto('_static/py.png', 1) }}" alt="" style="vertical-align: middle; margin-top: -1px"/></li><li><a href="{{ pathto('index') }}">{{ shorttitle }}</a>{{ reldelim1 }}</li>
{% endblock %}
......@@ -714,7 +714,7 @@ Python's division operator, ``/``, behaves like C's division operator when
presented with two integer arguments: it returns an integer result that's
truncated down when there would be a fractional part. For example, ``3/2`` is
1, not 1.5, and ``(-1)/2`` is -1, not -0.5. This means that the results of
divison can vary unexpectedly depending on the type of the two operands and
division can vary unexpectedly depending on the type of the two operands and
because Python is dynamically typed, it can be difficult to determine the
possible types of the operands.
......
......@@ -1196,7 +1196,7 @@ Optimizations
* The ``SET_LINENO`` opcode is now gone. This may provide a small speed
increase, depending on your compiler's idiosyncrasies. See section
:ref:`section-other` for a longer explanation. (Removed by Michael Hudson.)
:ref:`23section-other` for a longer explanation. (Removed by Michael Hudson.)
* :func:`xrange` objects now have their own iterator, making ``for i in
xrange(n)`` slightly faster than ``for i in range(n)``. (Patch by Raymond
......@@ -1951,7 +1951,7 @@ Other new platforms now supported by Python include AtheOS
.. ======================================================================
.. _section-other:
.. _23section-other:
Other Changes and Fixes
=======================
......@@ -2062,7 +2062,7 @@ code:
.. ======================================================================
.. _acks:
.. _23acks:
Acknowledgements
================
......
......@@ -1551,7 +1551,7 @@ code:
.. ======================================================================
.. _acks:
.. _24acks:
Acknowledgements
================
......
......@@ -16,9 +16,9 @@ release schedule.
The changes in Python 2.5 are an interesting mix of language and library
improvements. The library enhancements will be more important to Python's user
community, I think, because several widely-useful packages were added. New
modules include ElementTree for XML processing (section :ref:`module-etree`),
the SQLite database module (section :ref:`module-sqlite`), and the :mod:`ctypes`
module for calling C functions (section :ref:`module-ctypes`).
modules include ElementTree for XML processing (:mod:`xml.etree`),
the SQLite database module (:mod:`sqlite`), and the :mod:`ctypes`
module for calling C functions.
The language changes are of middling significance. Some pleasant new features
were added, but most of them aren't features that you'll use every day.
......@@ -736,7 +736,7 @@ add a :keyword:`return` statement at the marked location. ::
# return False
.. _module-contextlib:
.. _contextlibmod:
The contextlib module
---------------------
......@@ -1109,7 +1109,7 @@ Here are all of the changes that Python 2.5 makes to the core Python language.
.. ======================================================================
.. _interactive:
.. _25interactive:
Interactive Interpreter Changes
-------------------------------
......@@ -1211,7 +1211,7 @@ marked in the following list.
.. ======================================================================
.. _modules:
.. _25modules:
New, Improved, and Removed Modules
==================================
......@@ -1273,7 +1273,7 @@ complete list of changes, or look through the SVN logs for all the details.
(Contributed by Raymond Hettinger.)
* New module: The :mod:`contextlib` module contains helper functions for use
with the new ':keyword:`with`' statement. See section :ref:`module-contextlib`
with the new ':keyword:`with`' statement. See section :ref:`contextlibmod`
for more about this module.
* New module: The :mod:`cProfile` module is a C implementation of the existing
......@@ -2272,8 +2272,6 @@ code:
.. ======================================================================
.. _acks:
Acknowledgements
================
......
This diff is collapsed.
****************************
What's New in Python 2.7
****************************
:Author: A.M. Kuchling (amk at amk.ca)
:Release: |release|
:Date: |today|
.. $Id$
Rules for maintenance:
* Anyone can add text to this document. Do not spend very much time
on the wording of your changes, because your text will probably
get rewritten to some degree.
* The maintainer will go through Misc/NEWS periodically and add
changes; it's therefore more important to add your changes to
Misc/NEWS than to this file.
* This is not a complete list of every single change; completeness
is the purpose of Misc/NEWS. Some changes I consider too small
or esoteric to include. If such a change is added to the text,
I'll just remove it. (This is another reason you shouldn't spend
too much time on writing your addition.)
* If you want to draw your new text to the attention of the
maintainer, add 'XXX' to the beginning of the paragraph or
section.
* It's OK to just add a fragmentary note about a change. For
example: "XXX Describe the transmogrify() function added to the
socket module." The maintainer will research the change and
write the necessary text.
* You can comment out your additions if you like, but it's not
necessary (especially when a final release is some months away).
* Credit the author of a patch or bugfix. Just the name is
sufficient; the e-mail address isn't necessary.
* It's helpful to add the bug/patch number in a parenthetical comment.
XXX Describe the transmogrify() function added to the socket
module.
(Contributed by P.Y. Developer; :issue:`12345`.)
This saves the maintainer some effort going through the SVN logs
when researching a change.
This article explains the new features in Python 2.7.
No release schedule has been decided yet for 2.7.
.. Compare with previous release in 2 - 3 sentences here.
add hyperlink when the documentation becomes available online.
.. ========================================================================
.. Large, PEP-level features and changes should be described here.
.. Should there be a new section here for 3k migration?
.. Or perhaps a more general section describing module changes/deprecation?
.. ========================================================================
Other Language Changes
======================
Some smaller changes made to the core Python language are:
* List of changes to be written here.
.. ======================================================================
Optimizations
-------------
To be written.
.. ======================================================================
New, Improved, and Deprecated Modules
=====================================
As in every release, Python's standard library received a number of
enhancements and bug fixes. Here's a partial list of the most notable
changes, sorted alphabetically by module name. Consult the
:file:`Misc/NEWS` file in the source tree for a more complete list of
changes, or look through the Subversion logs for all the details.
* To be written.
.. ======================================================================
.. whole new modules get described in subsections here
.. ======================================================================
Build and C API Changes
=======================
Changes to Python's build process and to the C API include:
* To be written.
.. ======================================================================
Port-Specific Changes: Windows
-----------------------------------
.. ======================================================================
Port-Specific Changes: Mac OS X
-----------------------------------
.. ======================================================================
Porting to Python 2.7
=====================
This section lists previously described changes and other bugfixes
that may require changes to your code:
To be written.
.. ======================================================================
.. _acks27:
Acknowledgements
================
The author would like to thank the following people for offering
suggestions, corrections and assistance with various drafts of this
article: no one yet.
......@@ -440,7 +440,7 @@ Platform-specific changes go here.
.. ======================================================================
.. _section-other:
.. _30section-other:
Other Changes and Fixes
=======================
......
.. _whatsnew-index:
######################
What's New in Python
######################
The "What's New in Python" series of essays takes tours through the most
important changes between major Python versions. They are a "must read" for
anyone wishing to stay up-to-date after a new release.
.. toctree::
:maxdepth: 1
3.0.rst
2.7.rst
2.6.rst
2.5.rst
2.4.rst
2.3.rst
2.2.rst
2.1.rst
2.0.rst
"""optparse - a powerful, extensible, and easy-to-use option parser.
"""A powerful, extensible, and easy-to-use option parser.
By Greg Ward <gward@python.net>
Originally distributed as Optik; see http://optik.sourceforge.net/ .
If you have problems with this module, please do not file bugs,
patches, or feature requests with Python; instead, use Optik's
SourceForge project page:
http://sourceforge.net/projects/optik
Originally distributed as Optik.
For support, use the optik-users@lists.sourceforge.net mailing list
(http://lists.sourceforge.net/lists/listinfo/optik-users).
"""
# Python developers: please do not make changes to this file, since
# it is automatically generated from the Optik source code.
__version__ = "1.5.3"
__all__ = ['Option',
......@@ -1263,9 +1255,19 @@ class OptionParser (OptionContainer):
self.usage = usage
def enable_interspersed_args(self):
"""Set parsing to not stop on the first non-option, allowing
interspersing switches with command arguments. This is the
default behavior. See also disable_interspersed_args() and the
class documentation description of the attribute
allow_interspersed_args."""
self.allow_interspersed_args = True
def disable_interspersed_args(self):
"""Set parsing to stop on the first non-option. Use this if
you have a command processor which runs another command that
has options of its own and you want to make sure these options
don't get confused.
"""
self.allow_interspersed_args = False
def set_process_default_values(self, process):
......
......@@ -26,12 +26,13 @@ def raise2():
class TestCase(unittest.TestCase):
def setUp(self):
self.stream = io.StringIO()
self.save_stdout, self.save_stderr = sys.stderr, sys.stdout
sys.stdout = sys.stderr = self.stream
atexit._clear()
def tearDown(self):
sys.stdout = sys.__stdout__
sys.stderr = sys.__stderr__
sys.stdout = self.save_stdout
sys.stderr = self.save_stderr
atexit._clear()
def test_args(self):
......
......@@ -196,6 +196,17 @@ class TestInsort(unittest.TestCase):
def test_backcompatibility(self):
self.assertEqual(self.module.insort, self.module.insort_right)
def test_listDerived(self):
class List(list):
data = []
def insert(self, index, item):
self.data.insert(index, item)
lst = List()
self.module.insort_left(lst, 10)
self.module.insort_right(lst, 5)
self.assertEqual([5, 10], lst.data)
class TestInsortPython(TestInsort):
module = py_bisect
......
......@@ -249,7 +249,7 @@ class TestTimeDelta(HarmlessMixedComparison, unittest.TestCase):
self.assertRaises(TypeError, lambda: a // x)
self.assertRaises(TypeError, lambda: x // a)
# Divison of int by timedelta doesn't make sense.
# Division of int by timedelta doesn't make sense.
# Division by zero doesn't make sense.
for zero in 0, 0:
self.assertRaises(TypeError, lambda: zero // a)
......
......@@ -140,6 +140,23 @@ class WhichDBTestCase(unittest.TestCase):
def setUp(self):
delete_files()
self.filename = test.support.TESTFN
self.d = dbm.open(self.filename, 'c')
self.d.close()
def test_keys(self):
self.d = dbm.open(self.filename, 'c')
self.assertEqual(self.d.keys(), [])
a = [(b'a', b'b'), (b'12345678910', b'019237410982340912840198242')]
for k, v in a:
self.d[k] = v
self.assertEqual(sorted(self.d.keys()), sorted(k for (k, v) in a))
for k, v in a:
self.assert_(k in self.d)
self.assertEqual(self.d[k], v)
self.assert_('xxx' not in self.d)
self.assertRaises(KeyError, lambda: self.d['xxx'])
self.d.close()
def test_main():
......
......@@ -8,9 +8,9 @@ import unittest
PORT = None
def server(evt, numrequests):
try:
serv = DocXMLRPCServer(("localhost", 0), logRequests=False)
serv = DocXMLRPCServer(("localhost", 0), logRequests=False)
try:
global PORT
PORT = serv.socket.getsockname()[1]
......
......@@ -391,6 +391,17 @@ class TestSet(TestJointOps):
else:
self.fail()
def test_remove_keyerror_set(self):
key = self.thetype([3, 4])
try:
self.s.remove(key)
except KeyError as e:
self.assert_(e.args[0] is key,
"KeyError should be {0}, not {1}".format(key,
e.args[0]))
else:
self.fail()
def test_discard(self):
self.s.discard('a')
self.assert_('a' not in self.s)
......
......@@ -130,8 +130,8 @@ LIBRARY_RECIPES = [
),
dict(
name="SQLite 3.3.5",
url="http://www.sqlite.org/sqlite-3.3.5.tar.gz",
name="SQLite 3.6.3",
url="http://www.sqlite.org/sqlite-3.6.3.tar.gz",
checksum='93f742986e8bc2dfa34792e16df017a6feccf3a2',
configure_pre=[
'--enable-threadsafe',
......@@ -171,8 +171,8 @@ LIBRARY_RECIPES = [
),
),
dict(
name="Sleepycat DB 4.4",
url="http://downloads.sleepycat.com/db-4.4.20.tar.gz",
name="Sleepycat DB 4.7.25",
url="http://download.oracle.com/berkeley-db/db-4.7.25.tar.gz",
#name="Sleepycat DB 4.3.29",
#url="http://downloads.sleepycat.com/db-4.3.29.tar.gz",
buildDir="build_unix",
......@@ -586,21 +586,23 @@ def buildPythonDocs():
version = getVersion()
docdir = os.path.join(rootDir, 'pydocs')
novername = 'python-docs-html.tar.bz2'
name = 'html-%s.tar.bz2'%(getFullVersion(),)
sourceArchive = os.path.join(DEPSRC, name)
if os.path.exists(sourceArchive):
print("Using local copy of %s"%(name,))
else:
print("Downloading %s"%(name,))
print "Downloading %s"%(novername,)
downloadURL('http://www.python.org/ftp/python/doc/%s/%s'%(
getFullVersion(), name), sourceArchive)
getFullVersion(), novername), sourceArchive)
print("Archive for %s stored as %s"%(name, sourceArchive))
extractArchive(os.path.dirname(docdir), sourceArchive)
os.rename(
os.path.join(
os.path.dirname(docdir), 'Python-Docs-%s'%(getFullVersion(),)),
os.path.dirname(docdir), 'python-docs-html'),
docdir)
......@@ -1029,11 +1031,11 @@ def main():
buildPython()
buildPythonDocs()
fn = os.path.join(WORKDIR, "_root", "Applications",
"MacPython %s"%(getVersion(),), "Update Shell Profile.command")
"Python %s"%(getVersion(),), "Update Shell Profile.command")
patchFile("scripts/postflight.patch-profile", fn)
os.chmod(fn, 0755)
folder = os.path.join(WORKDIR, "_root", "Applications", "MacPython %s"%(
folder = os.path.join(WORKDIR, "_root", "Applications", "Python %s"%(
getVersion(),))
os.chmod(folder, 0755)
setIcon(folder, "../Icons/Python Folder.icns")
......
......@@ -176,8 +176,8 @@ PYTHON= python$(EXE)
BUILDPYTHON= python$(BUILDEXE)
# The task to run while instrument when building the profile-opt target
PROFILE_TASK= Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
#PROFILE_TASK= Lib/test/regrtest.py
PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
#PROFILE_TASK= $(srcdir)/Lib/test/regrtest.py
# === Definitions added by makesetup ===
......
......@@ -82,7 +82,7 @@ insort_right(PyObject *self, PyObject *args, PyObject *kw)
index = internal_bisect_right(list, item, lo, hi);
if (index < 0)
return NULL;
if (PyList_Check(list)) {
if (PyList_CheckExact(list)) {
if (PyList_Insert(list, index, item) < 0)
return NULL;
} else {
......@@ -183,7 +183,7 @@ insort_left(PyObject *self, PyObject *args, PyObject *kw)
index = internal_bisect_left(list, item, lo, hi);
if (index < 0)
return NULL;
if (PyList_Check(list)) {
if (PyList_CheckExact(list)) {
if (PyList_Insert(list, index, item) < 0)
return NULL;
} else {
......
......@@ -108,7 +108,7 @@ Decodes obj using the codec registered for encoding. encoding defaults\n\
to the default encoding. errors may be given to set a different error\n\
handling scheme. Default is 'strict' meaning that encoding errors raise\n\
a ValueError. Other possible values are 'ignore' and 'replace'\n\
as well as any other name registerd with codecs.register_error that is\n\
as well as any other name registered with codecs.register_error that is\n\
able to handle ValueErrors.");
static PyObject *
......
......@@ -36,7 +36,7 @@ PyDoc_STRVAR(MultibyteCodec_Decode__doc__,
Decodes `string' using I, an MultibyteCodec instance. errors may be given\n\
to set a different error handling scheme. Default is 'strict' meaning\n\
that encoding errors raise a UnicodeDecodeError. Other possible values\n\
are 'ignore' and 'replace' as well as any other name registerd with\n\
are 'ignore' and 'replace' as well as any other name registered with\n\
codecs.register_error that is able to handle UnicodeDecodeErrors.");
static char *codeckwarglist[] = {"input", "errors", NULL};
......
......@@ -751,11 +751,16 @@ win32_wchdir(LPCWSTR path)
if (!result)
return FALSE;
if (result > MAX_PATH+1) {
new_path = malloc(result);
new_path = malloc(result * sizeof(wchar_t));
if (!new_path) {
SetLastError(ERROR_OUTOFMEMORY);
return FALSE;
}
result = GetCurrentDirectoryW(result, new_path);
if (!result) {
free(new_path);
return FALSE;
}
}
if (wcsncmp(new_path, L"\\\\", 2) == 0 ||
wcsncmp(new_path, L"//", 2) == 0)
......
......@@ -1870,16 +1870,18 @@ PyDoc_STRVAR(setdefault_doc__,
"D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D");
PyDoc_STRVAR(pop__doc__,
"D.pop(k[,d]) -> v, remove specified key and return the corresponding value\n\
"D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n\
If key is not found, d is returned if given, otherwise KeyError is raised");
PyDoc_STRVAR(popitem__doc__,
"D.popitem() -> (k, v), remove and return some (key, value) pair as a\n\
2-tuple; but raise KeyError if D is empty");
2-tuple; but raise KeyError if D is empty.");
PyDoc_STRVAR(update__doc__,
"D.update(E, **F) -> None. Update D from E and F: for k in E: D[k] = E[k]\
\n(if E has keys else: for (k, v) in E: D[k] = v) then: for k in F: D[k] = F[k]");
"D.update(E, **F) -> None. Update D from dict/iterable E and F.\n"
"If E has a .keys() method, does: for k in E: D[k] = E[k]\n\
If E lacks .keys() method, does: for (k, v) in E: D[k] = v\n\
In either case, this is followed by: for k in F: D[k] = F[k]");
PyDoc_STRVAR(fromkeys__doc__,
"dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.\n\
......
......@@ -1457,7 +1457,7 @@ float_as_integer_ratio(PyObject *v, PyObject *unused)
#ifdef Py_NAN
if (Py_IS_NAN(self)) {
PyErr_SetString(PyExc_ValueError,
"Cannot pass nan to float.as_integer_ratio.");
"Cannot pass NaN to float.as_integer_ratio.");
return NULL;
}
#endif
......@@ -1516,7 +1516,7 @@ PyDoc_STRVAR(float_as_integer_ratio_doc,
"\n"
"Returns a pair of integers, whose ratio is exactly equal to the original\n"
"float and with a positive denominator.\n"
"Raises OverflowError on infinities and a ValueError on nans.\n"
"Raises OverflowError on infinities and a ValueError on NaNs.\n"
"\n"
">>> (10.0).as_integer_ratio()\n"
"(10, 1)\n"
......
......@@ -2286,11 +2286,14 @@ PyDoc_STRVAR(extend_doc,
PyDoc_STRVAR(insert_doc,
"L.insert(index, object) -- insert object before index");
PyDoc_STRVAR(pop_doc,
"L.pop([index]) -> item -- remove and return item at index (default last)");
"L.pop([index]) -> item -- remove and return item at index (default last).\n"
"Raises IndexError if list is empty or index is out of range.");
PyDoc_STRVAR(remove_doc,
"L.remove(value) -- remove first occurrence of value");
"L.remove(value) -- remove first occurrence of value.\n"
"Raises ValueError if the value is not present.");
PyDoc_STRVAR(index_doc,
"L.index(value, [start, [stop]]) -> integer -- return first index of value");
"L.index(value, [start, [stop]]) -> integer -- return first index of value.\n"
"Raises ValueError if the value is not present.");
PyDoc_STRVAR(count_doc,
"L.count(value) -> integer -- return number of occurrences of value");
PyDoc_STRVAR(reverse_doc,
......
......@@ -746,7 +746,8 @@ set_pop(PySetObject *so)
return key;
}
PyDoc_STRVAR(pop_doc, "Remove and return an arbitrary set element.");
PyDoc_STRVAR(pop_doc, "Remove and return an arbitrary set element.\n\
Raises KeyError if the set is empty.");
static int
set_traverse(PySetObject *so, visitproc visit, void *arg)
......@@ -1861,7 +1862,7 @@ PyDoc_STRVAR(contains_doc, "x.__contains__(y) <==> y in x.");
static PyObject *
set_remove(PySetObject *so, PyObject *key)
{
PyObject *tmpkey, *result;
PyObject *tmpkey;
int rv;
rv = set_discard_key(so, key);
......@@ -1873,11 +1874,14 @@ set_remove(PySetObject *so, PyObject *key)
if (tmpkey == NULL)
return NULL;
set_swap_bodies((PySetObject *)tmpkey, (PySetObject *)key);
result = set_remove(so, tmpkey);
rv = set_discard_key(so, tmpkey);
set_swap_bodies((PySetObject *)tmpkey, (PySetObject *)key);
Py_DECREF(tmpkey);
return result;
} else if (rv == DISCARD_NOTFOUND) {
if (rv == -1)
return NULL;
}
if (rv == DISCARD_NOTFOUND) {
set_key_error(key);
return NULL;
}
......
......@@ -694,7 +694,9 @@ tuple_sizeof(PyTupleObject *self)
}
PyDoc_STRVAR(index_doc,
"T.index(value, [start, [stop]]) -> integer -- return first index of value");
"T.index(value, [start, [stop]]) -> integer -- return first index of value.\n"
"Raises ValueError if the value is not present."
);
PyDoc_STRVAR(count_doc,
"T.count(value) -> integer -- return number of occurrences of value");
PyDoc_STRVAR(sizeof_doc,
......
......@@ -7300,7 +7300,7 @@ unicode_length(PyUnicodeObject *self)
PyDoc_STRVAR(ljust__doc__,
"S.ljust(width[, fillchar]) -> str\n\
\n\
Return S left justified in a Unicode string of length width. Padding is\n\
Return S left-justified in a Unicode string of length width. Padding is\n\
done using the specified fill character (default is a space).");
static PyObject *
......@@ -7815,7 +7815,7 @@ unicode_rindex(PyUnicodeObject *self, PyObject *args)
PyDoc_STRVAR(rjust__doc__,
"S.rjust(width[, fillchar]) -> str\n\
\n\
Return S right justified in a string of length width. Padding is\n\
Return S right-justified in a string of length width. Padding is\n\
done using the specified fill character (default is a space).");
static PyObject *
......@@ -7945,7 +7945,7 @@ PyDoc_STRVAR(partition__doc__,
\n\
Search for the separator sep in S, and return the part before it,\n\
the separator itself, and the part after it. If the separator is not\n\
found, returns S and two empty strings.");
found, return S and two empty strings.");
static PyObject*
unicode_partition(PyUnicodeObject *self, PyObject *separator)
......@@ -7958,7 +7958,7 @@ PyDoc_STRVAR(rpartition__doc__,
\n\
Search for the separator sep in S, starting at the end of S, and return\n\
the part before it, the separator itself, and the part after it. If the\n\
separator is not found, returns two empty strings and S.");
separator is not found, return two empty strings and S.");
static PyObject*
unicode_rpartition(PyUnicodeObject *self, PyObject *separator)
......
......@@ -730,7 +730,8 @@ class PyBuildExt(build_ext):
]
sqlite_libfile = self.compiler.find_library_file(
sqlite_dirs_to_check + lib_dirs, 'sqlite3')
sqlite_libdir = [os.path.abspath(os.path.dirname(sqlite_libfile))]
if sqlite_libfile:
sqlite_libdir = [os.path.abspath(os.path.dirname(sqlite_libfile))]
if sqlite_incdir and sqlite_libdir:
sqlite_srcs = ['_sqlite/cache.c',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment