Merged revisions 66766-66767,66771-66772,66774,66776,66783-66787,66790,66793,66797 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

................
  r66766 | benjamin.peterson | 2008-10-03 06:52:06 -0500 (Fri, 03 Oct 2008) | 1 line

  update the mac installer script
................
  r66767 | andrew.kuchling | 2008-10-03 07:26:42 -0500 (Fri, 03 Oct 2008) | 1 line

  Docstring typo.
................
  r66771 | hirokazu.yamamoto | 2008-10-03 11:18:42 -0500 (Fri, 03 Oct 2008) | 2 lines

  Fixed following error when DocXMLRPCServer failed.
    UnboundLocalError: local variable 'serv' referenced before assignment
................
  r66772 | andrew.kuchling | 2008-10-03 11:29:19 -0500 (Fri, 03 Oct 2008) | 1 line

  Mention exception in docstring
................
  r66774 | andrew.kuchling | 2008-10-03 11:42:52 -0500 (Fri, 03 Oct 2008) | 1 line

  Typo fix
................
  r66776 | hirokazu.yamamoto | 2008-10-03 12:34:49 -0500 (Fri, 03 Oct 2008) | 2 lines

  Issue #1706863: Fixed "'NoneType' object has no attribute 'rfind'" error when sqlite libfile not found.
................
  r66783 | andrew.kuchling | 2008-10-03 20:02:29 -0500 (Fri, 03 Oct 2008) | 1 line

  Use correct capitalization of NaN
................
  r66784 | andrew.kuchling | 2008-10-03 20:03:42 -0500 (Fri, 03 Oct 2008) | 1 line

  Docstring change: Specify exception raised
................
  r66785 | andrew.kuchling | 2008-10-03 20:04:24 -0500 (Fri, 03 Oct 2008) | 1 line

  Docstring changes: Specify exceptions raised
................
  r66786 | andrew.kuchling | 2008-10-03 20:05:56 -0500 (Fri, 03 Oct 2008) | 3 lines

  Docstring change for *partition: use same tense as other docstrings.
  Hyphenate left- and right-justified.
  Fix 'registerd' typo
................
  r66787 | andrew.kuchling | 2008-10-03 22:08:56 -0500 (Fri, 03 Oct 2008) | 1 line

  two corrections
................
  r66790 | andrew.kuchling | 2008-10-04 11:52:01 -0500 (Sat, 04 Oct 2008) | 1 line

  Set svn:keywords
................
  r66793 | georg.brandl | 2008-10-04 13:26:01 -0500 (Sat, 04 Oct 2008) | 2 lines

  #4041: don't refer to removed and outdated modules.
................
  r66797 | benjamin.peterson | 2008-10-04 15:55:50 -0500 (Sat, 04 Oct 2008) | 19 lines

  Merged revisions 66707,66775,66782 via svnmerge from
  svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3

  ........
    r66707 | benjamin.peterson | 2008-09-30 18:27:10 -0500 (Tue, 30 Sep 2008) | 1 line

    fix #4001: fix_imports didn't check for __init__.py before converting to relative imports
  ........
    r66775 | collin.winter | 2008-10-03 12:08:26 -0500 (Fri, 03 Oct 2008) | 4 lines

    Add an alternative iterative pattern matching system that, while slower, correctly parses files that cause the faster recursive pattern matcher to fail with a recursion error. lib2to3 falls back to the iterative matcher if the recursive one fails.

    Fixes http://bugs.python.org/issue2532. Thanks to Nick Edds.
  ........
    r66782 | benjamin.peterson | 2008-10-03 17:51:36 -0500 (Fri, 03 Oct 2008) | 1 line

    add Victor Stinner's fixer for os.getcwdu -> os.getcwd #4023
  ........
................
This commit is contained in:
Benjamin Peterson 2008-10-04 21:33:08 +00:00
parent 81f66f3c65
commit be2c0a9fe3
21 changed files with 2885 additions and 56 deletions

View File

@ -24,10 +24,8 @@ available. They are listed here in alphabetical order.
The function is invoked by the :keyword:`import` statement. It mainly exists 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 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. interface, in order to change the semantics of the :keyword:`import` statement.
For examples of why and how you would do this, see the standard library modules See the built-in module :mod:`imp`, which defines some useful operations out
:mod:`ihooks` and :mod:`rexec`. See also the built-in module :mod:`imp`, which of which you can build your own :func:`__import__` function.
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: For example, the statement ``import spam`` results in the following call:
``__import__('spam', globals(), locals(), [], -1)``; the statement ``__import__('spam', globals(), locals(), [], -1)``; the statement

View File

@ -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 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 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 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 because Python is dynamically typed, it can be difficult to determine the
possible types of the operands. possible types of the operands.

View File

@ -8,7 +8,7 @@
:Release: |release| :Release: |release|
:Date: |today| :Date: |today|
.. $Id: whatsnew26.tex 55746 2007-06-02 18:33:53Z neal.norwitz $ .. $Id$
Rules for maintenance: Rules for maintenance:
* Anyone can add text to this document. Do not spend very much time * Anyone can add text to this document. Do not spend very much time
@ -2753,7 +2753,7 @@ representing a literal expression, parses and evaluates it, and
returns the resulting value. A literal expression is a Python returns the resulting value. A literal expression is a Python
expression containing only strings, numbers, dictionaries, expression containing only strings, numbers, dictionaries,
etc. but no statements or function calls. If you need to etc. but no statements or function calls. If you need to
evaluate an expression but accept the security risk of using an evaluate an expression but cannot accept the security risk of using an
:func:`eval` call, :func:`literal_eval` will handle it safely:: :func:`eval` call, :func:`literal_eval` will handle it safely::
>>> literal = '("a", "b", {2:4, 3:8, 1:2})' >>> literal = '("a", "b", {2:4, 3:8, 1:2})'
@ -3039,7 +3039,7 @@ Changes to Python's build process and to the C API include:
``numfree``, and a macro ``Py<typename>_MAXFREELIST`` is ``numfree``, and a macro ``Py<typename>_MAXFREELIST`` is
always defined. always defined.
* A new Makefile target, "make check", prepares the Python source tree * A new Makefile target, "make patchcheck", prepares the Python source tree
for making a patch: it fixes trailing whitespace in all modified for making a patch: it fixes trailing whitespace in all modified
``.py`` files, checks whether the documentation has been changed, ``.py`` files, checks whether the documentation has been changed,
and reports whether the :file:`Misc/ACKS` and :file:`Misc/NEWS` files and reports whether the :file:`Misc/ACKS` and :file:`Misc/NEWS` files
@ -3267,6 +3267,6 @@ Acknowledgements
The author would like to thank the following people for offering The author would like to thank the following people for offering
suggestions, corrections and assistance with various drafts of this suggestions, corrections and assistance with various drafts of this
article: Georg Brandl, Steve Brown, Nick Coghlan, Jim Jewett, Kent article: Georg Brandl, Steve Brown, Nick Coghlan, Ralph Corderoy,
Johnson, Chris Lambacher, Antoine Pitrou. Jim Jewett, Kent Johnson, Chris Lambacher, Antoine Pitrou, Brian Warner.

View File

@ -0,0 +1,18 @@
"""
Fixer that changes os.getcwdu() to os.getcwd().
"""
# Author: Victor Stinner
# Local imports
from .. import fixer_base
from ..fixer_util import Name
class FixGetcwdu(fixer_base.BaseFix):
PATTERN = """
power< 'os' trailer< dot='.' name='getcwdu' > any* >
"""
def transform(self, node, results):
name = results["name"]
name.replace(Name("getcwd", prefix=name.get_prefix()))

View File

@ -54,6 +54,10 @@ def probably_a_local_import(imp_name, file_path):
imp_name = imp_name.split('.', 1)[0].strip() imp_name = imp_name.split('.', 1)[0].strip()
base_path = dirname(file_path) base_path = dirname(file_path)
base_path = join(base_path, imp_name) base_path = join(base_path, imp_name)
# If there is no __init__.py next to the file its not in a package
# so can't be a relative import.
if not exists(join(dirname(base_path), '__init__.py')):
return False
for ext in ['.py', pathsep, '.pyc', '.so', '.sl', '.pyd']: for ext in ['.py', pathsep, '.pyc', '.so', '.sl', '.pyd']:
if exists(base_path + ext): if exists(base_path + ext):
return True return True

View File

@ -655,10 +655,47 @@ class WildcardPattern(BasePattern):
elif self.name == "bare_name": elif self.name == "bare_name":
yield self._bare_name_matches(nodes) yield self._bare_name_matches(nodes)
else: else:
for count, r in self._recursive_matches(nodes, 0): try:
if self.name: for count, r in self._recursive_matches(nodes, 0):
r[self.name] = nodes[:count] if self.name:
yield count, r r[self.name] = nodes[:count]
yield count, r
except RuntimeError:
# We fall back to the iterative pattern matching scheme if the recursive
# scheme hits the recursion limit.
for count, r in self._iterative_matches(nodes):
if self.name:
r[self.name] = nodes[:count]
yield count, r
def _iterative_matches(self, nodes):
"""Helper to iteratively yield the matches."""
nodelen = len(nodes)
if 0 >= self.min:
yield 0, {}
results = []
# generate matches that use just one alt from self.content
for alt in self.content:
for c, r in generate_matches(alt, nodes):
yield c, r
results.append((c, r))
# for each match, iterate down the nodes
while results:
new_results = []
for c0, r0 in results:
# stop if the entire set of nodes has been matched
if c0 < nodelen and c0 <= self.max:
for alt in self.content:
for c1, r1 in generate_matches(alt, nodes[c0:]):
if c1 > 0:
r = {}
r.update(r0)
r.update(r1)
yield c0 + c1, r
new_results.append((c0 + c1, r))
results = new_results
def _bare_name_matches(self, nodes): def _bare_name_matches(self, nodes):
"""Special optimized matcher for bare_name.""" """Special optimized matcher for bare_name."""

View File

@ -0,0 +1,5 @@
Files in this directory:
- py2_test_grammar.py -- test file that exercises most/all of Python 2.x's grammar.
- py3_test_grammar.py -- test file that exercises most/all of Python 3.x's grammar.
- infinite_recursion.py -- test file that causes lib2to3's faster recursive pattern matching
scheme to fail, but passes when lib2to3 falls back to iterative pattern matching.

File diff suppressed because it is too large Load Diff

View File

@ -9,10 +9,10 @@ except ImportError:
import support import support
# Python imports # Python imports
import os
import unittest import unittest
from itertools import chain from itertools import chain
from operator import itemgetter from operator import itemgetter
from os.path import dirname, pathsep
# Local imports # Local imports
from .. import pygram from .. import pygram
@ -3274,14 +3274,19 @@ class Test_import(FixerTestCase):
# Need to replace fix_import's exists method # Need to replace fix_import's exists method
# so we can check that it's doing the right thing # so we can check that it's doing the right thing
self.files_checked = [] self.files_checked = []
self.present_files = set()
self.always_exists = True self.always_exists = True
def fake_exists(name): def fake_exists(name):
self.files_checked.append(name) self.files_checked.append(name)
return self.always_exists return self.always_exists or (name in self.present_files)
from ..fixes import fix_import from ..fixes import fix_import
fix_import.exists = fake_exists fix_import.exists = fake_exists
def tearDown(self):
from lib2to3.fixes import fix_import
fix_import.exists = os.path.exists
def check_both(self, b, a): def check_both(self, b, a):
self.always_exists = True self.always_exists = True
FixerTestCase.check(self, b, a) FixerTestCase.check(self, b, a)
@ -3291,10 +3296,12 @@ class Test_import(FixerTestCase):
def test_files_checked(self): def test_files_checked(self):
def p(path): def p(path):
# Takes a unix path and returns a path with correct separators # Takes a unix path and returns a path with correct separators
return pathsep.join(path.split("/")) return os.path.pathsep.join(path.split("/"))
self.always_exists = False self.always_exists = False
expected_extensions = ('.py', pathsep, '.pyc', '.so', '.sl', '.pyd') self.present_files = set(['__init__.py'])
expected_extensions = ('.py', os.path.pathsep, '.pyc', '.so',
'.sl', '.pyd')
names_to_test = (p("/spam/eggs.py"), "ni.py", p("../../shrubbery.py")) names_to_test = (p("/spam/eggs.py"), "ni.py", p("../../shrubbery.py"))
for name in names_to_test: for name in names_to_test:
@ -3302,11 +3309,32 @@ class Test_import(FixerTestCase):
self.filename = name self.filename = name
self.unchanged("import jam") self.unchanged("import jam")
if dirname(name): name = dirname(name) + '/jam' if os.path.dirname(name):
else: name = 'jam' name = os.path.dirname(name) + '/jam'
else:
name = 'jam'
expected_checks = set(name + ext for ext in expected_extensions) expected_checks = set(name + ext for ext in expected_extensions)
expected_checks.add("__init__.py")
self.failUnlessEqual(set(self.files_checked), expected_checks) self.assertEqual(set(self.files_checked), expected_checks)
def test_not_in_package(self):
s = "import bar"
self.always_exists = False
self.present_files = set(["bar.py"])
self.unchanged(s)
def test_in_package(self):
b = "import bar"
a = "from . import bar"
self.always_exists = False
self.present_files = set(["__init__.py", "bar.py"])
self.check(b, a)
def test_comments_and_indent(self):
b = "import bar # Foo"
a = "from . import bar # Foo"
self.check(b, a)
def test_from(self): def test_from(self):
b = "from foo import bar, baz" b = "from foo import bar, baz"
@ -3577,6 +3605,67 @@ class Test_metaclass(FixerTestCase):
self.check(b, a) self.check(b, a)
class Test_getcwdu(FixerTestCase):
fixer = 'getcwdu'
def test_basic(self):
b = """os.getcwdu"""
a = """os.getcwd"""
self.check(b, a)
b = """os.getcwdu()"""
a = """os.getcwd()"""
self.check(b, a)
b = """meth = os.getcwdu"""
a = """meth = os.getcwd"""
self.check(b, a)
b = """os.getcwdu(args)"""
a = """os.getcwd(args)"""
self.check(b, a)
def test_comment(self):
b = """os.getcwdu() # Foo"""
a = """os.getcwd() # Foo"""
self.check(b, a)
def test_unchanged(self):
s = """os.getcwd()"""
self.unchanged(s)
s = """getcwdu()"""
self.unchanged(s)
s = """os.getcwdb()"""
self.unchanged(s)
def test_indentation(self):
b = """
if 1:
os.getcwdu()
"""
a = """
if 1:
os.getcwd()
"""
self.check(b, a)
def test_multilation(self):
b = """os .getcwdu()"""
a = """os .getcwd()"""
self.check(b, a)
b = """os. getcwdu"""
a = """os. getcwd"""
self.check(b, a)
b = """os.getcwdu ( )"""
a = """os.getcwd ( )"""
self.check(b, a)
if __name__ == "__main__": if __name__ == "__main__":
import __main__ import __main__
support.run_all_tests(__main__) support.run_all_tests(__main__)

View File

@ -253,7 +253,7 @@ class TestTimeDelta(HarmlessMixedComparison, unittest.TestCase):
self.assertRaises(TypeError, lambda: a // x) self.assertRaises(TypeError, lambda: a // x)
self.assertRaises(TypeError, lambda: x // a) 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. # Division by zero doesn't make sense.
for zero in 0, 0L: for zero in 0, 0L:
self.assertRaises(TypeError, lambda: zero // a) self.assertRaises(TypeError, lambda: zero // a)

View File

@ -9,9 +9,9 @@ import xmlrpclib
PORT = None PORT = None
def server(evt, numrequests): def server(evt, numrequests):
try: serv = DocXMLRPCServer(("localhost", 0), logRequests=False)
serv = DocXMLRPCServer(("localhost", 0), logRequests=False)
try:
global PORT global PORT
PORT = serv.socket.getsockname()[1] PORT = serv.socket.getsockname()[1]

View File

@ -129,8 +129,8 @@ LIBRARY_RECIPES = [
), ),
dict( dict(
name="SQLite 3.3.5", name="SQLite 3.6.3",
url="http://www.sqlite.org/sqlite-3.3.5.tar.gz", url="http://www.sqlite.org/sqlite-3.6.3.tar.gz",
checksum='93f742986e8bc2dfa34792e16df017a6feccf3a2', checksum='93f742986e8bc2dfa34792e16df017a6feccf3a2',
configure_pre=[ configure_pre=[
'--enable-threadsafe', '--enable-threadsafe',
@ -170,8 +170,8 @@ LIBRARY_RECIPES = [
), ),
), ),
dict( dict(
name="Sleepycat DB 4.4", name="Sleepycat DB 4.7.25",
url="http://downloads.sleepycat.com/db-4.4.20.tar.gz", url="http://download.oracle.com/berkeley-db/db-4.7.25.tar.gz",
#name="Sleepycat DB 4.3.29", #name="Sleepycat DB 4.3.29",
#url="http://downloads.sleepycat.com/db-4.3.29.tar.gz", #url="http://downloads.sleepycat.com/db-4.3.29.tar.gz",
buildDir="build_unix", buildDir="build_unix",
@ -585,21 +585,23 @@ def buildPythonDocs():
version = getVersion() version = getVersion()
docdir = os.path.join(rootDir, 'pydocs') docdir = os.path.join(rootDir, 'pydocs')
novername = 'python-docs-html.tar.bz2'
name = 'html-%s.tar.bz2'%(getFullVersion(),) name = 'html-%s.tar.bz2'%(getFullVersion(),)
sourceArchive = os.path.join(DEPSRC, name) sourceArchive = os.path.join(DEPSRC, name)
if os.path.exists(sourceArchive): if os.path.exists(sourceArchive):
print "Using local copy of %s"%(name,) print "Using local copy of %s"%(name,)
else: else:
print "Downloading %s"%(name,) print "Downloading %s"%(novername,)
downloadURL('http://www.python.org/ftp/python/doc/%s/%s'%( 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) print "Archive for %s stored as %s"%(name, sourceArchive)
extractArchive(os.path.dirname(docdir), sourceArchive) extractArchive(os.path.dirname(docdir), sourceArchive)
os.rename( os.rename(
os.path.join( os.path.join(
os.path.dirname(docdir), 'Python-Docs-%s'%(getFullVersion(),)), os.path.dirname(docdir), 'python-docs-html'),
docdir) docdir)
@ -1028,11 +1030,11 @@ def main():
buildPython() buildPython()
buildPythonDocs() buildPythonDocs()
fn = os.path.join(WORKDIR, "_root", "Applications", 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) patchFile("scripts/postflight.patch-profile", fn)
os.chmod(fn, 0755) os.chmod(fn, 0755)
folder = os.path.join(WORKDIR, "_root", "Applications", "MacPython %s"%( folder = os.path.join(WORKDIR, "_root", "Applications", "Python %s"%(
getVersion(),)) getVersion(),))
os.chmod(folder, 0755) os.chmod(folder, 0755)
setIcon(folder, "../Icons/Python Folder.icns") setIcon(folder, "../Icons/Python Folder.icns")

View File

@ -115,7 +115,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\ 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\ handling scheme. Default is 'strict' meaning that encoding errors raise\n\
a ValueError. Other possible values are 'ignore' and 'replace'\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."); able to handle ValueErrors.");
static PyObject * static PyObject *

View File

@ -36,7 +36,7 @@ PyDoc_STRVAR(MultibyteCodec_Decode__doc__,
Decodes `string' using I, an MultibyteCodec instance. errors may be given\n\ Decodes `string' using I, an MultibyteCodec instance. errors may be given\n\
to set a different error handling scheme. Default is 'strict' meaning\n\ to set a different error handling scheme. Default is 'strict' meaning\n\
that encoding errors raise a UnicodeDecodeError. Other possible values\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."); codecs.register_error that is able to handle UnicodeDecodeErrors.");
static char *codeckwarglist[] = {"input", "errors", NULL}; static char *codeckwarglist[] = {"input", "errors", NULL};

View File

@ -1548,7 +1548,7 @@ float_as_integer_ratio(PyObject *v, PyObject *unused)
#ifdef Py_NAN #ifdef Py_NAN
if (Py_IS_NAN(self)) { if (Py_IS_NAN(self)) {
PyErr_SetString(PyExc_ValueError, PyErr_SetString(PyExc_ValueError,
"Cannot pass nan to float.as_integer_ratio."); "Cannot pass NaN to float.as_integer_ratio.");
return NULL; return NULL;
} }
#endif #endif
@ -1607,7 +1607,7 @@ PyDoc_STRVAR(float_as_integer_ratio_doc,
"\n" "\n"
"Returns a pair of integers, whose ratio is exactly equal to the original\n" "Returns a pair of integers, whose ratio is exactly equal to the original\n"
"float and with a positive denominator.\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" "\n"
">>> (10.0).as_integer_ratio()\n" ">>> (10.0).as_integer_ratio()\n"
"(10, 1)\n" "(10, 1)\n"

View File

@ -2459,11 +2459,14 @@ PyDoc_STRVAR(extend_doc,
PyDoc_STRVAR(insert_doc, PyDoc_STRVAR(insert_doc,
"L.insert(index, object) -- insert object before index"); "L.insert(index, object) -- insert object before index");
PyDoc_STRVAR(pop_doc, 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, 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, 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, PyDoc_STRVAR(count_doc,
"L.count(value) -> integer -- return number of occurrences of value"); "L.count(value) -> integer -- return number of occurrences of value");
PyDoc_STRVAR(reverse_doc, PyDoc_STRVAR(reverse_doc,

View File

@ -754,7 +754,8 @@ set_pop(PySetObject *so)
return key; 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 static int
set_traverse(PySetObject *so, visitproc visit, void *arg) set_traverse(PySetObject *so, visitproc visit, void *arg)

View File

@ -1591,9 +1591,9 @@ string_split(PyStringObject *self, PyObject *args)
PyDoc_STRVAR(partition__doc__, PyDoc_STRVAR(partition__doc__,
"S.partition(sep) -> (head, sep, tail)\n\ "S.partition(sep) -> (head, sep, tail)\n\
\n\ \n\
Searches for the separator sep in S, and returns the part before it,\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\ 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 * static PyObject *
string_partition(PyStringObject *self, PyObject *sep_obj) string_partition(PyStringObject *self, PyObject *sep_obj)
@ -1622,9 +1622,9 @@ string_partition(PyStringObject *self, PyObject *sep_obj)
PyDoc_STRVAR(rpartition__doc__, PyDoc_STRVAR(rpartition__doc__,
"S.rpartition(sep) -> (tail, sep, head)\n\ "S.rpartition(sep) -> (tail, sep, head)\n\
\n\ \n\
Searches for the separator sep in S, starting at the end of S, and returns\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\ 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 * static PyObject *
string_rpartition(PyStringObject *self, PyObject *sep_obj) string_rpartition(PyStringObject *self, PyObject *sep_obj)
@ -3357,7 +3357,7 @@ Decodes S using the codec registered for encoding. encoding defaults\n\
to the default encoding. errors may be given to set a different error\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\ handling scheme. Default is 'strict' meaning that encoding errors raise\n\
a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n\ a UnicodeDecodeError. 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 UnicodeDecodeErrors."); able to handle UnicodeDecodeErrors.");
static PyObject * static PyObject *
@ -3506,7 +3506,7 @@ pad(PyStringObject *self, Py_ssize_t left, Py_ssize_t right, char fill)
PyDoc_STRVAR(ljust__doc__, PyDoc_STRVAR(ljust__doc__,
"S.ljust(width[, fillchar]) -> string\n" "S.ljust(width[, fillchar]) -> string\n"
"\n" "\n"
"Return S left justified in a string of length width. Padding is\n" "Return S left-justified in a string of length width. Padding is\n"
"done using the specified fill character (default is a space)."); "done using the specified fill character (default is a space).");
static PyObject * static PyObject *
@ -3530,7 +3530,7 @@ string_ljust(PyStringObject *self, PyObject *args)
PyDoc_STRVAR(rjust__doc__, PyDoc_STRVAR(rjust__doc__,
"S.rjust(width[, fillchar]) -> string\n" "S.rjust(width[, fillchar]) -> string\n"
"\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)"); "done using the specified fill character (default is a space)");
static PyObject * static PyObject *

View File

@ -719,7 +719,9 @@ tuple_sizeof(PyTupleObject *self)
} }
PyDoc_STRVAR(index_doc, 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, PyDoc_STRVAR(count_doc,
"T.count(value) -> integer -- return number of occurrences of value"); "T.count(value) -> integer -- return number of occurrences of value");
PyDoc_STRVAR(sizeof_doc, PyDoc_STRVAR(sizeof_doc,

View File

@ -7070,7 +7070,7 @@ unicode_length(PyUnicodeObject *self)
PyDoc_STRVAR(ljust__doc__, PyDoc_STRVAR(ljust__doc__,
"S.ljust(width[, fillchar]) -> int\n\ "S.ljust(width[, fillchar]) -> int\n\
\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)."); done using the specified fill character (default is a space).");
static PyObject * static PyObject *
@ -7456,7 +7456,7 @@ unicode_rindex(PyUnicodeObject *self, PyObject *args)
PyDoc_STRVAR(rjust__doc__, PyDoc_STRVAR(rjust__doc__,
"S.rjust(width[, fillchar]) -> unicode\n\ "S.rjust(width[, fillchar]) -> unicode\n\
\n\ \n\
Return S right justified in a Unicode string of length width. Padding is\n\ Return S right-justified in a Unicode string of length width. Padding is\n\
done using the specified fill character (default is a space)."); done using the specified fill character (default is a space).");
static PyObject * static PyObject *
@ -7606,9 +7606,9 @@ PyUnicode_RPartition(PyObject *str_in, PyObject *sep_in)
PyDoc_STRVAR(partition__doc__, PyDoc_STRVAR(partition__doc__,
"S.partition(sep) -> (head, sep, tail)\n\ "S.partition(sep) -> (head, sep, tail)\n\
\n\ \n\
Searches for the separator sep in S, and returns the part before it,\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\ 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* static PyObject*
unicode_partition(PyUnicodeObject *self, PyObject *separator) unicode_partition(PyUnicodeObject *self, PyObject *separator)
@ -7619,9 +7619,9 @@ unicode_partition(PyUnicodeObject *self, PyObject *separator)
PyDoc_STRVAR(rpartition__doc__, PyDoc_STRVAR(rpartition__doc__,
"S.rpartition(sep) -> (tail, sep, head)\n\ "S.rpartition(sep) -> (tail, sep, head)\n\
\n\ \n\
Searches for the separator sep in S, starting at the end of S, and returns\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\ 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* static PyObject*
unicode_rpartition(PyUnicodeObject *self, PyObject *separator) unicode_rpartition(PyUnicodeObject *self, PyObject *separator)

View File

@ -934,7 +934,8 @@ class PyBuildExt(build_ext):
] ]
sqlite_libfile = self.compiler.find_library_file( sqlite_libfile = self.compiler.find_library_file(
sqlite_dirs_to_check + lib_dirs, 'sqlite3') 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: if sqlite_incdir and sqlite_libdir:
sqlite_srcs = ['_sqlite/cache.c', sqlite_srcs = ['_sqlite/cache.c',