mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
Merged revisions 61143-61144,61146-61147,61150-61151,61157,61165-61168,61170-61173,61176-61177,61183 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r61143 | barry.warsaw | 2008-03-01 03:23:38 +0100 (Sat, 01 Mar 2008) | 2 lines Bump to version 2.6a1 ........ r61144 | barry.warsaw | 2008-03-01 03:26:42 +0100 (Sat, 01 Mar 2008) | 1 line bump idle version number ........ r61146 | fred.drake | 2008-03-01 03:45:07 +0100 (Sat, 01 Mar 2008) | 2 lines fix typo ........ r61147 | barry.warsaw | 2008-03-01 03:53:36 +0100 (Sat, 01 Mar 2008) | 1 line Add date to NEWS ........ r61150 | barry.warsaw | 2008-03-01 04:00:52 +0100 (Sat, 01 Mar 2008) | 1 line Give IDLE a release date ........ r61151 | barry.warsaw | 2008-03-01 04:15:20 +0100 (Sat, 01 Mar 2008) | 1 line More copyright year and version number bumps ........ r61157 | barry.warsaw | 2008-03-01 18:11:41 +0100 (Sat, 01 Mar 2008) | 2 lines Set things up for 2.6a2. ........ r61165 | georg.brandl | 2008-03-02 07:28:16 +0100 (Sun, 02 Mar 2008) | 2 lines It's 2.6 now. ........ r61166 | georg.brandl | 2008-03-02 07:32:32 +0100 (Sun, 02 Mar 2008) | 2 lines Update year. ........ r61167 | georg.brandl | 2008-03-02 07:44:08 +0100 (Sun, 02 Mar 2008) | 2 lines Make patchlevel print out the release if called as a script. ........ r61168 | georg.brandl | 2008-03-02 07:45:40 +0100 (Sun, 02 Mar 2008) | 2 lines New default basename for HTML help files. ........ r61170 | raymond.hettinger | 2008-03-02 11:59:31 +0100 (Sun, 02 Mar 2008) | 1 line Finish-up docs for combinations() and permutations() in itertools. ........ r61171 | raymond.hettinger | 2008-03-02 12:17:51 +0100 (Sun, 02 Mar 2008) | 1 line Tighten example code. ........ r61172 | raymond.hettinger | 2008-03-02 12:57:16 +0100 (Sun, 02 Mar 2008) | 1 line Simplify code for itertools.product(). ........ r61173 | raymond.hettinger | 2008-03-02 13:02:19 +0100 (Sun, 02 Mar 2008) | 1 line Handle 0-tuples which can be singletons. ........ r61176 | georg.brandl | 2008-03-02 14:41:39 +0100 (Sun, 02 Mar 2008) | 2 lines Make clear that the constants are strings. ........ r61177 | georg.brandl | 2008-03-02 15:15:04 +0100 (Sun, 02 Mar 2008) | 2 lines Fix factual error. ........ r61183 | gregory.p.smith | 2008-03-02 21:00:53 +0100 (Sun, 02 Mar 2008) | 4 lines Modify import of test_support so that the code can also be used with a stand alone distribution of bsddb that includes its own small copy of test_support for the needed functionality on older pythons. ........
This commit is contained in:
parent
b0bf4b782f
commit
b558a2e13a
23 changed files with 134 additions and 62 deletions
|
|
@ -87,7 +87,7 @@ html_additional_pages = {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Output file base name for HTML help builder.
|
# Output file base name for HTML help builder.
|
||||||
htmlhelp_basename = 'pydoc'
|
htmlhelp_basename = 'python' + release.replace('.', '')
|
||||||
|
|
||||||
|
|
||||||
# Options for LaTeX output
|
# Options for LaTeX output
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ Copyright
|
||||||
|
|
||||||
Python and this documentation is:
|
Python and this documentation is:
|
||||||
|
|
||||||
Copyright © 2001-2007 Python Software Foundation. All rights reserved.
|
Copyright © 2001-2008 Python Software Foundation. All rights reserved.
|
||||||
|
|
||||||
Copyright © 2000 BeOpen.com. All rights reserved.
|
Copyright © 2000 BeOpen.com. All rights reserved.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,26 +102,24 @@ loops that truncate the stream.
|
||||||
Each result tuple is ordered to match the input order. So, every
|
Each result tuple is ordered to match the input order. So, every
|
||||||
combination is a subsequence of the input *iterable*.
|
combination is a subsequence of the input *iterable*.
|
||||||
|
|
||||||
Example: ``combinations(range(4), 3) --> (0,1,2), (0,1,3), (0,2,3), (1,2,3)``
|
|
||||||
|
|
||||||
Equivalent to::
|
Equivalent to::
|
||||||
|
|
||||||
def combinations(iterable, r):
|
def combinations(iterable, r):
|
||||||
|
'combinations(range(4), 3) --> (0,1,2) (0,1,3) (0,2,3) (1,2,3)'
|
||||||
pool = tuple(iterable)
|
pool = tuple(iterable)
|
||||||
n = len(pool)
|
n = len(pool)
|
||||||
assert 0 <= r <= n
|
indices = range(r)
|
||||||
vec = range(r)
|
yield tuple(pool[i] for i in indices)
|
||||||
yield tuple(pool[i] for i in vec)
|
|
||||||
while 1:
|
while 1:
|
||||||
for i in reversed(range(r)):
|
for i in reversed(range(r)):
|
||||||
if vec[i] != i + n - r:
|
if indices[i] != i + n - r:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
vec[i] += 1
|
indices[i] += 1
|
||||||
for j in range(i+1, r):
|
for j in range(i+1, r):
|
||||||
vec[j] = vec[j-1] + 1
|
indices[j] = indices[j-1] + 1
|
||||||
yield tuple(pool[i] for i in vec)
|
yield tuple(pool[i] for i in indices)
|
||||||
|
|
||||||
.. versionadded:: 2.6
|
.. versionadded:: 2.6
|
||||||
|
|
||||||
|
|
@ -356,7 +354,29 @@ loops that truncate the stream.
|
||||||
value. So if the input elements are unique, there will be no repeat
|
value. So if the input elements are unique, there will be no repeat
|
||||||
values in each permutation.
|
values in each permutation.
|
||||||
|
|
||||||
Example: ``permutations(range(3),2) --> (1,2) (1,3) (2,1) (2,3) (3,1) (3,2)``
|
Equivalent to::
|
||||||
|
|
||||||
|
def permutations(iterable, r=None):
|
||||||
|
'permutations(range(3), 2) --> (0,1) (0,2) (1,0) (1,2) (2,0) (2,1)'
|
||||||
|
pool = tuple(iterable)
|
||||||
|
n = len(pool)
|
||||||
|
r = n if r is None else r
|
||||||
|
indices = range(n)
|
||||||
|
cycles = range(n-r+1, n+1)[::-1]
|
||||||
|
yield tuple(pool[i] for i in indices[:r])
|
||||||
|
while n:
|
||||||
|
for i in reversed(range(r)):
|
||||||
|
cycles[i] -= 1
|
||||||
|
if cycles[i] == 0:
|
||||||
|
indices[i:] = indices[i+1:] + indices[i:i+1]
|
||||||
|
cycles[i] = n - i
|
||||||
|
else:
|
||||||
|
j = cycles[i]
|
||||||
|
indices[i], indices[-j] = indices[-j], indices[i]
|
||||||
|
yield tuple(pool[i] for i in indices[:r])
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
.. versionadded:: 2.6
|
.. versionadded:: 2.6
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1630,27 +1630,28 @@ timed intervals.
|
||||||
You can use the *when* to specify the type of *interval*. The list of possible
|
You can use the *when* to specify the type of *interval*. The list of possible
|
||||||
values is, note that they are not case sensitive:
|
values is, note that they are not case sensitive:
|
||||||
|
|
||||||
+----------+-----------------------+
|
+----------------+-----------------------+
|
||||||
| Value | Type of interval |
|
| Value | Type of interval |
|
||||||
+==========+=======================+
|
+================+=======================+
|
||||||
| S | Seconds |
|
| ``'S'`` | Seconds |
|
||||||
+----------+-----------------------+
|
+----------------+-----------------------+
|
||||||
| M | Minutes |
|
| ``'M'`` | Minutes |
|
||||||
+----------+-----------------------+
|
+----------------+-----------------------+
|
||||||
| H | Hours |
|
| ``'H'`` | Hours |
|
||||||
+----------+-----------------------+
|
+----------------+-----------------------+
|
||||||
| D | Days |
|
| ``'D'`` | Days |
|
||||||
+----------+-----------------------+
|
+----------------+-----------------------+
|
||||||
| W | Week day (0=Monday) |
|
| ``'W'`` | Week day (0=Monday) |
|
||||||
+----------+-----------------------+
|
+----------------+-----------------------+
|
||||||
| midnight | Roll over at midnight |
|
| ``'midnight'`` | Roll over at midnight |
|
||||||
+----------+-----------------------+
|
+----------------+-----------------------+
|
||||||
|
|
||||||
If *backupCount* is non-zero, the system will save old log files by appending
|
The system will save old log files by appending extensions to the filename.
|
||||||
extensions to the filename. The extensions are date-and-time based, using the
|
The extensions are date-and-time based, using the strftime format
|
||||||
strftime format ``%Y-%m-%d_%H-%M-%S`` or a leading portion thereof, depending on
|
``%Y-%m-%d_%H-%M-%S`` or a leading portion thereof, depending on the rollover
|
||||||
the rollover interval. At most *backupCount* files will be kept, and if more
|
interval. If *backupCount* is nonzero, at most *backupCount* files will be
|
||||||
would be created when rollover occurs, the oldest one is deleted.
|
kept, and if more would be created when rollover occurs, the oldest one is
|
||||||
|
deleted.
|
||||||
|
|
||||||
|
|
||||||
.. method:: TimedRotatingFileHandler.doRollover()
|
.. method:: TimedRotatingFileHandler.doRollover()
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ Terms and conditions for accessing or otherwise using Python
|
||||||
analyze, test, perform and/or display publicly, prepare derivative works,
|
analyze, test, perform and/or display publicly, prepare derivative works,
|
||||||
distribute, and otherwise use Python |release| alone or in any derivative
|
distribute, and otherwise use Python |release| alone or in any derivative
|
||||||
version, provided, however, that PSF's License Agreement and PSF's notice of
|
version, provided, however, that PSF's License Agreement and PSF's notice of
|
||||||
copyright, i.e., "Copyright © 2001-2007 Python Software Foundation; All Rights
|
copyright, i.e., "Copyright © 2001-2008 Python Software Foundation; All Rights
|
||||||
Reserved" are retained in Python |release| alone or in any derivative version
|
Reserved" are retained in Python |release| alone or in any derivative version
|
||||||
prepared by Licensee.
|
prepared by Licensee.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,3 +66,6 @@ def get_version_info():
|
||||||
print >>sys.stderr, 'Can\'t get version info from Include/patchlevel.h, ' \
|
print >>sys.stderr, 'Can\'t get version info from Include/patchlevel.h, ' \
|
||||||
'using version of this interpreter (%s).' % release
|
'using version of this interpreter (%s).' % release
|
||||||
return version, release
|
return version, release
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
print get_header_version_info('.')[1]
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,11 @@ except ImportError:
|
||||||
# For Python 2.3
|
# For Python 2.3
|
||||||
from bsddb import db, dbshelve
|
from bsddb import db, dbshelve
|
||||||
|
|
||||||
|
try:
|
||||||
|
from bsddb3 import test_support
|
||||||
|
except ImportError:
|
||||||
|
from test import test_support
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -107,7 +112,6 @@ class AssociateErrorTestCase(unittest.TestCase):
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.env.close()
|
self.env.close()
|
||||||
self.env = None
|
self.env = None
|
||||||
from test import test_support
|
|
||||||
test_support.rmtree(self.homeDir)
|
test_support.rmtree(self.homeDir)
|
||||||
|
|
||||||
def test00_associateDBError(self):
|
def test00_associateDBError(self):
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import errno
|
||||||
import string
|
import string
|
||||||
import tempfile
|
import tempfile
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
from test import test_support
|
|
||||||
import unittest
|
import unittest
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
@ -21,6 +20,10 @@ except ImportError:
|
||||||
from bsddb import db
|
from bsddb import db
|
||||||
|
|
||||||
from bsddb.test.test_all import verbose
|
from bsddb.test.test_all import verbose
|
||||||
|
try:
|
||||||
|
from bsddb3 import test_support
|
||||||
|
except ImportError:
|
||||||
|
from test import test_support
|
||||||
|
|
||||||
DASH = b'-'
|
DASH = b'-'
|
||||||
letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,11 @@ except ImportError:
|
||||||
# For Python 2.3
|
# For Python 2.3
|
||||||
from bsddb import db, dbshelve
|
from bsddb import db, dbshelve
|
||||||
|
|
||||||
|
try:
|
||||||
|
from bsddb3 import test_support
|
||||||
|
except ImportError:
|
||||||
|
from test import test_support
|
||||||
|
|
||||||
lexical_cmp = cmp
|
lexical_cmp = cmp
|
||||||
|
|
||||||
def lowercase_cmp(left, right):
|
def lowercase_cmp(left, right):
|
||||||
|
|
@ -84,7 +89,6 @@ class AbstractBtreeKeyCompareTestCase (unittest.TestCase):
|
||||||
if self.env is not None:
|
if self.env is not None:
|
||||||
self.env.close ()
|
self.env.close ()
|
||||||
self.env = None
|
self.env = None
|
||||||
from test import test_support
|
|
||||||
test_support.rmtree(self.homeDir)
|
test_support.rmtree(self.homeDir)
|
||||||
|
|
||||||
def addDataToDB (self, data):
|
def addDataToDB (self, data):
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,11 @@ import tempfile
|
||||||
|
|
||||||
from bsddb import db
|
from bsddb import db
|
||||||
|
|
||||||
|
try:
|
||||||
|
from bsddb3 import test_support
|
||||||
|
except ImportError:
|
||||||
|
from test import test_support
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -39,7 +44,6 @@ class pget_bugTestCase(unittest.TestCase):
|
||||||
del self.secondary_db
|
del self.secondary_db
|
||||||
del self.primary_db
|
del self.primary_db
|
||||||
del self.env
|
del self.env
|
||||||
from test import test_support
|
|
||||||
test_support.rmtree(self.homeDir)
|
test_support.rmtree(self.homeDir)
|
||||||
|
|
||||||
def test_pget(self):
|
def test_pget(self):
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,11 @@ except ImportError:
|
||||||
# For Python 2.3
|
# For Python 2.3
|
||||||
from bsddb import db, dbobj
|
from bsddb import db, dbobj
|
||||||
|
|
||||||
|
try:
|
||||||
|
from bsddb3 import test_support
|
||||||
|
except ImportError:
|
||||||
|
from test import test_support
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -29,7 +34,6 @@ class dbobjTestCase(unittest.TestCase):
|
||||||
del self.db
|
del self.db
|
||||||
if hasattr(self, 'env'):
|
if hasattr(self, 'env'):
|
||||||
del self.env
|
del self.env
|
||||||
from test import test_support
|
|
||||||
test_support.rmtree(self.homeDir)
|
test_support.rmtree(self.homeDir)
|
||||||
|
|
||||||
def test01_both(self):
|
def test01_both(self):
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,11 @@ import unittest
|
||||||
|
|
||||||
from bsddb import db, dbshelve
|
from bsddb import db, dbshelve
|
||||||
|
|
||||||
|
try:
|
||||||
|
from bsddb3 import test_support
|
||||||
|
except ImportError:
|
||||||
|
from test import test_support
|
||||||
|
|
||||||
from bsddb.test.test_all import verbose
|
from bsddb.test.test_all import verbose
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -279,7 +284,6 @@ class BasicEnvShelveTestCase(DBShelveTestCase):
|
||||||
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
from test import test_support
|
|
||||||
test_support.rmtree(self.homeDir)
|
test_support.rmtree(self.homeDir)
|
||||||
self.do_close()
|
self.do_close()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,10 @@ except ImportError:
|
||||||
# For Python 2.3
|
# For Python 2.3
|
||||||
from bsddb import db, dbtables
|
from bsddb import db, dbtables
|
||||||
|
|
||||||
|
try:
|
||||||
|
from bsddb3 import test_support
|
||||||
|
except ImportError:
|
||||||
|
from test import test_support
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
@ -52,7 +56,6 @@ class TableDBTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.tdb.close()
|
self.tdb.close()
|
||||||
from test import test_support
|
|
||||||
test_support.rmtree(self.testHomeDir)
|
test_support.rmtree(self.testHomeDir)
|
||||||
|
|
||||||
def test01(self):
|
def test01(self):
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,11 @@ except ImportError:
|
||||||
# For Python 2.3
|
# For Python 2.3
|
||||||
from bsddb import db
|
from bsddb import db
|
||||||
|
|
||||||
|
try:
|
||||||
|
from bsddb3 import test_support
|
||||||
|
except ImportError:
|
||||||
|
from test import test_support
|
||||||
|
|
||||||
from bsddb.test.test_all import verbose
|
from bsddb.test.test_all import verbose
|
||||||
|
|
||||||
# We're going to get warnings in this module about trying to close the db when
|
# We're going to get warnings in this module about trying to close the db when
|
||||||
|
|
@ -41,7 +46,6 @@ class DBEnvClosedEarlyCrash(unittest.TestCase):
|
||||||
tempfile.tempdir = None
|
tempfile.tempdir = None
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
from test import test_support
|
|
||||||
test_support.rmtree(self.homeDir)
|
test_support.rmtree(self.homeDir)
|
||||||
|
|
||||||
def test01_close_dbenv_before_db(self):
|
def test01_close_dbenv_before_db(self):
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,10 @@ from bsddb.test.test_all import verbose
|
||||||
|
|
||||||
from bsddb import db, dbshelve, StringKeys
|
from bsddb import db, dbshelve, StringKeys
|
||||||
|
|
||||||
|
try:
|
||||||
|
from bsddb3 import test_support
|
||||||
|
except ImportError:
|
||||||
|
from test import test_support
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -57,7 +61,6 @@ class JoinTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.env.close()
|
self.env.close()
|
||||||
from test import test_support
|
|
||||||
test_support.rmtree(self.homeDir)
|
test_support.rmtree(self.homeDir)
|
||||||
|
|
||||||
def test01_join(self):
|
def test01_join(self):
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,11 @@ except ImportError:
|
||||||
# For Python 2.3
|
# For Python 2.3
|
||||||
from bsddb import db
|
from bsddb import db
|
||||||
|
|
||||||
|
try:
|
||||||
|
from bsddb3 import test_support
|
||||||
|
except ImportError:
|
||||||
|
from test import test_support
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -37,7 +42,6 @@ class LockingTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.env.close()
|
self.env.close()
|
||||||
from test import test_support
|
|
||||||
test_support.rmtree(self.homeDir)
|
test_support.rmtree(self.homeDir)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,11 @@ except ImportError:
|
||||||
# For the bundled bsddb
|
# For the bundled bsddb
|
||||||
from bsddb import db, dbshelve, hashopen
|
from bsddb import db, dbshelve, hashopen
|
||||||
|
|
||||||
|
try:
|
||||||
|
from bsddb3 import test_support
|
||||||
|
except ImportError:
|
||||||
|
from test import test_support
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
class MiscTestCase(unittest.TestCase):
|
class MiscTestCase(unittest.TestCase):
|
||||||
|
|
@ -27,7 +32,6 @@ class MiscTestCase(unittest.TestCase):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
from test import test_support
|
|
||||||
test_support.unlink(self.filename)
|
test_support.unlink(self.filename)
|
||||||
test_support.rmtree(self.homeDir)
|
test_support.rmtree(self.homeDir)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,11 @@ except ImportError as e:
|
||||||
# For Python 2.3
|
# For Python 2.3
|
||||||
from bsddb import db
|
from bsddb import db
|
||||||
|
|
||||||
|
try:
|
||||||
|
from bsddb3 import test_support
|
||||||
|
except ImportError:
|
||||||
|
from test import test_support
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -31,7 +36,6 @@ class pickleTestCase(unittest.TestCase):
|
||||||
del self.db
|
del self.db
|
||||||
if hasattr(self, 'env'):
|
if hasattr(self, 'env'):
|
||||||
del self.env
|
del self.env
|
||||||
from test import test_support
|
|
||||||
test_support.rmtree(self.homeDir)
|
test_support.rmtree(self.homeDir)
|
||||||
|
|
||||||
def _base_test_pickle_DBError(self, pickle):
|
def _base_test_pickle_DBError(self, pickle):
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,11 @@ except ImportError:
|
||||||
# For Python 2.3
|
# For Python 2.3
|
||||||
from bsddb import db
|
from bsddb import db
|
||||||
|
|
||||||
|
try:
|
||||||
|
from bsddb3 import test_support
|
||||||
|
except ImportError:
|
||||||
|
from test import test_support
|
||||||
|
|
||||||
letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -29,7 +34,6 @@ class SimpleRecnoTestCase(unittest.TestCase):
|
||||||
self.homeDir = None
|
self.homeDir = None
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
from test import test_support
|
|
||||||
test_support.unlink(self.filename)
|
test_support.unlink(self.filename)
|
||||||
if self.homeDir:
|
if self.homeDir:
|
||||||
test_support.rmtree(self.homeDir)
|
test_support.rmtree(self.homeDir)
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,10 @@ except ImportError:
|
||||||
from bsddb import db
|
from bsddb import db
|
||||||
|
|
||||||
from bsddb.test.test_all import verbose
|
from bsddb.test.test_all import verbose
|
||||||
|
try:
|
||||||
|
from bsddb3 import test_support
|
||||||
|
except ImportError:
|
||||||
|
from test import test_support
|
||||||
|
|
||||||
|
|
||||||
class DBSequenceTest(unittest.TestCase):
|
class DBSequenceTest(unittest.TestCase):
|
||||||
|
|
@ -41,7 +45,6 @@ class DBSequenceTest(unittest.TestCase):
|
||||||
self.dbenv.close()
|
self.dbenv.close()
|
||||||
del self.dbenv
|
del self.dbenv
|
||||||
|
|
||||||
from test import test_support
|
|
||||||
test_support.rmtree(self.homeDir)
|
test_support.rmtree(self.homeDir)
|
||||||
|
|
||||||
def test_get(self):
|
def test_get(self):
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,11 @@ except ImportError:
|
||||||
# For Python 2.3
|
# For Python 2.3
|
||||||
from bsddb import db, dbutils
|
from bsddb import db, dbutils
|
||||||
|
|
||||||
|
try:
|
||||||
|
from bsddb3 import test_support
|
||||||
|
except ImportError:
|
||||||
|
from test import test_support
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -63,7 +68,6 @@ class BaseThreadedTestCase(unittest.TestCase):
|
||||||
self.d.open(self.filename, self.dbtype, self.dbopenflags|db.DB_CREATE)
|
self.d.open(self.filename, self.dbtype, self.dbopenflags|db.DB_CREATE)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
from test import test_support
|
|
||||||
test_support.rmtree(self.homeDir)
|
test_support.rmtree(self.homeDir)
|
||||||
self.d.close()
|
self.d.close()
|
||||||
self.env.close()
|
self.env.close()
|
||||||
|
|
|
||||||
|
|
@ -1740,7 +1740,6 @@ static PyTypeObject chain_type = {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
PyObject *pools; /* tuple of pool tuples */
|
PyObject *pools; /* tuple of pool tuples */
|
||||||
Py_ssize_t *maxvec; /* size of each pool */
|
|
||||||
Py_ssize_t *indices; /* one index per pool */
|
Py_ssize_t *indices; /* one index per pool */
|
||||||
PyObject *result; /* most recently returned result tuple */
|
PyObject *result; /* most recently returned result tuple */
|
||||||
int stopped; /* set to 1 when the product iterator is exhausted */
|
int stopped; /* set to 1 when the product iterator is exhausted */
|
||||||
|
|
@ -1754,7 +1753,6 @@ product_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
productobject *lz;
|
productobject *lz;
|
||||||
Py_ssize_t nargs, npools, repeat=1;
|
Py_ssize_t nargs, npools, repeat=1;
|
||||||
PyObject *pools = NULL;
|
PyObject *pools = NULL;
|
||||||
Py_ssize_t *maxvec = NULL;
|
|
||||||
Py_ssize_t *indices = NULL;
|
Py_ssize_t *indices = NULL;
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
|
|
||||||
|
|
@ -1779,9 +1777,8 @@ product_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
nargs = (repeat == 0) ? 0 : PyTuple_GET_SIZE(args);
|
nargs = (repeat == 0) ? 0 : PyTuple_GET_SIZE(args);
|
||||||
npools = nargs * repeat;
|
npools = nargs * repeat;
|
||||||
|
|
||||||
maxvec = PyMem_Malloc(npools * sizeof(Py_ssize_t));
|
|
||||||
indices = PyMem_Malloc(npools * sizeof(Py_ssize_t));
|
indices = PyMem_Malloc(npools * sizeof(Py_ssize_t));
|
||||||
if (maxvec == NULL || indices == NULL) {
|
if (indices == NULL) {
|
||||||
PyErr_NoMemory();
|
PyErr_NoMemory();
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
@ -1795,16 +1792,13 @@ product_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
PyObject *pool = PySequence_Tuple(item);
|
PyObject *pool = PySequence_Tuple(item);
|
||||||
if (pool == NULL)
|
if (pool == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
PyTuple_SET_ITEM(pools, i, pool);
|
PyTuple_SET_ITEM(pools, i, pool);
|
||||||
maxvec[i] = PyTuple_GET_SIZE(pool);
|
|
||||||
indices[i] = 0;
|
indices[i] = 0;
|
||||||
}
|
}
|
||||||
for ( ; i < npools; ++i) {
|
for ( ; i < npools; ++i) {
|
||||||
PyObject *pool = PyTuple_GET_ITEM(pools, i - nargs);
|
PyObject *pool = PyTuple_GET_ITEM(pools, i - nargs);
|
||||||
Py_INCREF(pool);
|
Py_INCREF(pool);
|
||||||
PyTuple_SET_ITEM(pools, i, pool);
|
PyTuple_SET_ITEM(pools, i, pool);
|
||||||
maxvec[i] = maxvec[i - nargs];
|
|
||||||
indices[i] = 0;
|
indices[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1814,7 +1808,6 @@ product_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
lz->pools = pools;
|
lz->pools = pools;
|
||||||
lz->maxvec = maxvec;
|
|
||||||
lz->indices = indices;
|
lz->indices = indices;
|
||||||
lz->result = NULL;
|
lz->result = NULL;
|
||||||
lz->stopped = 0;
|
lz->stopped = 0;
|
||||||
|
|
@ -1822,8 +1815,6 @@ product_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
return (PyObject *)lz;
|
return (PyObject *)lz;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (maxvec != NULL)
|
|
||||||
PyMem_Free(maxvec);
|
|
||||||
if (indices != NULL)
|
if (indices != NULL)
|
||||||
PyMem_Free(indices);
|
PyMem_Free(indices);
|
||||||
Py_XDECREF(pools);
|
Py_XDECREF(pools);
|
||||||
|
|
@ -1836,7 +1827,6 @@ product_dealloc(productobject *lz)
|
||||||
PyObject_GC_UnTrack(lz);
|
PyObject_GC_UnTrack(lz);
|
||||||
Py_XDECREF(lz->pools);
|
Py_XDECREF(lz->pools);
|
||||||
Py_XDECREF(lz->result);
|
Py_XDECREF(lz->result);
|
||||||
PyMem_Free(lz->maxvec);
|
|
||||||
PyMem_Free(lz->indices);
|
PyMem_Free(lz->indices);
|
||||||
Py_TYPE(lz)->tp_free(lz);
|
Py_TYPE(lz)->tp_free(lz);
|
||||||
}
|
}
|
||||||
|
|
@ -1883,7 +1873,6 @@ product_next(productobject *lz)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Py_ssize_t *indices = lz->indices;
|
Py_ssize_t *indices = lz->indices;
|
||||||
Py_ssize_t *maxvec = lz->maxvec;
|
|
||||||
|
|
||||||
/* Copy the previous result tuple or re-use it if available */
|
/* Copy the previous result tuple or re-use it if available */
|
||||||
if (Py_REFCNT(result) > 1) {
|
if (Py_REFCNT(result) > 1) {
|
||||||
|
|
@ -1900,14 +1889,14 @@ product_next(productobject *lz)
|
||||||
Py_DECREF(old_result);
|
Py_DECREF(old_result);
|
||||||
}
|
}
|
||||||
/* Now, we've got the only copy so we can update it in-place */
|
/* Now, we've got the only copy so we can update it in-place */
|
||||||
assert (Py_REFCNT(result) == 1);
|
assert (npools==0 || Py_REFCNT(result) == 1);
|
||||||
|
|
||||||
/* Update the pool indices right-to-left. Only advance to the
|
/* Update the pool indices right-to-left. Only advance to the
|
||||||
next pool when the previous one rolls-over */
|
next pool when the previous one rolls-over */
|
||||||
for (i=npools-1 ; i >= 0 ; i--) {
|
for (i=npools-1 ; i >= 0 ; i--) {
|
||||||
pool = PyTuple_GET_ITEM(pools, i);
|
pool = PyTuple_GET_ITEM(pools, i);
|
||||||
indices[i]++;
|
indices[i]++;
|
||||||
if (indices[i] == maxvec[i]) {
|
if (indices[i] == PyTuple_GET_SIZE(pool)) {
|
||||||
/* Roll-over and advance to next pool */
|
/* Roll-over and advance to next pool */
|
||||||
indices[i] = 0;
|
indices[i] = 0;
|
||||||
elem = PyTuple_GET_ITEM(pool, 0);
|
elem = PyTuple_GET_ITEM(pool, 0);
|
||||||
|
|
|
||||||
3
README
3
README
|
|
@ -2,6 +2,9 @@ This is Python version 3.0 alpha 3
|
||||||
==================================
|
==================================
|
||||||
|
|
||||||
For notes specific to this release, see RELNOTES in this directory.
|
For notes specific to this release, see RELNOTES in this directory.
|
||||||
|
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
||||||
|
Python Software Foundation.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
Python 3000 (a.k.a. "Py3k", and released as Python 3.0) is a new
|
Python 3000 (a.k.a. "Py3k", and released as Python 3.0) is a new
|
||||||
version of the language, which is incompatible with the 2.x line of
|
version of the language, which is incompatible with the 2.x line of
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue