Skip to content

Commit

Permalink
Merged revisions 60481,60485,60489-60520,60523-60527,60530-60533,6053…
Browse files Browse the repository at this point in the history
…5-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
........
  • Loading branch information
tiran committed Feb 3, 2008
1 parent ec17d20 commit 292d351
Show file tree
Hide file tree
Showing 31 changed files with 615 additions and 431 deletions.
16 changes: 11 additions & 5 deletions Doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions Doc/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 12 additions & 12 deletions Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,29 +103,29 @@
# (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')
Expand All @@ -139,4 +139,4 @@
'''

# 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']
48 changes: 48 additions & 0 deletions Doc/includes/email-alternative.py
Original file line number Diff line number Diff line change
@@ -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()
11 changes: 8 additions & 3 deletions Doc/library/email-examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion Doc/library/queue.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.


Expand Down
2 changes: 1 addition & 1 deletion Doc/library/socket.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
39 changes: 30 additions & 9 deletions Doc/library/urllib2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand All @@ -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:
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Lib/distutils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
# 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"
6 changes: 3 additions & 3 deletions Lib/distutils/command/build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@ def finalize_options(self):
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
Expand Down
15 changes: 12 additions & 3 deletions Lib/rational.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
14 changes: 14 additions & 0 deletions Lib/test/test_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,20 @@ def empty_format_spec(value):
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()))
Expand Down
6 changes: 6 additions & 0 deletions Lib/test/test_rational.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def testFromString(self):
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)",
Expand Down Expand Up @@ -111,6 +113,10 @@ def testFromString(self):
# 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)
Expand Down
Loading

0 comments on commit 292d351

Please sign in to comment.