summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-02-03 16:51:08 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-02-03 16:51:08 (GMT)
commit292d351fc1a7dc9feccd412843832808680a631f (patch)
tree918a0dea0d70345e0279b9b9649c6e427a076118
parentec17d204f963f37da02e6457f676c57fb66db406 (diff)
downloadcpython-292d351fc1a7dc9feccd412843832808680a631f.zip
cpython-292d351fc1a7dc9feccd412843832808680a631f.tar.gz
cpython-292d351fc1a7dc9feccd412843832808680a631f.tar.bz2
Merged revisions 60481,60485,60489-60520,60523-60527,60530-60533,60535-60538,60540-60551 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk NOTE: I blocked the following revisions: svnmerge.py block -r 60521,60522,60528,60529,60534,60539 The new tests must be merged with lots of manual work. ........ r60493 | georg.brandl | 2008-02-01 12:59:08 +0100 (Fri, 01 Feb 2008) | 2 lines Update IPv6 RFC number. ........ r60497 | georg.brandl | 2008-02-01 16:50:15 +0100 (Fri, 01 Feb 2008) | 2 lines Add link checker builder, written for GHOP by Thomas Lamb. ........ r60500 | georg.brandl | 2008-02-01 19:08:09 +0100 (Fri, 01 Feb 2008) | 2 lines Rename batch file. ........ r60504 | christian.heimes | 2008-02-01 19:49:26 +0100 (Fri, 01 Feb 2008) | 1 line More int -> pid_t. ........ r60507 | georg.brandl | 2008-02-01 20:24:01 +0100 (Fri, 01 Feb 2008) | 2 lines Wording nit. ........ r60510 | georg.brandl | 2008-02-01 21:45:33 +0100 (Fri, 01 Feb 2008) | 2 lines Update for latest sphinx latex writer. ........ r60511 | raymond.hettinger | 2008-02-01 22:30:23 +0100 (Fri, 01 Feb 2008) | 1 line Issue #1996: float.as_integer_ratio() should return fraction in lowest terms. ........ r60512 | raymond.hettinger | 2008-02-01 23:15:52 +0100 (Fri, 01 Feb 2008) | 1 line Integer ratio should return ints instead of longs whereever possible. ........ r60513 | raymond.hettinger | 2008-02-01 23:22:50 +0100 (Fri, 01 Feb 2008) | 1 line labs() takes a long for an input. ........ r60514 | raymond.hettinger | 2008-02-01 23:42:59 +0100 (Fri, 01 Feb 2008) | 1 line Test round-trip on float.as_integer_ratio() and float.__truediv__(). ........ r60515 | marc-andre.lemburg | 2008-02-01 23:58:17 +0100 (Fri, 01 Feb 2008) | 3 lines Bump distutils version number to match Python version. ........ r60516 | raymond.hettinger | 2008-02-02 00:12:19 +0100 (Sat, 02 Feb 2008) | 1 line Fix int/long typecase. Add check for non-binary floating point. ........ r60517 | raymond.hettinger | 2008-02-02 00:45:44 +0100 (Sat, 02 Feb 2008) | 1 line Add protection from weirdness while scaling the mantissa to an integer. ........ r60518 | raymond.hettinger | 2008-02-02 06:11:40 +0100 (Sat, 02 Feb 2008) | 1 line Simpler solution to handling non-IEEE 754 environments. ........ r60519 | raymond.hettinger | 2008-02-02 06:24:44 +0100 (Sat, 02 Feb 2008) | 1 line Neaten-up a bit. ........ r60520 | georg.brandl | 2008-02-02 10:56:20 +0100 (Sat, 02 Feb 2008) | 2 lines Amendments to the urllib2 docs, written for GHOP by Thomas Lamb. ........ r60525 | georg.brandl | 2008-02-02 11:49:58 +0100 (Sat, 02 Feb 2008) | 3 lines Add email example how to send a multipart message. Written for GHOP by Martin Matejek. ........ r60526 | georg.brandl | 2008-02-02 12:05:00 +0100 (Sat, 02 Feb 2008) | 2 lines Rewrite test_socketserver as unittest, written for GHOP by Benjamin Petersen. ........ r60527 | georg.brandl | 2008-02-02 12:05:34 +0100 (Sat, 02 Feb 2008) | 2 lines Add GHOP contributor. ........ r60530 | mark.dickinson | 2008-02-02 18:16:13 +0100 (Sat, 02 Feb 2008) | 2 lines Make the Rational constructor accept '3.' and '.2' as well as '3.2'. ........ r60531 | neal.norwitz | 2008-02-02 19:52:51 +0100 (Sat, 02 Feb 2008) | 1 line Update the leaky tests (ie, ignore these tests if they report leaks). This version has been running for a while. ........ r60533 | skip.montanaro | 2008-02-02 20:11:57 +0100 (Sat, 02 Feb 2008) | 7 lines Split the refleak mail body into two parts, the first being those failing tests which are deemed more important issues, the second those which are known to have difficult to solve problems and are generally expected to leak. Hopefully this doesn't break the script... ........ r60535 | georg.brandl | 2008-02-03 01:04:50 +0100 (Sun, 03 Feb 2008) | 3 lines Wait for a delay before reaping children -- this should fix the test_socketserver failures on several platforms. ........ r60536 | brett.cannon | 2008-02-03 03:07:55 +0100 (Sun, 03 Feb 2008) | 2 lines Fix a minor typo. ........ r60537 | brett.cannon | 2008-02-03 03:08:45 +0100 (Sun, 03 Feb 2008) | 3 lines Directories from CPPFLAGS and LDFLAGS were being added in the reverse order for searches as to how they were listed in the environment variable. ........ r60538 | brett.cannon | 2008-02-03 03:34:14 +0100 (Sun, 03 Feb 2008) | 2 lines Remove extra tick marks and add a missing closing parenthesis. ........ r60540 | andrew.macintyre | 2008-02-03 07:58:06 +0100 (Sun, 03 Feb 2008) | 2 lines Update OS/2 EMX build bits for 2.6. ........ r60541 | andrew.macintyre | 2008-02-03 08:01:11 +0100 (Sun, 03 Feb 2008) | 2 lines Rename module definition file to reflect v2.6. ........ r60542 | andrew.macintyre | 2008-02-03 08:07:31 +0100 (Sun, 03 Feb 2008) | 6 lines The wrapper function is supposed to be for spawnvpe() so that's what we should call [this wrapper only available on OS/2]. Backport candidate to 2.5. ........ r60544 | gregory.p.smith | 2008-02-03 08:20:53 +0100 (Sun, 03 Feb 2008) | 6 lines Merge this fix from the pybsddb tree: r293 | jcea | 2008-01-31 01:08:19 -0800 (Thu, 31 Jan 2008) | 4 lines Solved memory leak when using cursors with databases without environment. ........ r60546 | gregory.p.smith | 2008-02-03 09:01:46 +0100 (Sun, 03 Feb 2008) | 2 lines remove a repeated occurance of a hardcoded berkeleydb library version number ........ r60549 | brett.cannon | 2008-02-03 10:59:21 +0100 (Sun, 03 Feb 2008) | 2 lines Add an entry for r60537. ........ r60550 | georg.brandl | 2008-02-03 13:29:00 +0100 (Sun, 03 Feb 2008) | 2 lines #2003: fix sentence. ........ r60551 | christian.heimes | 2008-02-03 15:34:18 +0100 (Sun, 03 Feb 2008) | 2 lines Fixed paths to Windows build directories in build_ext.py Use vsbuild instead of devenv in build.bat and _bsddb.vcproj ........
-rw-r--r--Doc/Makefile16
-rw-r--r--Doc/README.txt4
-rw-r--r--Doc/conf.py24
-rw-r--r--Doc/includes/email-alternative.py48
-rw-r--r--Doc/library/email-examples.rst11
-rw-r--r--Doc/library/queue.rst2
-rw-r--r--Doc/library/socket.rst2
-rw-r--r--Doc/library/urllib2.rst39
-rw-r--r--Doc/make.bat (renamed from Doc/builddoc.bat)0
-rw-r--r--Doc/reference/datamodel.rst2
-rw-r--r--Lib/distutils/__init__.py2
-rw-r--r--Lib/distutils/command/build_ext.py6
-rwxr-xr-xLib/rational.py15
-rw-r--r--Lib/test/test_builtin.py14
-rw-r--r--Lib/test/test_rational.py6
-rw-r--r--Lib/test/test_socketserver.py290
-rw-r--r--Misc/ACKS1
-rwxr-xr-xMisc/build.sh19
-rw-r--r--Modules/_bsddb.c8
-rw-r--r--Modules/mathmodule.c3
-rw-r--r--Modules/posixmodule.c26
-rw-r--r--Objects/floatobject.c117
-rw-r--r--PC/os2emx/Makefile14
-rw-r--r--PC/os2emx/README.os2emx48
-rw-r--r--PC/os2emx/python26.def (renamed from PC/os2emx/python25.def)289
-rw-r--r--PCbuild/_bsddb.vcproj16
-rw-r--r--PCbuild/build.bat2
-rw-r--r--PCbuild/readme.txt10
-rwxr-xr-xconfigure4
-rw-r--r--configure.in2
-rw-r--r--setup.py6
31 files changed, 615 insertions, 431 deletions
diff --git a/Doc/Makefile b/Doc/Makefile
index 189a2f7..95718d7 100644
--- a/Doc/Makefile
+++ b/Doc/Makefile
@@ -16,11 +16,12 @@ ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \
help:
@echo "Please use \`make <target>' where <target> is one of"
- @echo " html to make standalone HTML files"
- @echo " web to make file usable by Sphinx.web"
- @echo " htmlhelp to make HTML files and a HTML help project"
- @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
- @echo " changes to make an overview over all changed/added/deprecated items"
+ @echo " html to make standalone HTML files"
+ @echo " web to make file usable by Sphinx.web"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " changes to make an overview over all changed/added/deprecated items"
+ @echo " linkcheck to check all external links for integrity"
checkout:
@if [ ! -d tools/sphinx ]; then \
@@ -71,6 +72,11 @@ changes: BUILDER = changes
changes: build
@echo "The overview file is in build/changes."
+linkcheck: BUILDER = linkcheck
+linkcheck: build
+ @echo "Link check complete; look for any errors in the above output "\
+ "or in build/$(BUILDER)/output.txt"
+
clean:
-rm -rf build/*
-rm -rf tools/sphinx
diff --git a/Doc/README.txt b/Doc/README.txt
index c6f685c..a93542f 100644
--- a/Doc/README.txt
+++ b/Doc/README.txt
@@ -55,6 +55,10 @@ Available make targets are:
* "latex", which builds LaTeX source files that can be run with "pdflatex"
to produce PDF documents.
+
+ * "linkcheck", which checks all external references to see whether they are
+ broken, redirected or malformed, and outputs this information to stdout
+ as well as a plain-text (.txt) file.
* "changes", which builds an overview over all versionadded/versionchanged/
deprecated items in the current version. This is meant as a help for the
diff --git a/Doc/conf.py b/Doc/conf.py
index 3c33f98..273c76c 100644
--- a/Doc/conf.py
+++ b/Doc/conf.py
@@ -103,29 +103,29 @@ latex_font_size = '10pt'
# (source start file, target name, title, author, document class [howto/manual]).
_stdauthor = r'Guido van Rossum\\Fred L. Drake, Jr., editor'
latex_documents = [
- ('c-api/index.rst', 'c-api.tex',
+ ('c-api/index', 'c-api.tex',
'The Python/C API', _stdauthor, 'manual'),
- ('distutils/index.rst', 'distutils.tex',
+ ('distutils/index', 'distutils.tex',
'Distributing Python Modules', _stdauthor, 'manual'),
- ('documenting/index.rst', 'documenting.tex',
+ ('documenting/index', 'documenting.tex',
'Documenting Python', 'Georg Brandl', 'manual'),
- ('extending/index.rst', 'extending.tex',
+ ('extending/index', 'extending.tex',
'Extending and Embedding Python', _stdauthor, 'manual'),
- ('install/index.rst', 'install.tex',
+ ('install/index', 'install.tex',
'Installing Python Modules', _stdauthor, 'manual'),
- ('library/index.rst', 'library.tex',
+ ('library/index', 'library.tex',
'The Python Library Reference', _stdauthor, 'manual'),
- ('reference/index.rst', 'reference.tex',
+ ('reference/index', 'reference.tex',
'The Python Language Reference', _stdauthor, 'manual'),
- ('tutorial/index.rst', 'tutorial.tex',
+ ('tutorial/index', 'tutorial.tex',
'Python Tutorial', _stdauthor, 'manual'),
- ('using/index.rst', 'using.tex',
+ ('using/index', 'using.tex',
'Using Python', _stdauthor, 'manual'),
- ('whatsnew/' + version + '.rst', 'whatsnew.tex',
+ ('whatsnew/' + version, 'whatsnew.tex',
'What\'s New in Python', 'A. M. Kuchling', 'howto'),
]
# Collect all HOWTOs individually
-latex_documents.extend(('howto/' + fn, 'howto-' + fn[:-4] + '.tex',
+latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex',
'HOWTO', _stdauthor, 'howto')
for fn in os.listdir('howto')
if fn.endswith('.rst') and fn != 'index.rst')
@@ -139,4 +139,4 @@ latex_preamble = r'''
'''
# Documents to append as an appendix to all manuals.
-latex_appendices = ['glossary.rst', 'about.rst', 'license.rst', 'copyright.rst']
+latex_appendices = ['glossary', 'about', 'license', 'copyright']
diff --git a/Doc/includes/email-alternative.py b/Doc/includes/email-alternative.py
new file mode 100644
index 0000000..d941323
--- /dev/null
+++ b/Doc/includes/email-alternative.py
@@ -0,0 +1,48 @@
+#! /usr/bin/python
+
+import smtplib
+
+from email.mime.multipart import MIMEMultipart
+from email.mime.text import MIMEText
+
+# me == my email address
+# you == recipient's email address
+me = "my@email.com"
+you = "your@email.com"
+
+# Create message container - the correct MIME type is multipart/alternative.
+msg = MIMEMultipart('alternative')
+msg['Subject'] = "Link"
+msg['From'] = me
+msg['To'] = you
+
+# Create the body of the message (a plain-text and an HTML version).
+text = "Hi!\nHow are you?\nHere is the link you wanted:\nhttp://www.python.org"
+html = """\
+<html>
+ <head></head>
+ <body>
+ <p>Hi!<br>
+ How are you?<br>
+ Here is the <a href="http://www.python.org">link</a> you wanted.
+ </p>
+ </body>
+</html>
+"""
+
+# Record the MIME types of both parts - text/plain and text/html.
+part1 = MIMEText(text, 'plain')
+part2 = MIMEText(html, 'html')
+
+# Attach parts into message container.
+# According to RFC 2046, the last part of a multipart message, in this case
+# the HTML message, is best and preferred.
+msg.attach(part1)
+msg.attach(part2)
+
+# Send the message via local SMTP server.
+s = smtplib.SMTP('localhost')
+# sendmail function takes 3 arguments: sender's address, recipient's address
+# and message to send - here it is sent as one string.
+s.sendmail(me, you, msg.as_string())
+s.close()
diff --git a/Doc/library/email-examples.rst b/Doc/library/email-examples.rst
index 64a9944..f606f9b 100644
--- a/Doc/library/email-examples.rst
+++ b/Doc/library/email-examples.rst
@@ -16,18 +16,23 @@ pictures that may be residing in a directory:
Here's an example of how to send the entire contents of a directory as an email
-message: [1]_
+message: [1]_
.. literalinclude:: ../includes/email-dir.py
-And finally, here's an example of how to unpack a MIME message like the one
+Here's an example of how to unpack a MIME message like the one
above, into a directory of files:
.. literalinclude:: ../includes/email-unpack.py
+Here's an example of how to create an HTML message with an alternative plain
+text version: [2]_
+
+.. literalinclude:: ../includes/email-alternative.py
+
.. rubric:: Footnotes
.. [1] Thanks to Matthew Dixon Cowles for the original inspiration and examples.
-
+.. [2] Contributed by Martin Matejek.
diff --git a/Doc/library/queue.rst b/Doc/library/queue.rst
index 582f2cd..b5ba24d 100644
--- a/Doc/library/queue.rst
+++ b/Doc/library/queue.rst
@@ -71,7 +71,7 @@ The :mod:`Queue` module defines the following classes and exceptions:
Queue Objects
-------------
-Queue objects (:class:``Queue``, :class:``LifoQueue``, or :class:``PriorityQueue``
+Queue objects (:class:`Queue`, :class:`LifoQueue`, or :class:`PriorityQueue`)
provide the public methods described below.
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index 7d2dea0..cb1b87c 100644
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -23,7 +23,7 @@ PS1:7 and PS1:8). The platform-specific reference material for the various
socket-related system calls are also a valuable source of information on the
details of socket semantics. For Unix, refer to the manual pages; for Windows,
see the WinSock (or Winsock 2) specification. For IPv6-ready APIs, readers may
-want to refer to :rfc:`2553` titled Basic Socket Interface Extensions for IPv6.
+want to refer to :rfc:`3493` titled Basic Socket Interface Extensions for IPv6.
.. index:: object: socket
diff --git a/Doc/library/urllib2.rst b/Doc/library/urllib2.rst
index b3e5485..d77712f 100644
--- a/Doc/library/urllib2.rst
+++ b/Doc/library/urllib2.rst
@@ -33,10 +33,12 @@ The :mod:`urllib2` module defines the following functions:
This function returns a file-like object with two additional methods:
- * :meth:`geturl` --- return the URL of the resource retrieved
+ * :meth:`geturl` --- return the URL of the resource retrieved, commonly used to
+ determine if a redirect was followed
- * :meth:`info` --- return the meta-information of the page, as a dictionary-like
- object
+ * :meth:`info` --- return the meta-information of the page, such as headers, in
+ the form of an ``httplib.HTTPMessage`` instance
+ (see `Quick Reference to HTTP Headers <http://www.cs.tut.fi/~jkorpela/http.html>`_)
Raises :exc:`URLError` on errors.
@@ -81,18 +83,32 @@ The following exceptions are raised as appropriate:
The handlers raise this exception (or derived exceptions) when they run into a
problem. It is a subclass of :exc:`IOError`.
+ .. attribute:: reason
+
+ The reason for this error. It can be a message string or another exception
+ instance (:exc:`socket.error` for remote URLs, :exc:`OSError` for local
+ URLs).
+
.. exception:: HTTPError
- A subclass of :exc:`URLError`, it can also function as a non-exceptional
- file-like return value (the same thing that :func:`urlopen` returns). This
- is useful when handling exotic HTTP errors, such as requests for
- authentication.
+ Though being an exception (a subclass of :exc:`URLError`), an :exc:`HTTPError`
+ can also function as a non-exceptional file-like return value (the same thing
+ that :func:`urlopen` returns). This is useful when handling exotic HTTP
+ errors, such as requests for authentication.
+
+ .. attribute:: code
+
+ An HTTP status code as defined in `RFC 2616 <http://www.faqs.org/rfcs/rfc2616.html>`_.
+ This numeric value corresponds to a value found in the dictionary of
+ codes as found in :attr:`BaseHTTPServer.BaseHTTPRequestHandler.responses`.
+
+
The following classes are provided:
-.. class:: Request(url[, data][, headers] [, origin_req_host][, unverifiable])
+.. class:: Request(url[, data][, headers][, origin_req_host][, unverifiable])
This class is an abstraction of a URL request.
@@ -107,7 +123,12 @@ The following classes are provided:
returns a string in this format.
*headers* should be a dictionary, and will be treated as if :meth:`add_header`
- was called with each key and value as arguments.
+ was called with each key and value as arguments. This is often used to "spoof"
+ the ``User-Agent`` header, which is used by a browser to identify itself --
+ some HTTP servers only allow requests coming from common browsers as opposed
+ to scripts. For example, Mozilla Firefox may identify itself as ``"Mozilla/5.0
+ (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11"``, while :mod:`urllib2`'s
+ default user agent string is ``"Python-urllib/2.6"`` (on Python 2.6).
The final two arguments are only of interest for correct handling of third-party
HTTP cookies:
diff --git a/Doc/builddoc.bat b/Doc/make.bat
index a26851f..a26851f 100644
--- a/Doc/builddoc.bat
+++ b/Doc/make.bat
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 3a6b527..0ab5f11 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -991,7 +991,7 @@ that all old-style instances, independently of their class, are implemented with
a single built-in type, called ``instance``.
New-style classes were introduced in Python 2.2 to unify classes and types. A
-new-style class neither more nor less than a user-defined type. If *x* is an
+new-style class is neither more nor less than a user-defined type. If *x* is an
instance of a new-style class, then ``type(x)`` is the same as ``x.__class__``.
The major motivation for introducing new-style classes is to provide a unified
diff --git a/Lib/distutils/__init__.py b/Lib/distutils/__init__.py
index f71c3ad..0c3d939 100644
--- a/Lib/distutils/__init__.py
+++ b/Lib/distutils/__init__.py
@@ -18,4 +18,4 @@ __revision__ = "$Id$"
# In general, major and minor version should loosely follow the Python
# version number the distutils code was shipped with.
#
-__version__ = "2.5.1"
+__version__ = "2.6.0"
diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
index 6d42278..ff84bca 100644
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -178,13 +178,13 @@ class build_ext(Command):
self.include_dirs.append(os.path.join(sys.exec_prefix, 'PC'))
if MSVC_VERSION == 9:
self.library_dirs.append(os.path.join(sys.exec_prefix,
- 'PCBuild9'))
+ 'PCbuild'))
elif MSVC_VERSION == 8:
self.library_dirs.append(os.path.join(sys.exec_prefix,
- 'PCBuild8', 'win32release'))
+ 'PC', 'VS8.0', 'win32release'))
else:
self.library_dirs.append(os.path.join(sys.exec_prefix,
- 'PCBuild'))
+ 'PC', 'VS7.1'))
# OS/2 (EMX) doesn't support Debug vs Release builds, but has the
# import libraries in its "Config" subdirectory
diff --git a/Lib/rational.py b/Lib/rational.py
index 55d4a41..e2fed23 100755
--- a/Lib/rational.py
+++ b/Lib/rational.py
@@ -24,9 +24,18 @@ def gcd(a, b):
return a
-_RATIONAL_FORMAT = re.compile(
- r'^\s*(?P<sign>[-+]?)(?P<num>\d+)'
- r'(?:/(?P<denom>\d+)|\.(?P<decimal>\d+))?\s*$')
+_RATIONAL_FORMAT = re.compile(r"""
+ \A\s* # optional whitespace at the start, then
+ (?P<sign>[-+]?) # an optional sign, then
+ (?=\d|\.\d) # lookahead for digit or .digit
+ (?P<num>\d*) # numerator (possibly empty)
+ (?: # followed by an optional
+ /(?P<denom>\d+) # / and denominator
+ | # or
+ \.(?P<decimal>\d*) # decimal point and fractional part
+ )?
+ \s*\Z # and optional whitespace to finish
+""", re.VERBOSE)
class Rational(RationalAbc):
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index 35cdcd4..cc31e93 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -593,6 +593,20 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(format(0, C('10')), ' 0')
def test_floatasratio(self):
+ for f, ratio in [
+ (0.875, (7, 8)),
+ (-0.875, (-7, 8)),
+ (0.0, (0, 1)),
+ (11.5, (23, 2)),
+ ]:
+ self.assertEqual(f.as_integer_ratio(), ratio)
+
+ for i in range(10000):
+ f = random.random()
+ f *= 10 ** random.randint(-100, 100)
+ n, d = f.as_integer_ratio()
+ self.assertEqual(float(n).__truediv__(d), f)
+
R = rational.Rational
self.assertEqual(R(0, 1),
R(*float(0.0).as_integer_ratio()))
diff --git a/Lib/test/test_rational.py b/Lib/test/test_rational.py
index c9a129f..4f248be 100644
--- a/Lib/test/test_rational.py
+++ b/Lib/test/test_rational.py
@@ -77,6 +77,8 @@ class RationalTest(unittest.TestCase):
self.assertEquals((3, 2), _components(R(" 03/02 \n ")))
self.assertEquals((16, 5), _components(R(" 3.2 ")))
self.assertEquals((-16, 5), _components(R(" -3.2 ")))
+ self.assertEquals((-3, 1), _components(R(" -3. ")))
+ self.assertEquals((3, 5), _components(R(" .6 ")))
self.assertRaisesMessage(
ZeroDivisionError, "Rational(3, 0)",
@@ -111,6 +113,10 @@ class RationalTest(unittest.TestCase):
# Don't accept combinations of decimals and rationals.
ValueError, "Invalid literal for Rational: 3.2/7",
R, "3.2/7")
+ self.assertRaisesMessage(
+ # Allow 3. and .3, but not .
+ ValueError, "Invalid literal for Rational: .",
+ R, ".")
def testImmutable(self):
r = R(7, 3)
diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py
index 3e0c7a4..5ae8e6d 100644
--- a/Lib/test/test_socketserver.py
+++ b/Lib/test/test_socketserver.py
@@ -1,20 +1,32 @@
-# Test suite for SocketServer.py
+"""
+Test suite for SocketServer.py.
+"""
-from test import test_support
-from test.test_support import (verbose, verify, TESTFN, TestSkipped,
- reap_children)
-test_support.requires('network')
-
-from SocketServer import *
+import os
import socket
import errno
+import imp
import select
import time
import threading
-import os
+from functools import wraps
+import unittest
+import SocketServer
+
+import test.test_support
+from test.test_support import reap_children, verbose, TestSkipped
+from test.test_support import TESTFN as TEST_FILE
+
+test.test_support.requires("network")
NREQ = 3
DELAY = 0.5
+TEST_STR = b"hello world\n"
+HOST = "localhost"
+
+HAVE_UNIX_SOCKETS = hasattr(socket, "AF_UNIX")
+HAVE_FORKING = hasattr(os, "fork") and os.name != "os2"
+
class MyMixinHandler:
def handle(self):
@@ -23,23 +35,41 @@ class MyMixinHandler:
time.sleep(DELAY)
self.wfile.write(line)
-class MyStreamHandler(MyMixinHandler, StreamRequestHandler):
+
+def receive(sock, n, timeout=20):
+ r, w, x = select.select([sock], [], [], timeout)
+ if sock in r:
+ return sock.recv(n)
+ else:
+ raise RuntimeError("timed out on %r" % (sock,))
+
+
+class MyStreamHandler(MyMixinHandler, SocketServer.StreamRequestHandler):
pass
-class MyDatagramHandler(MyMixinHandler, DatagramRequestHandler):
+class MyDatagramHandler(MyMixinHandler,
+ SocketServer.DatagramRequestHandler):
pass
+class ForkingUnixStreamServer(SocketServer.ForkingMixIn,
+ SocketServer.UnixStreamServer):
+ pass
+
+class ForkingUnixDatagramServer(SocketServer.ForkingMixIn,
+ SocketServer.UnixDatagramServer):
+ pass
+
+
class MyMixinServer:
def serve_a_few(self):
for i in range(NREQ):
self.handle_request()
+
def handle_error(self, request, client_address):
self.close_request(request)
self.server_close()
raise
-teststring = b"hello world\n"
-
def receive(sock, n, timeout=20):
r, w, x = select.select([sock], [], [], timeout)
if sock in r:
@@ -75,6 +105,7 @@ class ServerThread(threading.Thread):
self.__svrcls = svrcls
self.__hdlrcls = hdlrcls
self.ready = threading.Event()
+
def run(self):
class svrcls(MyMixinServer, self.__svrcls):
pass
@@ -93,64 +124,8 @@ class ServerThread(threading.Thread):
svr.serve_a_few()
if verbose: print("thread: done")
-seed = 0
-def pickport():
- global seed
- seed += 1
- return 10000 + (os.getpid() % 1000)*10 + seed
-
-host = "localhost"
-testfiles = []
-def pickaddr(proto):
- if proto == socket.AF_INET:
- return (host, pickport())
- else:
- fn = TESTFN + str(pickport())
- if os.name == 'os2':
- # AF_UNIX socket names on OS/2 require a specific prefix
- # which can't include a drive letter and must also use
- # backslashes as directory separators
- if fn[1] == ':':
- fn = fn[2:]
- if fn[0] in (os.sep, os.altsep):
- fn = fn[1:]
- fn = os.path.join('\socket', fn)
- if os.sep == '/':
- fn = fn.replace(os.sep, os.altsep)
- else:
- fn = fn.replace(os.altsep, os.sep)
- testfiles.append(fn)
- return fn
-
-def cleanup():
- for fn in testfiles:
- try:
- os.remove(fn)
- except os.error:
- pass
- testfiles[:] = []
-
-def testloop(proto, servers, hdlrcls, testfunc):
- for svrcls in servers:
- addr = pickaddr(proto)
- if verbose:
- print("ADDR =", addr)
- print("CLASS =", svrcls)
- t = ServerThread(addr, svrcls, hdlrcls)
- if verbose: print("server created")
- t.start()
- if verbose: print("server running")
- for i in range(NREQ):
- t.ready.wait(10*DELAY)
- if not t.ready.isSet():
- raise RuntimeError("Server not ready within a reasonable time")
- if verbose: print("test client", i)
- testfunc(proto, addr)
- if verbose: print("waiting for server")
- t.join()
- if verbose: print("done")
-
-class ForgivingTCPServer(TCPServer):
+
+class ForgivingTCPServer(SocketServer.TCPServer):
# prevent errors if another process is using the port we want
def server_bind(self):
host, default_port = self.server_address
@@ -160,7 +135,7 @@ class ForgivingTCPServer(TCPServer):
for port in [default_port, 3434, 8798, 23833]:
try:
self.server_address = host, port
- TCPServer.server_bind(self)
+ SocketServer.TCPServer.server_bind(self)
break
except socket.error as e:
(err, msg) = e
@@ -168,56 +143,139 @@ class ForgivingTCPServer(TCPServer):
raise
print(' WARNING: failed to listen on port %d, trying another' % port, file=sys.__stderr__)
-tcpservers = [ForgivingTCPServer, ThreadingTCPServer]
-if hasattr(os, 'fork') and os.name not in ('os2',):
- tcpservers.append(ForkingTCPServer)
-udpservers = [UDPServer, ThreadingUDPServer]
-if hasattr(os, 'fork') and os.name not in ('os2',):
- udpservers.append(ForkingUDPServer)
-
-if not hasattr(socket, 'AF_UNIX'):
- streamservers = []
- dgramservers = []
-else:
- class ForkingUnixStreamServer(ForkingMixIn, UnixStreamServer): pass
- streamservers = [UnixStreamServer, ThreadingUnixStreamServer]
- if hasattr(os, 'fork') and os.name not in ('os2',):
- streamservers.append(ForkingUnixStreamServer)
- class ForkingUnixDatagramServer(ForkingMixIn, UnixDatagramServer): pass
- dgramservers = [UnixDatagramServer, ThreadingUnixDatagramServer]
- if hasattr(os, 'fork') and os.name not in ('os2',):
- dgramservers.append(ForkingUnixDatagramServer)
-
-def sloppy_cleanup():
- # See http://python.org/sf/1540386
- # We need to reap children here otherwise a child from one server
- # can be left running for the next server and cause a test failure.
- time.sleep(DELAY)
- reap_children()
-
-def testall():
- testloop(socket.AF_INET, tcpservers, MyStreamHandler, teststream)
- sloppy_cleanup()
- testloop(socket.AF_INET, udpservers, MyDatagramHandler, testdgram)
- if hasattr(socket, 'AF_UNIX'):
- sloppy_cleanup()
- testloop(socket.AF_UNIX, streamservers, MyStreamHandler, teststream)
- # Alas, on Linux (at least) recvfrom() doesn't return a meaningful
- # client address so this cannot work:
- ##testloop(socket.AF_UNIX, dgramservers, MyDatagramHandler, testdgram)
+class SocketServerTest(unittest.TestCase):
+ """Test all socket servers."""
+
+ def setUp(self):
+ self.port_seed = 0
+ self.test_files = []
+
+ def tearDown(self):
+ time.sleep(DELAY)
+ reap_children()
+
+ for fn in self.test_files:
+ try:
+ os.remove(fn)
+ except os.error:
+ pass
+ self.test_files[:] = []
+
+ def pickport(self):
+ self.port_seed += 1
+ return 10000 + (os.getpid() % 1000)*10 + self.port_seed
+
+ def pickaddr(self, proto):
+ if proto == socket.AF_INET:
+ return (HOST, self.pickport())
+ else:
+ fn = TEST_FILE + str(self.pickport())
+ if os.name == 'os2':
+ # AF_UNIX socket names on OS/2 require a specific prefix
+ # which can't include a drive letter and must also use
+ # backslashes as directory separators
+ if fn[1] == ':':
+ fn = fn[2:]
+ if fn[0] in (os.sep, os.altsep):
+ fn = fn[1:]
+ fn = os.path.join('\socket', fn)
+ if os.sep == '/':
+ fn = fn.replace(os.sep, os.altsep)
+ else:
+ fn = fn.replace(os.altsep, os.sep)
+ self.test_files.append(fn)
+ return fn
+
+ def run_servers(self, proto, servers, hdlrcls, testfunc):
+ for svrcls in servers:
+ addr = self.pickaddr(proto)
+ if verbose:
+ print "ADDR =", addr
+ print "CLASS =", svrcls
+ t = ServerThread(addr, svrcls, hdlrcls)
+ if verbose: print "server created"
+ t.start()
+ if verbose: print "server running"
+ for i in range(NREQ):
+ t.ready.wait(10*DELAY)
+ self.assert_(t.ready.isSet(),
+ "Server not ready within a reasonable time")
+ if verbose: print "test client", i
+ testfunc(proto, addr)
+ if verbose: print "waiting for server"
+ t.join()
+ if verbose: print "done"
+
+ def stream_examine(self, proto, addr):
+ s = socket.socket(proto, socket.SOCK_STREAM)
+ s.connect(addr)
+ s.sendall(TEST_STR)
+ buf = data = receive(s, 100)
+ while data and '\n' not in buf:
+ data = receive(s, 100)
+ buf += data
+ self.assertEquals(buf, TEST_STR)
+ s.close()
+
+ def dgram_examine(self, proto, addr):
+ s = socket.socket(proto, socket.SOCK_DGRAM)
+ s.sendto(TEST_STR, addr)
+ buf = data = receive(s, 100)
+ while data and '\n' not in buf:
+ data = receive(s, 100)
+ buf += data
+ self.assertEquals(buf, TEST_STR)
+ s.close()
+
+ def test_TCPServers(self):
+ # Test SocketServer.TCPServer
+ servers = [ForgivingTCPServer, SocketServer.ThreadingTCPServer]
+ if HAVE_FORKING:
+ servers.append(SocketServer.ForkingTCPServer)
+ self.run_servers(socket.AF_INET, servers,
+ MyStreamHandler, self.stream_examine)
+
+ def test_UDPServers(self):
+ # Test SocketServer.UDPServer
+ servers = [SocketServer.UDPServer,
+ SocketServer.ThreadingUDPServer]
+ if HAVE_FORKING:
+ servers.append(SocketServer.ForkingUDPServer)
+ self.run_servers(socket.AF_INET, servers, MyDatagramHandler,
+ self.dgram_examine)
+
+ def test_stream_servers(self):
+ # Test SocketServer's stream servers
+ if not HAVE_UNIX_SOCKETS:
+ return
+ servers = [SocketServer.UnixStreamServer,
+ SocketServer.ThreadingUnixStreamServer]
+ if HAVE_FORKING:
+ servers.append(ForkingUnixStreamServer)
+ self.run_servers(socket.AF_UNIX, servers, MyStreamHandler,
+ self.stream_examine)
+
+ # Alas, on Linux (at least) recvfrom() doesn't return a meaningful
+ # client address so this cannot work:
+
+ # def test_dgram_servers(self):
+ # # Test SocketServer.UnixDatagramServer
+ # if not HAVE_UNIX_SOCKETS:
+ # return
+ # servers = [SocketServer.UnixDatagramServer,
+ # SocketServer.ThreadingUnixDatagramServer]
+ # if HAVE_FORKING:
+ # servers.append(ForkingUnixDatagramServer)
+ # self.run_servers(socket.AF_UNIX, servers, MyDatagramHandler,
+ # self.dgram_examine)
+
def test_main():
- import imp
if imp.lock_held():
- # If the import lock is held, the threads will hang.
+ # If the import lock is held, the threads will hang
raise TestSkipped("can't run when import lock is held")
- reap_children()
- try:
- testall()
- finally:
- cleanup()
- reap_children()
+ test.test_support.run_unittest(SocketServerTest)
if __name__ == "__main__":
test_main()
diff --git a/Misc/ACKS b/Misc/ACKS
index 34d2762..fae67a1 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -512,6 +512,7 @@ Fernando Pérez
Mark Perrego
Trevor Perrin
Tim Peters
+Benjamin Peterson
Chris Petrilli
Bjorn Pettersen
Geoff Philbrick
diff --git a/Misc/build.sh b/Misc/build.sh
index 94b496d..8eca6ba 100755
--- a/Misc/build.sh
+++ b/Misc/build.sh
@@ -67,7 +67,7 @@ REFLOG="build/reflog.txt.out"
# Note: test_XXX (none currently) really leak, but are disabled
# so we don't send spam. Any test which really leaks should only
# be listed here if there are also test cases under Lib/test/leakers.
-LEAKY_TESTS="test_(cmd_line|popen2|socket|threading_local|urllib2_localnet)"
+LEAKY_TESTS="test_(cmd_line|popen2|socket|sys|threadsignals|urllib2_localnet)"
# These tests always fail, so skip them so we don't get false positives.
_ALWAYS_SKIP=""
@@ -99,7 +99,17 @@ mail_on_failure() {
if [ "$FAILURE_CC" != "" ]; then
dest="$dest -c $FAILURE_CC"
fi
- mutt -s "$FAILURE_SUBJECT $1 ($NUM_FAILURES)" $dest < $2
+ if [ "x$3" != "x" ] ; then
+ (echo "More important issues:"
+ echo "----------------------"
+ egrep -v "$3" < $2
+ echo ""
+ echo "Less important issues:"
+ echo "----------------------"
+ egrep "$3" < $2)
+ else
+ cat $2
+ fi | mutt -s "$FAILURE_SUBJECT $1 ($NUM_FAILURES)" $dest
fi
}
@@ -194,9 +204,10 @@ if [ $err = 0 -a "$BUILD_DISABLED" != "yes" ]; then
## ensure that the reflog exists so the grep doesn't fail
touch $REFLOG
$PYTHON $REGRTEST_ARGS -R 4:3:$REFLOG -u network $LEAKY_SKIPS >& build/$F
- NUM_FAILURES=`egrep -vc "($LEAKY_TESTS|sum=0)" $REFLOG`
+ LEAK_PAT="($LEAKY_TESTS|sum=0)"
+ NUM_FAILURES=`egrep -vc "$LEAK_PAT" $REFLOG`
update_status "Testing refleaks ($NUM_FAILURES failures)" "$F" $start
- mail_on_failure "refleak" $REFLOG
+ mail_on_failure "refleak" $REFLOG "$LEAK_PAT"
## now try to run all the tests
F=make-testall.out
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c
index fb71161..52d83ec 100644
--- a/Modules/_bsddb.c
+++ b/Modules/_bsddb.c
@@ -904,7 +904,6 @@ DBCursor_dealloc(DBCursorObject* self)
}
if (self->dbc != NULL) {
- MYDB_BEGIN_ALLOW_THREADS;
/* If the underlying database has been closed, we don't
need to do anything. If the environment has been closed
we need to leak, as BerkeleyDB will crash trying to access
@@ -913,9 +912,14 @@ DBCursor_dealloc(DBCursorObject* self)
a database open. */
if (self->mydb->db && self->mydb->myenvobj &&
!self->mydb->myenvobj->closed)
+ /* test for: open db + no environment or non-closed environment */
+ if (self->mydb->db && (!self->mydb->myenvobj || (self->mydb->myenvobj &&
+ !self->mydb->myenvobj->closed))) {
+ MYDB_BEGIN_ALLOW_THREADS;
err = self->dbc->c_close(self->dbc);
+ MYDB_END_ALLOW_THREADS;
+ }
self->dbc = NULL;
- MYDB_END_ALLOW_THREADS;
}
Py_XDECREF( self->mydb );
PyObject_Del(self);
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index f50a4bb..cf2bf64 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -235,8 +235,7 @@ math_trunc(PyObject *self, PyObject *number)
PyDoc_STRVAR(math_trunc_doc,
"trunc(x:Real) -> Integral\n"
"\n"
-"Truncates x to the nearest Integral toward 0. Uses the __trunc__ magic"
-"method.");
+"Truncates x to the nearest Integral toward 0. Uses the __trunc__ magic method.");
static PyObject *
math_frexp(PyObject *self, PyObject *arg)
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 842f971..fc989fe 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -3579,9 +3579,9 @@ posix_spawnvpe(PyObject *self, PyObject *args)
Py_BEGIN_ALLOW_THREADS
#if defined(PYCC_GCC)
- spawnval = spawnve(mode, path, argvlist, envlist);
+ spawnval = spawnvpe(mode, path, argvlist, envlist);
#else
- spawnval = _spawnve(mode, path, argvlist, envlist);
+ spawnval = _spawnvpe(mode, path, argvlist, envlist);
#endif
Py_END_ALLOW_THREADS
@@ -3964,7 +3964,8 @@ Kill a process with a signal.");
static PyObject *
posix_kill(PyObject *self, PyObject *args)
{
- int pid, sig;
+ pid_t pid;
+ int sig;
if (!PyArg_ParseTuple(args, "ii:kill", &pid, &sig))
return NULL;
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
@@ -4209,7 +4210,7 @@ posix_setgroups(PyObject *self, PyObject *groups)
#if defined(HAVE_WAIT3) || defined(HAVE_WAIT4)
static PyObject *
-wait_helper(int pid, int status, struct rusage *ru)
+wait_helper(pid_t pid, int status, struct rusage *ru)
{
PyObject *result;
static PyObject *struct_rusage;
@@ -4275,7 +4276,8 @@ Wait for completion of a child process.");
static PyObject *
posix_wait3(PyObject *self, PyObject *args)
{
- int pid, options;
+ pid_t pid;
+ int options;
struct rusage ru;
WAIT_TYPE status;
WAIT_STATUS_INT(status) = 0;
@@ -4299,7 +4301,8 @@ Wait for completion of a given child process.");
static PyObject *
posix_wait4(PyObject *self, PyObject *args)
{
- int pid, options;
+ pid_t pid;
+ int options;
struct rusage ru;
WAIT_TYPE status;
WAIT_STATUS_INT(status) = 0;
@@ -4323,7 +4326,8 @@ Wait for completion of a given child process.");
static PyObject *
posix_waitpid(PyObject *self, PyObject *args)
{
- int pid, options;
+ pid_t pid;
+ int options;
WAIT_TYPE status;
WAIT_STATUS_INT(status) = 0;
@@ -4372,7 +4376,7 @@ Wait for completion of a child process.");
static PyObject *
posix_wait(PyObject *self, PyObject *noargs)
{
- int pid;
+ pid_t pid;
WAIT_TYPE status;
WAIT_STATUS_INT(status) = 0;
@@ -4567,7 +4571,8 @@ Call the system call getsid().");
static PyObject *
posix_getsid(PyObject *self, PyObject *args)
{
- int pid, sid;
+ pid_t pid;
+ int sid;
if (!PyArg_ParseTuple(args, "i:getsid", &pid))
return NULL;
sid = getsid(pid);
@@ -4601,7 +4606,8 @@ Call the system call setpgid().");
static PyObject *
posix_setpgid(PyObject *self, PyObject *args)
{
- int pid, pgrp;
+ pid_t pid;
+ int pgrp;
if (!PyArg_ParseTuple(args, "ii:setpgid", &pid, &pgrp))
return NULL;
if (setpgid(pid, pgrp) < 0)
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index 5cb3201..9b499ba 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -1066,20 +1066,19 @@ float_float(PyObject *v)
}
static PyObject *
-float_as_integer_ratio(PyObject *v)
+float_as_integer_ratio(PyObject *v, PyObject *unused)
{
double self;
double float_part;
int exponent;
- int is_negative;
- const int chunk_size = 28;
+ int i;
+
PyObject *prev;
- PyObject *py_chunk = NULL;
PyObject *py_exponent = NULL;
PyObject *numerator = NULL;
PyObject *denominator = NULL;
PyObject *result_pair = NULL;
- PyNumberMethods *long_methods;
+ PyNumberMethods *long_methods = PyLong_Type.tp_as_number;
#define INPLACE_UPDATE(obj, call) \
prev = obj; \
@@ -1101,93 +1100,31 @@ float_as_integer_ratio(PyObject *v)
}
#endif
- if (self == 0) {
- numerator = PyLong_FromLong(0);
- if (numerator == NULL) goto error;
- denominator = PyLong_FromLong(1);
- if (denominator == NULL) goto error;
- result_pair = PyTuple_Pack(2, numerator, denominator);
- /* Hand ownership over to the tuple. If the tuple
- wasn't created successfully, we want to delete the
- ints anyway. */
- Py_DECREF(numerator);
- Py_DECREF(denominator);
- return result_pair;
- }
-
- /* XXX: Could perhaps handle FLT_RADIX!=2 by using ilogb and
- scalbn, but those may not be in C89. */
PyFPE_START_PROTECT("as_integer_ratio", goto error);
- float_part = frexp(self, &exponent);
- is_negative = 0;
- if (float_part < 0) {
- float_part = -float_part;
- is_negative = 1;
- /* 0.5 <= float_part < 1.0 */
- }
+ float_part = frexp(self, &exponent); /* self == float_part * 2**exponent exactly */
PyFPE_END_PROTECT(float_part);
- /* abs(self) == float_part * 2**exponent exactly */
-
- /* Suck up chunk_size bits at a time; 28 is enough so that we
- suck up all bits in 2 iterations for all known binary
- double-precision formats, and small enough to fit in a
- long. */
- numerator = PyLong_FromLong(0);
+
+ for (i=0; i<300 && float_part != floor(float_part) ; i++) {
+ float_part *= 2.0;
+ exponent--;
+ }
+ /* self == float_part * 2**exponent exactly and float_part is integral.
+ If FLT_RADIX != 2, the 300 steps may leave a tiny fractional part
+ to be truncated by PyLong_FromDouble(). */
+
+ numerator = PyLong_FromDouble(float_part);
if (numerator == NULL) goto error;
- long_methods = PyLong_Type.tp_as_number;
-
- py_chunk = PyLong_FromLong(chunk_size);
- if (py_chunk == NULL) goto error;
-
- while (float_part != 0) {
- /* invariant: abs(self) ==
- (numerator + float_part) * 2**exponent exactly */
- long digit;
- PyObject *py_digit;
-
- PyFPE_START_PROTECT("as_integer_ratio", goto error);
- /* Pull chunk_size bits out of float_part, into digits. */
- float_part = ldexp(float_part, chunk_size);
- digit = (long)float_part;
- float_part -= digit;
- /* 0 <= float_part < 1 */
- exponent -= chunk_size;
- PyFPE_END_PROTECT(float_part);
-
- /* Shift digits into numerator. */
- // numerator <<= chunk_size
- INPLACE_UPDATE(numerator,
- long_methods->nb_lshift(numerator, py_chunk));
- if (numerator == NULL) goto error;
-
- // numerator |= digit
- py_digit = PyLong_FromLong(digit);
- if (py_digit == NULL) goto error;
- INPLACE_UPDATE(numerator,
- long_methods->nb_or(numerator, py_digit));
- Py_DECREF(py_digit);
- if (numerator == NULL) goto error;
- }
-
- /* Add in the sign bit. */
- if (is_negative) {
- INPLACE_UPDATE(numerator,
- long_methods->nb_negative(numerator));
- if (numerator == NULL) goto error;
- }
-
- /* now self = numerator * 2**exponent exactly; fold in 2**exponent */
+ /* fold in 2**exponent */
denominator = PyLong_FromLong(1);
- py_exponent = PyLong_FromLong(labs(exponent));
+ py_exponent = PyLong_FromLong(labs((long)exponent));
if (py_exponent == NULL) goto error;
INPLACE_UPDATE(py_exponent,
long_methods->nb_lshift(denominator, py_exponent));
if (py_exponent == NULL) goto error;
if (exponent > 0) {
INPLACE_UPDATE(numerator,
- long_methods->nb_multiply(numerator,
- py_exponent));
+ long_methods->nb_multiply(numerator, py_exponent));
if (numerator == NULL) goto error;
}
else {
@@ -1196,12 +1133,17 @@ float_as_integer_ratio(PyObject *v)
py_exponent = NULL;
}
+ /* Returns ints instead of longs where possible */
+ INPLACE_UPDATE(numerator, PyNumber_Int(numerator));
+ if (numerator == NULL) goto error;
+ INPLACE_UPDATE(denominator, PyNumber_Int(denominator));
+ if (denominator == NULL) goto error;
+
result_pair = PyTuple_Pack(2, numerator, denominator);
#undef INPLACE_UPDATE
error:
Py_XDECREF(py_exponent);
- Py_XDECREF(py_chunk);
Py_XDECREF(denominator);
Py_XDECREF(numerator);
return result_pair;
@@ -1210,17 +1152,16 @@ error:
PyDoc_STRVAR(float_as_integer_ratio_doc,
"float.as_integer_ratio() -> (int, int)\n"
"\n"
-"Returns a pair of integers, not necessarily in lowest terms, whose\n"
-"ratio is exactly equal to the original float. This method raises an\n"
-"OverflowError on infinities and a ValueError on nans. The resulting\n"
-"denominator will be positive.\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"
"\n"
">>> (10.0).as_integer_ratio()\n"
-"(167772160L, 16777216L)\n"
+"(10, 1)\n"
">>> (0.0).as_integer_ratio()\n"
"(0, 1)\n"
">>> (-.25).as_integer_ratio()\n"
-"(-134217728L, 536870912L)");
+"(-1, 4)");
static PyObject *
diff --git a/PC/os2emx/Makefile b/PC/os2emx/Makefile
index c0c9807..d3ef12b 100644
--- a/PC/os2emx/Makefile
+++ b/PC/os2emx/Makefile
@@ -1,16 +1,16 @@
#####################==================----------------
#
-# Top-Level Makefile for Building Python 2.4 for OS/2 using GCC/EMX
+# Top-Level Makefile for Building Python 2.6 for OS/2 using GCC/EMX
# Originally written by Andrew Zabolotny, <bit@eltech.ru> for Python 1.5.2
-# Modified by Andrew MacIntyre, <andymac@pcug.org.au> for Python 2.5
+# Modified by Andrew MacIntyre, <andymac@pcug.org.au> for Python 2.6
#
# This makefile was developed for use with [P]GCC/EMX compiler any
# version and GNU Make.
#
-# The output of the build is a largish Python25.DLL containing the
+# The output of the build is a largish Python26.DLL containing the
# essential modules of Python and a small Python.exe program to start
# the interpreter. When embedding Python within another program, only
-# Python25.DLL is needed. We also build python_s.a static library (which
+# Python26.DLL is needed. We also build python_s.a static library (which
# can be converted into OMF (.lib) format using emxomf tool) and both
# python.a and python.lib import libraries. Then the optional
# extension modules, which are OS/2 DLLs renamed with a PYD file extension.
@@ -64,7 +64,7 @@ HAVE_OPENSSL= no
# === install locations ===
# default value of PYTHONHOME
-LIB_DIR=C:/Python25
+LIB_DIR=C:/Python26
# default is to have everything in or under PYTHONHOME
EXE_DIR=$(LIB_DIR)
DLL_DIR=$(EXE_DIR)
@@ -236,8 +236,8 @@ $(OUT)%$O: %.c
@echo STACKSIZE 2097152 >>$@
# Output file names
-PYTHON_VER= 2.5
-PYTHON_LIB= python25
+PYTHON_VER= 2.6
+PYTHON_LIB= python26
PYTHON.LIB= $(PYTHON_LIB)_s$A
PYTHON.IMPLIB= $(PYTHON_LIB)$A
ifeq ($(EXEOMF),yes)
diff --git a/PC/os2emx/README.os2emx b/PC/os2emx/README.os2emx
index 4fe5c53..e186790 100644
--- a/PC/os2emx/README.os2emx
+++ b/PC/os2emx/README.os2emx
@@ -1,4 +1,4 @@
-This is a port of Python 2.5 to OS/2 using the EMX development tools
+This is a port of Python 2.6 to OS/2 using the EMX development tools
=========================================================================
What's new since the previous release
@@ -10,11 +10,11 @@ Another day, another version...
Licenses and info about Python and EMX
--------------------------------------
-Please read the file README.Python-2.5 included in this package for
-information about Python 2.5. This file is the README file from the
-Python 2.5 source distribution available via http://www.python.org/
-and its mirrors. The file LICENCE.Python-2.5 is the text of the Licence
-from the Python 2.5 source distribution.
+Please read the file README.Python-2.6 included in this package for
+information about Python 2.6. This file is the README file from the
+Python 2.6 source distribution available via http://www.python.org/
+and its mirrors. The file LICENCE.Python-2.6 is the text of the Licence
+from the Python 2.6 source distribution.
Note that the EMX package that this package depends on is released under
the GNU General Public Licence. Please refer to the documentation
@@ -46,7 +46,7 @@ There have been ports of previous versions of Python to OS/2.
The best known would be that by Jeff Rush, most recently of version
1.5.2. Jeff used IBM's Visual Age C++ (v3) for his ports, and his
-patches have been included in the Python 2.5 source distribution.
+patches have been included in the Python 2.6 source distribution.
Andy Zabolotny implemented a port of Python v1.5.2 using the EMX
development tools. His patches against the Python v1.5.2 source
@@ -92,7 +92,7 @@ Python.exe is linked as an a.out executable, ie using EMX method E1
to compile & link the executable. This is so that fork() works (see
"YOU HAVE BEEN WARNED" item 1).
-Python25.dll is created as a normal OMF DLL, with an OMF import
+Python26.dll is created as a normal OMF DLL, with an OMF import
library and module definition file. There is also an a.out (.a) import
library to support linking the DLL to a.out executables. The DLL
requires the EMX runtime DLLs.
@@ -148,7 +148,7 @@ WARNED" item 13.
Upstream source patches:
-No updates to the Python 2.5 release have become available.
+No updates to the Python 2.6 release have become available.
Eberhard Mattes' EMXFIX04 update to his EMX 0.9d tools suite includes
bug fixes for the BSD DB library. The bsddb module included in this
@@ -157,7 +157,7 @@ port incorporates these fixes.
Library and other distributed Python code:
The Python standard library lives in the Lib directory. All the standard
-library code included with the Python 2.5 source distribution is included
+library code included with the Python 2.6 source distribution is included
in the binary archive, with the exception of the dos-8x3 and tkinter
subdirectories which have been omitted to reduce the size of the binary
archive - the dos-8x3 components are unnecessary duplicates and Tkinter
@@ -172,7 +172,7 @@ omitted as not being supported by this port. The Misc directory has
also been omitted.
All subdirectories omitted from the binary archive can be reconstituted
-from the Python 2.5 source distribution, if desired.
+from the Python 2.6 source distribution, if desired.
Support for building Python extensions:
@@ -190,15 +190,15 @@ Packaging
---------
This port is packaged as follows:
-- python-2.5-os2emx-bin-03????.zip (binaries, library modules)
-- python-2.5-os2emx-src-03???? (patches+makefiles for non-Python code)
+- python-2.6-os2emx-bin-03????.zip (binaries, library modules)
+- python-2.6-os2emx-src-03???? (patches+makefiles for non-Python code)
As all the Python specific patches for the port are now part of the
Python release tarball, only the patches and makefiles involved in
building external libraries for optional extensions are included in
the source archive.
-Documentation for the Python language, as well as the Python 2.5
+Documentation for the Python language, as well as the Python 2.6
source distibution, can be obtained from the Python website
(http://www.python.org/) or the Python project pages at Sourceforge
(http://sf.net/projects/python/).
@@ -213,7 +213,7 @@ package.
Unpack this archive, preserving the subdirectories, in the root directory
of the drive where you want Python to live.
-Add the Python directory (eg C:\Python25) to the PATH and LIBPATH
+Add the Python directory (eg C:\Python26) to the PATH and LIBPATH
variables in CONFIG.SYS.
You should then set the PYTHONHOME and PYTHONPATH environment variables
@@ -223,9 +223,9 @@ PYTHONHOME should be set to Python's top level directory. PYTHONPATH
should be set to the semicolon separated list of principal Python library
directories.
I use:
- SET PYTHONHOME=F:/Python25
- SET PYTHONPATH=F:/Python25/Lib;F:/Python25/Lib/plat-os2emx;
- F:/Python25/Lib/lib-dynload;F:/Python25/Lib/site-packages
+ SET PYTHONHOME=F:/Python26
+ SET PYTHONPATH=F:/Python26/Lib;F:/Python26/Lib/plat-os2emx;
+ F:/Python26/Lib/lib-dynload;F:/Python26/Lib/site-packages
NOTE!: the PYTHONPATH setting above is linewrapped for this document - it
should all be on one line in CONFIG.SYS!
@@ -238,7 +238,7 @@ EMX subset of the Terminfo database included with the ncurses-5.2 source
distribution. This can be used by setting the TERMINFO environment variable
to the path of the Terminfo subdirectory below the Python home directory.
On my system this looks like:
- SET TERMINFO=F:/Python25/Terminfo
+ SET TERMINFO=F:/Python26/Terminfo
For the TERM environment variable, I would try one of the following:
SET TERM=ansi
@@ -252,8 +252,8 @@ If you wish to compile all the included Python library modules to bytecode,
you can change into the Python home directory and run the COMPILEALL.CMD
batch file.
-You can execute the regression tests included with the Python 2.5 source
-distribution by changing to the Python 2.5 home directory and executing the
+You can execute the regression tests included with the Python 2.6 source
+distribution by changing to the Python 2.6 home directory and executing the
REGRTEST.CMD batch file. The following tests are known to fail at this
time:
- test_mhlib (I don't know of any port of MH to OS/2);
@@ -299,7 +299,7 @@ Procedure
1. decide if you need to change the location of the Python installation.
If you wish to do this, set the value of the Makefile variable LIB_DIR
to the directory you wish to use for PYTHONHOME
- (eg /usr/local/lib/python2.5).
+ (eg /usr/local/lib/python2.6).
If you want Python to find its library without the PYTHONHOME
environment variable set, set the value of the Makefile variable
@@ -309,7 +309,7 @@ Procedure
to be installed in a directory other than the PYTHONHOME directory, set
the value of the Makefile variable EXE_DIR to the appropriate directory.
-3. If you wish the Python core DLL (python25.dll) to be installed in a
+3. If you wish the Python core DLL (python26.dll) to be installed in a
directory other than the directory in which the Python executables are
installed (by default, the PYTHONHOME directory), set the value of the
Makefile variable DLL_DIR to the appropriate directory. This DLL must
@@ -698,4 +698,4 @@ Andrew MacIntyre
E-mail: andymac@bullseye.apana.org.au, or andymac@pcug.org.au
Web: http://www.andymac.org/
-23 July, 2006.
+28 January, 2008.
diff --git a/PC/os2emx/python25.def b/PC/os2emx/python26.def
index 55242ea..2795050 100644
--- a/PC/os2emx/python25.def
+++ b/PC/os2emx/python26.def
@@ -1,54 +1,54 @@
-LIBRARY python25 INITINSTANCE TERMINSTANCE
-DESCRIPTION "Python 2.5 Core DLL"
+LIBRARY python26 INITINSTANCE TERMINSTANCE
+DESCRIPTION "Python 2.6 Core DLL"
PROTMODE
DATA MULTIPLE NONSHARED
EXPORTS
-; From python25_s.lib(config)
+; From python26_s.lib(config)
"_PyImport_Inittab"
-; From python25_s.lib(dlfcn)
+; From python26_s.lib(dlfcn)
; "dlopen"
; "dlsym"
; "dlclose"
; "dlerror"
-; From python25_s.lib(getpathp)
+; From python26_s.lib(getpathp)
"Py_GetProgramFullPath"
"Py_GetPrefix"
"Py_GetExecPrefix"
"Py_GetPath"
-; From python25_s.lib(getbuildinfo)
+; From python26_s.lib(getbuildinfo)
"Py_GetBuildInfo"
"_Py_svnversion"
-; From python25_s.lib(main)
+; From python26_s.lib(main)
"Py_Main"
"Py_GetArgcArgv"
-; From python25_s.lib(acceler)
+; From python26_s.lib(acceler)
"PyGrammar_AddAccelerators"
"PyGrammar_RemoveAccelerators"
-; From python25_s.lib(grammar1)
+; From python26_s.lib(grammar1)
"PyGrammar_FindDFA"
"PyGrammar_LabelRepr"
-; From python25_s.lib(listnode)
+; From python26_s.lib(listnode)
"PyNode_ListTree"
-; From python25_s.lib(node)
+; From python26_s.lib(node)
"PyNode_New"
"PyNode_AddChild"
"PyNode_Free"
-; From python25_s.lib(parser)
+; From python26_s.lib(parser)
"PyParser_AddToken"
"PyParser_New"
"PyParser_Delete"
-; From python25_s.lib(parsetok)
+; From python26_s.lib(parsetok)
"Py_TabcheckFlag"
"PyParser_ParseString"
"PyParser_ParseStringFlagsFilename"
@@ -56,18 +56,18 @@ EXPORTS
"PyParser_ParseFileFlags"
"PyParser_ParseStringFlags"
-; From python25_s.lib(bitset)
+; From python26_s.lib(bitset)
"_Py_newbitset"
"_Py_delbitset"
"_Py_addbit"
"_Py_samebitset"
"_Py_mergebitset"
-; From python25_s.lib(metagrammar)
+; From python26_s.lib(metagrammar)
"_Py_meta_grammar"
"Py_meta_grammar"
-; From python25_s.lib(tokenizer)
+; From python26_s.lib(tokenizer)
"PyToken_OneChar"
"PyToken_TwoChars"
"PyToken_ThreeChars"
@@ -77,14 +77,14 @@ EXPORTS
"PyTokenizer_Get"
"_PyParser_TokenNames"
-; From python25_s.lib(myreadline)
+; From python26_s.lib(myreadline)
"_PyOS_ReadlineTState"
"PyOS_ReadlineFunctionPointer"
"PyOS_StdioReadline"
"PyOS_Readline"
"PyOS_InputHook"
-; From python25_s.lib(abstract)
+; From python26_s.lib(abstract)
"_PyObject_LengthHint"
"PyMapping_Size"
"PyObject_CallMethod"
@@ -175,19 +175,27 @@ EXPORTS
"PyObject_IsInstance"
"PyObject_IsSubclass"
-; From python25_s.lib(boolobject)
+; From python26_s.lib(boolobject)
"PyBool_FromLong"
"PyBool_Type"
"_Py_ZeroStruct"
"_Py_TrueStruct"
-; From python25_s.lib(cellobject)
+; From python26_s.lib(bufferobject)
+ "PyBuffer_FromObject"
+ "PyBuffer_FromReadWriteObject"
+ "PyBuffer_FromMemory"
+ "PyBuffer_FromReadWriteMemory"
+ "PyBuffer_New"
+ "PyBuffer_Type"
+
+; From python26_s.lib(cellobject)
"PyCell_New"
"PyCell_Get"
"PyCell_Set"
"PyCell_Type"
-; From python25_s.lib(classobject)
+; From python26_s.lib(classobject)
"PyClass_New"
"PyClass_IsSubclass"
"PyInstance_New"
@@ -202,7 +210,7 @@ EXPORTS
"PyInstance_Type"
"PyMethod_Type"
-; From python25_s.lib(cobject)
+; From python26_s.lib(cobject)
"PyCObject_FromVoidPtr"
"PyCObject_FromVoidPtrAndDesc"
"PyCObject_AsVoidPtr"
@@ -211,13 +219,13 @@ EXPORTS
"PyCObject_SetVoidPtr"
"PyCObject_Type"
-; From python25_s.lib(codeobject)
+; From python26_s.lib(codeobject)
"PyCode_New"
"PyCode_Addr2Line"
"PyCode_CheckLineNumber"
"PyCode_Type"
-; From python25_s.lib(complexobject)
+; From python26_s.lib(complexobject)
"_Py_c_pow"
"_Py_c_sum"
"_Py_c_diff"
@@ -231,7 +239,7 @@ EXPORTS
"PyComplex_AsCComplex"
"PyComplex_Type"
-; From python25_s.lib(descrobject)
+; From python26_s.lib(descrobject)
"PyWrapper_New"
"PyDescr_NewMethod"
"PyDescr_NewClassMethod"
@@ -242,7 +250,7 @@ EXPORTS
"PyWrapperDescr_Type"
"PyProperty_Type"
-; From python25_s.lib(dictobject)
+; From python26_s.lib(dictobject)
"PyDict_New"
"PyDict_GetItem"
"PyDict_SetItem"
@@ -266,11 +274,11 @@ EXPORTS
"PyDictIterValue_Type"
"PyDictIterItem_Type"
-; From python25_s.lib(enumobject)
+; From python26_s.lib(enumobject)
"PyEnum_Type"
"PyReversed_Type"
-; From python25_s.lib(fileobject)
+; From python26_s.lib(fileobject)
"PyFile_FromString"
"Py_UniversalNewlineFread"
"PyFile_GetLine"
@@ -286,7 +294,7 @@ EXPORTS
"PyFile_Name"
"PyFile_Type"
-; From python25_s.lib(floatobject)
+; From python26_s.lib(floatobject)
"PyFloat_FromString"
"PyFloat_AsDouble"
"PyFloat_Fini"
@@ -301,7 +309,7 @@ EXPORTS
"PyFloat_AsStringEx"
"PyFloat_Type"
-; From python25_s.lib(frameobject)
+; From python26_s.lib(frameobject)
"PyFrame_New"
"PyFrame_FastToLocals"
"PyFrame_LocalsToFast"
@@ -311,7 +319,7 @@ EXPORTS
"PyFrame_BlockPop"
"PyFrame_Type"
-; From python25_s.lib(funcobject)
+; From python26_s.lib(funcobject)
"PyFunction_New"
"PyFunction_GetCode"
"PyFunction_GetGlobals"
@@ -326,18 +334,33 @@ EXPORTS
"PyClassMethod_Type"
"PyStaticMethod_Type"
-; From python25_s.lib(genobject)
+; From python26_s.lib(genobject)
"PyGen_New"
"PyGen_NeedsFinalizing"
"PyGen_Type"
-; From python25_s.lib(iterobject)
+; From python26_s.lib(intobject)
+ "PyInt_AsLong"
+ "PyInt_AsUnsignedLongMask"
+ "PyInt_AsUnsignedLongLongMask"
+ "PyInt_FromString"
+ "PyInt_AsSsize_t"
+ "PyInt_Fini"
+ "PyInt_FromUnicode"
+ "PyInt_FromLong"
+ "PyInt_FromSize_t"
+ "PyInt_FromSsize_t"
+ "PyInt_GetMax"
+ "_PyInt_Init"
+ "PyInt_Type"
+
+; From python26_s.lib(iterobject)
"PySeqIter_New"
"PyCallIter_New"
"PySeqIter_Type"
"PyCallIter_Type"
-; From python25_s.lib(listobject)
+; From python26_s.lib(listobject)
"PyList_New"
"PyList_Append"
"PyList_Size"
@@ -355,7 +378,7 @@ EXPORTS
"PyListIter_Type"
"PyListRevIter_Type"
-; From python25_s.lib(longobject)
+; From python26_s.lib(longobject)
"PyLong_FromDouble"
"PyLong_AsLong"
"_PyLong_AsSsize_t"
@@ -385,7 +408,7 @@ EXPORTS
"PyLong_Type"
"_PyLong_DigitValue"
-; From python25_s.lib(methodobject)
+; From python26_s.lib(methodobject)
"PyCFunction_Call"
"Py_FindMethodInChain"
"PyCFunction_GetFunction"
@@ -397,7 +420,7 @@ EXPORTS
"PyCFunction_New"
"PyCFunction_Type"
-; From python25_s.lib(moduleobject)
+; From python26_s.lib(moduleobject)
"PyModule_New"
"_PyModule_Clear"
"PyModule_GetDict"
@@ -405,7 +428,7 @@ EXPORTS
"PyModule_GetFilename"
"PyModule_Type"
-; From python25_s.lib(object)
+; From python26_s.lib(object)
"Py_DivisionWarningFlag"
"PyObject_Str"
"PyObject_Repr"
@@ -448,6 +471,7 @@ EXPORTS
"PyObject_InitVar"
"_PyObject_New"
"_PyObject_NewVar"
+ "_PyObject_Del"
"_Py_ReadyTypes"
"_Py_SwappedOp"
"_Py_NotImplementedStruct"
@@ -457,15 +481,15 @@ EXPORTS
"_PyTrash_delete_nesting"
"_PyTrash_delete_later"
-; From python25_s.lib(obmalloc)
+; From python26_s.lib(obmalloc)
"PyObject_Malloc"
"PyObject_Free"
"PyObject_Realloc"
-; From python25_s.lib(rangeobject)
+; From python26_s.lib(rangeobject)
"PyRange_Type"
-; From python25_s.lib(setobject)
+; From python26_s.lib(setobject)
"PySet_Pop"
"PySet_New"
"PyFrozenSet_New"
@@ -480,7 +504,7 @@ EXPORTS
"PySet_Type"
"PyFrozenSet_Type"
-; From python25_s.lib(sliceobject)
+; From python26_s.lib(sliceobject)
"_PySlice_FromIndices"
"PySlice_GetIndices"
"PySlice_GetIndicesEx"
@@ -488,7 +512,7 @@ EXPORTS
"_Py_EllipsisObject"
"PySlice_Type"
-; From python25_s.lib(stringobject)
+; From python26_s.lib(stringobject)
"PyString_FromStringAndSize"
"PyString_InternInPlace"
"PyString_FromString"
@@ -519,12 +543,12 @@ EXPORTS
"PyString_Type"
"PyBaseString_Type"
-; From python25_s.lib(structseq)
+; From python26_s.lib(structseq)
"PyStructSequence_InitType"
"PyStructSequence_New"
"PyStructSequence_UnnamedField"
-; From python25_s.lib(tupleobject)
+; From python26_s.lib(tupleobject)
"PyTuple_New"
"PyTuple_Pack"
"_PyTuple_Resize"
@@ -536,7 +560,7 @@ EXPORTS
"PyTuple_Type"
"PyTupleIter_Type"
-; From python25_s.lib(typeobject)
+; From python26_s.lib(typeobject)
"PyType_IsSubtype"
"_PyType_Lookup"
"PyType_Ready"
@@ -547,7 +571,7 @@ EXPORTS
"PyBaseObject_Type"
"PySuper_Type"
-; From python25_s.lib(unicodeobject)
+; From python26_s.lib(unicodeobject)
"PyUnicodeUCS2_Resize"
"PyUnicodeUCS2_FromOrdinal"
"PyUnicodeUCS2_FromObject"
@@ -613,7 +637,7 @@ EXPORTS
"PyUnicode_AsDecodedObject"
"PyUnicode_Type"
-; From python25_s.lib(unicodectype)
+; From python26_s.lib(unicodectype)
"_PyUnicode_TypeRecords"
"_PyUnicodeUCS2_ToNumeric"
"_PyUnicodeUCS2_IsLowercase"
@@ -631,7 +655,7 @@ EXPORTS
"_PyUnicodeUCS2_IsNumeric"
"_PyUnicodeUCS2_IsAlpha"
-; From python25_s.lib(weakrefobject)
+; From python26_s.lib(weakrefobject)
"PyWeakref_NewRef"
"PyWeakref_NewProxy"
"PyObject_ClearWeakRefs"
@@ -642,7 +666,7 @@ EXPORTS
"_PyWeakref_ProxyType"
"_PyWeakref_CallableProxyType"
-; From python25_s.lib(Python-ast)
+; From python26_s.lib(Python-ast)
; "init_ast"
"Module"
"Interactive"
@@ -701,18 +725,18 @@ EXPORTS
"alias"
"PyAST_mod2obj"
-; From python25_s.lib(asdl)
+; From python26_s.lib(asdl)
"asdl_seq_new"
"asdl_int_seq_new"
-; From python25_s.lib(ast)
+; From python26_s.lib(ast)
"PyAST_FromNode"
-; From python25_s.lib(bltinmodule)
+; From python26_s.lib(bltinmodule)
"_PyBuiltin_Init"
"Py_FileSystemDefaultEncoding"
-; From python25_s.lib(exceptions)
+; From python26_s.lib(exceptions)
"PyUnicodeEncodeError_GetStart"
"PyUnicodeDecodeError_GetStart"
"PyUnicodeEncodeError_GetEnd"
@@ -743,6 +767,7 @@ EXPORTS
"_PyExc_Fini"
"PyExc_BaseException"
"PyExc_Exception"
+ "PyExc_StandardError"
"PyExc_TypeError"
"PyExc_StopIteration"
"PyExc_GeneratorExit"
@@ -787,7 +812,7 @@ EXPORTS
"PyExc_ImportWarning"
"PyExc_MemoryErrorInst"
-; From python25_s.lib(ceval)
+; From python26_s.lib(ceval)
"PyEval_EvalFrameEx"
"PyEval_CallObjectWithKeywords"
"PyEval_EvalCodeEx"
@@ -826,13 +851,13 @@ EXPORTS
"_Py_CheckInterval"
"_Py_Ticker"
-; From python25_s.lib(compile)
+; From python26_s.lib(compile)
"_Py_Mangle"
"PyAST_Compile"
"PyNode_Compile"
"Py_OptimizeFlag"
-; From python25_s.lib(codecs)
+; From python26_s.lib(codecs)
"_PyCodec_Lookup"
"PyCodec_Encode"
"PyCodec_Decode"
@@ -851,7 +876,7 @@ EXPORTS
"PyCodec_LookupError"
"PyCodec_StrictErrors"
-; From python25_s.lib(errors)
+; From python26_s.lib(errors)
"PyErr_SetNone"
"PyErr_SetString"
"PyErr_GivenExceptionMatches"
@@ -877,16 +902,16 @@ EXPORTS
"PyErr_Warn"
"PyErr_WarnExplicit"
-; From python25_s.lib(frozen)
+; From python26_s.lib(frozen)
"PyImport_FrozenModules"
-; From python25_s.lib(frozenmain)
+; From python26_s.lib(frozenmain)
"Py_FrozenMain"
-; From python25_s.lib(future)
+; From python26_s.lib(future)
"PyFuture_FromAST"
-; From python25_s.lib(getargs)
+; From python26_s.lib(getargs)
"PyArg_Parse"
"_PyArg_Parse_SizeT"
"PyArg_ParseTuple"
@@ -900,25 +925,25 @@ EXPORTS
"_PyArg_VaParse_SizeT"
"_PyArg_VaParseTupleAndKeywords_SizeT"
-; From python25_s.lib(getcompiler)
+; From python26_s.lib(getcompiler)
"Py_GetCompiler"
-; From python25_s.lib(getcopyright)
+; From python26_s.lib(getcopyright)
"Py_GetCopyright"
-; From python25_s.lib(getmtime)
+; From python26_s.lib(getmtime)
"PyOS_GetLastModificationTime"
-; From python25_s.lib(getplatform)
+; From python26_s.lib(getplatform)
"Py_GetPlatform"
-; From python25_s.lib(getversion)
+; From python26_s.lib(getversion)
"Py_GetVersion"
-; From python25_s.lib(graminit)
+; From python26_s.lib(graminit)
"_PyParser_Grammar"
-; From python25_s.lib(import)
+; From python26_s.lib(import)
"_PyImport_Init"
"_PyImportHooks_Init"
"PyImport_ImportModule"
@@ -945,10 +970,10 @@ EXPORTS
"PyImport_Inittab"
"_PyImport_Filetab"
-; From python25_s.lib(importdl)
+; From python26_s.lib(importdl)
"_PyImport_LoadDynamicModule"
-; From python25_s.lib(marshal)
+; From python26_s.lib(marshal)
"PyMarshal_ReadLongFromFile"
"PyMarshal_WriteObjectToString"
"PyMarshal_WriteLongToFile"
@@ -959,7 +984,7 @@ EXPORTS
"PyMarshal_ReadObjectFromString"
"PyMarshal_Init"
-; From python25_s.lib(modsupport)
+; From python26_s.lib(modsupport)
"Py_InitModule4"
"Py_BuildValue"
"_Py_BuildValue_SizeT"
@@ -972,24 +997,24 @@ EXPORTS
"PyModule_AddStringConstant"
"_Py_PackageContext"
-; From python25_s.lib(mysnprintf)
+; From python26_s.lib(mysnprintf)
"PyOS_snprintf"
"PyOS_vsnprintf"
-; From python25_s.lib(mystrtoul)
+; From python26_s.lib(mystrtoul)
"PyOS_strtoul"
"PyOS_strtol"
-; From python25_s.lib(pyarena)
+; From python26_s.lib(pyarena)
"PyArena_New"
"PyArena_Free"
"PyArena_Malloc"
"PyArena_AddPyObject"
-; From python25_s.lib(pyfpe)
+; From python26_s.lib(pyfpe)
"PyFPE_dummy"
-; From python25_s.lib(pystate)
+; From python26_s.lib(pystate)
"PyInterpreterState_Clear"
"PyThreadState_Clear"
"_PyThread_CurrentFrames"
@@ -1014,12 +1039,12 @@ EXPORTS
"_PyThreadState_Current"
"_PyThreadState_GetFrame"
-; From python25_s.lib(pystrtod)
+; From python26_s.lib(pystrtod)
"PyOS_ascii_strtod"
"PyOS_ascii_formatd"
"PyOS_ascii_atof"
-; From python25_s.lib(pythonrun)
+; From python26_s.lib(pythonrun)
"Py_IgnoreEnvironmentFlag"
"Py_DebugFlag"
"Py_VerboseFlag"
@@ -1081,18 +1106,20 @@ EXPORTS
"Py_UnicodeFlag"
"_Py_QnewFlag"
-; From python25_s.lib(structmember)
+; From python26_s.lib(structmember)
+ "PyMember_Get"
"PyMember_GetOne"
"PyMember_SetOne"
+ "PyMember_Set"
-; From python25_s.lib(symtable)
+; From python26_s.lib(symtable)
"PySymtable_Build"
"PySymtable_Free"
"PyST_GetScope"
"PySymtable_Lookup"
"PySTEntry_Type"
-; From python25_s.lib(sysmodule)
+; From python26_s.lib(sysmodule)
"_PySys_Init"
"PySys_WriteStderr"
"PySys_SetPath"
@@ -1106,22 +1133,22 @@ EXPORTS
"PySys_ResetWarnOptions"
"PySys_AddWarnOption"
-; From python25_s.lib(traceback)
+; From python26_s.lib(traceback)
"PyTraceBack_Here"
"PyTraceBack_Print"
"PyTraceBack_Type"
-; From python25_s.lib(getopt)
+; From python26_s.lib(getopt)
"_PyOS_GetOpt"
"_PyOS_opterr"
"_PyOS_optind"
"_PyOS_optarg"
-; From python25_s.lib(dynload_shlib)
+; From python26_s.lib(dynload_shlib)
"_PyImport_DynLoadFiletab"
"_PyImport_GetDynLoadFunc"
-; From python25_s.lib(thread)
+; From python26_s.lib(thread)
"PyThread_delete_key_value"
"PyThread_init_thread"
"PyThread_start_new_thread"
@@ -1139,7 +1166,7 @@ EXPORTS
"PyThread_get_key_value"
"PyThread__exit_thread"
-; From python25_s.lib(gcmodule)
+; From python26_s.lib(gcmodule)
; "initgc"
"_PyObject_GC_New"
"_PyObject_GC_NewVar"
@@ -1155,7 +1182,7 @@ EXPORTS
"_PyObject_GC_Del"
"_PyGC_generation0"
-; From python25_s.lib(signalmodule)
+; From python26_s.lib(signalmodule)
; "initsignal"
"PyErr_CheckSignals"
"PyErr_SetInterrupt"
@@ -1164,100 +1191,124 @@ EXPORTS
"PyOS_InitInterrupts"
"PyOS_AfterFork"
-; From python25_s.lib(posixmodule)
+; From python26_s.lib(posixmodule)
; "initos2"
-; From python25_s.lib(threadmodule)
+; From python26_s.lib(threadmodule)
; "initthread"
-; From python25_s.lib(arraymodule)
+; From python26_s.lib(arraymodule)
; "initarray"
; "array_methods"
-; From python25_s.lib(binascii)
+; From python26_s.lib(binascii)
; "initbinascii"
-; From python25_s.lib(cmathmodule)
+; From python26_s.lib(cmathmodule)
; "initcmath"
-; From python25_s.lib(_codecsmodule)
+; From python26_s.lib(_codecsmodule)
; "init_codecs"
-; From python25_s.lib(collectionsmodule)
+; From python26_s.lib(collectionsmodule)
; "initcollections"
"dequeiter_type"
"dequereviter_type"
-; From python25_s.lib(cStringIO)
+; From python26_s.lib(cPickle)
+; "initcPickle"
+; "fast_save_leave"
+
+; From python26_s.lib(cStringIO)
; "initcStringIO"
-; From python25_s.lib(_csv)
+; From python26_s.lib(_csv)
; "init_csv"
-; From python25_s.lib(datetimemodule)
+; From python26_s.lib(datetimemodule)
; "initdatetime"
-; From python25_s.lib(dlmodule)
+; From python26_s.lib(dlmodule)
; "initdl"
-; From python25_s.lib(errnomodule)
+; From python26_s.lib(errnomodule)
; "initerrno"
-; From python25_s.lib(fcntlmodule)
+; From python26_s.lib(fcntlmodule)
; "initfcntl"
-; From python25_s.lib(_functoolsmodule)
+; From python26_s.lib(_functoolsmodule)
; "init_functools"
-; From python25_s.lib(_heapqmodule)
+; From python26_s.lib(_heapqmodule)
; "init_heapq"
-; From python25_s.lib(imageop)
+; From python26_s.lib(imageop)
; "initimageop"
-; From python25_s.lib(itertoolsmodule)
+; From python26_s.lib(itertoolsmodule)
; "inititertools"
-; From python25_s.lib(_localemodule)
+; From python26_s.lib(_localemodule)
; "init_locale"
-; From python25_s.lib(mathmodule)
+; From python26_s.lib(mathmodule)
; "initmath"
-; From python25_s.lib(operator)
+; From python26_s.lib(md5)
+ "md5_finish"
+ "md5_init"
+ "md5_append"
+
+; From python26_s.lib(md5module)
+; "init_md5"
+
+; From python26_s.lib(operator)
; "initoperator"
-; From python25_s.lib(_randommodule)
+; From python26_s.lib(_randommodule)
; "init_random"
-; From python25_s.lib(sha256module)
+; From python26_s.lib(rgbimgmodule)
+; "initrgbimg"
+
+; From python26_s.lib(shamodule)
+; "init_sha"
+
+; From python26_s.lib(sha256module)
; "init_sha256"
-; From python25_s.lib(sha512module)
+; From python26_s.lib(sha512module)
; "init_sha512"
-; From python25_s.lib(_sre)
+; From python26_s.lib(_sre)
; "init_sre"
-; From python25_s.lib(_struct)
+; From python26_s.lib(stropmodule)
+; "initstrop"
+
+; From python26_s.lib(_struct)
; "init_struct"
-; From python25_s.lib(symtablemodule)
+; From python26_s.lib(symtablemodule)
; "init_symtable"
-; From python25_s.lib(termios)
+; From python26_s.lib(termios)
; "inittermios"
-; From python25_s.lib(timemodule)
+; From python26_s.lib(timemodule)
; "inittime"
"_PyTime_DoubleToTimet"
; "inittimezone"
-; From python25_s.lib(_weakref)
+; From python26_s.lib(timingmodule)
+; "inittiming"
+
+; From python26_s.lib(_weakref)
; "init_weakref"
-; From python25_s.lib(xxsubtype)
+; From python26_s.lib(xxsubtype)
; "initxxsubtype"
-; From python25_s.lib(zipimport)
+; From python26_s.lib(zipimport)
; "initzipimport"
diff --git a/PCbuild/_bsddb.vcproj b/PCbuild/_bsddb.vcproj
index 205a178..a59c703 100644
--- a/PCbuild/_bsddb.vcproj
+++ b/PCbuild/_bsddb.vcproj
@@ -52,7 +52,7 @@
/>
<Tool
Name="VCPreLinkEventTool"
- CommandLine="cd $(bsddbDir)&#x0D;&#x0A;if exist Debug\libdb44sd.lib exit 0&#x0D;&#x0A;devenv Berkeley_DB.sln /build Debug /project db_static&#x0D;&#x0A;"
+ CommandLine="cd $(bsddbDir)&#x0D;&#x0A;if exist Debug\libdb44sd.lib exit 0&#x0D;&#x0A;vcbuild /useenv db_static.vcproj &quot;Debug|Win32&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCLinkerTool"
@@ -115,7 +115,7 @@
/>
<Tool
Name="VCPreLinkEventTool"
- CommandLine="cd $(bsddbDir)&#x0D;&#x0A;if exist Debug_AMD64\libdb44sd.lib exit 0&#x0D;&#x0A;devenv Berkeley_DB.sln /build &quot;Debug AMD64&quot; /project db_static /useenv&#x0D;&#x0A;"
+ CommandLine="cd $(bsddbDir)&#x0D;&#x0A;if exist Debug_AMD64\libdb44sd.lib exit 0&#x0D;&#x0A;vcbuild /useenv db_static.vcproj &quot;Debug AMD64|Win32&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCLinkerTool"
@@ -178,7 +178,7 @@
/>
<Tool
Name="VCPreLinkEventTool"
- CommandLine="cd $(bsddbDir)&#x0D;&#x0A;if exist Release\libdb44s.lib exit 0&#x0D;&#x0A;devenv Berkeley_DB.sln /build Release /project db_static&#x0D;&#x0A;"
+ CommandLine="cd $(bsddbDir)&#x0D;&#x0A;if exist Release\libdb44s.lib exit 0&#x0D;&#x0A;vcbuild /useenv db_static.vcproj &quot;Release|Win32&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCLinkerTool"
@@ -242,7 +242,7 @@
/>
<Tool
Name="VCPreLinkEventTool"
- CommandLine="cd $(bsddbDir)&#x0D;&#x0A;if exist Release_AMD64\libdb44s.lib exit 0&#x0D;&#x0A;devenv Berkeley_DB.sln /build &quot;Release AMD64&quot; /project db_static /useenv&#x0D;&#x0A;"
+ CommandLine="cd $(bsddbDir)&#x0D;&#x0A;if exist Release_AMD64\libdb44s.lib exit 0&#x0D;&#x0A;vcbuild /useenv db_static.vcproj &quot;Release AMD64|Win32&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCLinkerTool"
@@ -305,7 +305,7 @@
/>
<Tool
Name="VCPreLinkEventTool"
- CommandLine="cd $(bsddbDir)&#x0D;&#x0A;if exist Release\libdb44s.lib exit 0&#x0D;&#x0A;devenv Berkeley_DB.sln /build Release /project db_static&#x0D;&#x0A;"
+ CommandLine="cd $(bsddbDir)&#x0D;&#x0A;if exist Release\libdb44s.lib exit 0&#x0D;&#x0A;vcbuild /useenv db_static.vcproj &quot;Release|Win32&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCLinkerTool"
@@ -369,7 +369,7 @@
/>
<Tool
Name="VCPreLinkEventTool"
- CommandLine="cd $(bsddbDir)&#x0D;&#x0A;if exist Release_AMD64\libdb44s.lib exit 0&#x0D;&#x0A;devenv Berkeley_DB.sln /build &quot;Release AMD64&quot; /project db_static /useenv&#x0D;&#x0A;"
+ CommandLine="cd $(bsddbDir)&#x0D;&#x0A;if exist Release_AMD64\libdb44s.lib exit 0&#x0D;&#x0A;vcbuild /useenv db_static.vcproj &quot;Release AMD64|Win32&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCLinkerTool"
@@ -433,7 +433,7 @@
/>
<Tool
Name="VCPreLinkEventTool"
- CommandLine="cd $(bsddbDir)&#x0D;&#x0A;if exist Release\libdb44s.lib exit 0&#x0D;&#x0A;devenv Berkeley_DB.sln /build Release /project db_static&#x0D;&#x0A;"
+ CommandLine="cd $(bsddbDir)&#x0D;&#x0A;if exist Release\libdb44s.lib exit 0&#x0D;&#x0A;vcbuild /useenv db_static.vcproj &quot;Release|Win32&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCLinkerTool"
@@ -497,7 +497,7 @@
/>
<Tool
Name="VCPreLinkEventTool"
- CommandLine="cd $(bsddbDir)&#x0D;&#x0A;if exist Release_AMD64\libdb44s.lib exit 0&#x0D;&#x0A;devenv Berkeley_DB.sln /build &quot;Release AMD64&quot; /project db_static /useenv&#x0D;&#x0A;"
+ CommandLine="cd $(bsddbDir)&#x0D;&#x0A;if exist Release_AMD64\libdb44s.lib exit 0&#x0D;&#x0A;vcbuild /useenv db_static.vcproj &quot;Release AMD64|Win32&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCLinkerTool"
diff --git a/PCbuild/build.bat b/PCbuild/build.bat
index 9bc8186..d181daf 100644
--- a/PCbuild/build.bat
+++ b/PCbuild/build.bat
@@ -12,6 +12,6 @@ if "%1"=="-c" (set conf=%2) & shift & shift & goto CheckOpts
if "%1"=="-p" (set platf=%2) & shift & shift & goto CheckOpts
if "%1"=="-r" (set build=/rebuild) & shift & goto CheckOpts
-set cmd=devenv pcbuild.sln %build% "%conf%|%platf%"
+set cmd=vcbuild /useenv pcbuild.sln %build% "%conf%|%platf%"
echo %cmd%
%cmd%
diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt
index 764ab8a..2b2d1f8 100644
--- a/PCbuild/readme.txt
+++ b/PCbuild/readme.txt
@@ -23,7 +23,6 @@ Solution" or F6 takes care of dependencies except for x64 builds. To make
cross compiling x64 builds on a 32bit OS possible the x64 builds require a
32bit version of Python.
-
NOTE:
You probably don't want to build most of the other subprojects, unless
you're building an entire Python distribution from scratch, or
@@ -192,10 +191,11 @@ _bsddb
svn export http://svn.python.org/projects/external/db-4.4.20
Next open the solution file db-4.4.20\build_win32\Berkeley_DB.sln with
- Visual Studio and convert the projects to the new format. The standard
- and professional version of VS 2008 builds the necessary libraries
- in a pre-link step of _bsddb. However the express edition is missing
- some pieces and you have to build the libs yourself.
+ Visual Studio and convert the projects to the new format. VS 2008
+ builds the necessary libraries in a pre-link step of _bsddb. You
+ have to add "$(VCInstallDir)vcpackages" to the search path first
+ (Tools -> Options -> Projects and Solutions -> VC++ Directories,
+ Platform: Win32, Show directories for: Executable files).
The _bsddb subprojects depends only on the db_static project of
Berkeley DB. You have to choose either "Release", "Release AMD64", "Debug"
diff --git a/configure b/configure
index 6ac362f..7cda668 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in Revision: 60476 .
+# From configure.in Revision: 60489 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for python 3.0.
#
@@ -1312,7 +1312,7 @@ Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-universalsdk[SDKDIR]
- Build agains Mac OS X 10.4u SDK (ppc/i386)
+ Build against Mac OS X 10.4u SDK (ppc/i386)
--enable-framework[=INSTALLDIR]
Build (MacOSX|Darwin) framework
--enable-shared disable/enable building shared python library
diff --git a/configure.in b/configure.in
index 36c319d..082bc7c 100644
--- a/configure.in
+++ b/configure.in
@@ -61,7 +61,7 @@ AC_SUBST(CONFIG_ARGS)
CONFIG_ARGS="$ac_configure_args"
AC_ARG_ENABLE(universalsdk,
- AC_HELP_STRING(--enable-universalsdk@<:@SDKDIR@:>@, Build agains Mac OS X 10.4u SDK (ppc/i386)),
+ AC_HELP_STRING(--enable-universalsdk@<:@SDKDIR@:>@, Build against Mac OS X 10.4u SDK (ppc/i386)),
[
case $enableval in
yes)
diff --git a/setup.py b/setup.py
index 4cae0be..8cc4b15 100644
--- a/setup.py
+++ b/setup.py
@@ -327,7 +327,7 @@ class PyBuildExt(build_ext):
parser.add_option(arg_name, dest="dirs", action="append")
options = parser.parse_args(env_val.split())[0]
if options.dirs:
- for directory in options.dirs:
+ for directory in reversed(options.dirs):
add_dir_to_list(dir_list, directory)
if os.path.normpath(sys.prefix) != '/usr':
@@ -698,10 +698,10 @@ class PyBuildExt(build_ext):
for dn in inc_dirs:
std_variants.append(os.path.join(dn, 'db3'))
std_variants.append(os.path.join(dn, 'db4'))
- for x in (0,1,2,3,4,5,6):
+ for x in range(max_db_ver[1]+1):
std_variants.append(os.path.join(dn, "db4%d"%x))
std_variants.append(os.path.join(dn, "db4.%d"%x))
- for x in (2,3):
+ for x in (3,):
std_variants.append(os.path.join(dn, "db3%d"%x))
std_variants.append(os.path.join(dn, "db3.%d"%x))