[Python-3000-checkins] r58054 - in python/branches/py3k: Doc/documenting/markup.rst Doc/library/codecs.rst Doc/library/copy.rst Doc/library/ctypes.rst Doc/library/mutex.rst Doc/library/queue.rst Doc/library/re.rst Doc/library/readline.rst Doc/library/smtplib.rst Doc/library/socket.rst Doc/library/ssl.rst Doc/library/thread.rst Doc/library/threading.rst Doc/whatsnew/2.6.rst Include/pyerrors.h Lib/ctypes/__init__.py Lib/ctypes/test/test_arrays.py Lib/ctypes/test/test_callbacks.py Lib/ctypes/test/test_cfuncs.py Lib/ctypes/test/test_functions.py Lib/ctypes/test/test_repr.py Lib/distutils/dep_util.py Lib/httplib.py Lib/imaplib.py Lib/smtplib.py Lib/test/crashers/infinite_rec_1.py Lib/test/crashers/infinite_rec_2.py Lib/test/test_descr.py Lib/test/test_ssl.py Lib/test/test_uuid.py Makefile.pre.in Misc/ACKS Modules/_ctypes/_ctypes.c Modules/_ctypes/_ctypes_test.c Modules/_ctypes/callproc.c Modules/_ctypes/cfield.c Modules/_ctypes/ctypes.h Modules/_ctypes/libffi/configure Modules/_ctypes/libffi/configure.ac Modules/_lsprof.c Modules/_ssl.c Modules/makesetup Modules/posixmodule.c Modules/readline.c Objects/abstract.c Objects/exceptions.c Objects/typeobject.c PCbuild8/readme.txt Parser/parsetok.c Parser/tokenizer.c Parser/tokenizer.h Python/errors.c configure configure.in pyconfig.h.in
thomas.wouters
python-3000-checkins at python.org
Sat Sep 8 19:39:31 CEST 2007
Author: thomas.wouters
Date: Sat Sep 8 19:39:28 2007
New Revision: 58054
Removed:
python/branches/py3k/Lib/test/crashers/infinite_rec_1.py
python/branches/py3k/Lib/test/crashers/infinite_rec_2.py
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Doc/documenting/markup.rst
python/branches/py3k/Doc/library/codecs.rst
python/branches/py3k/Doc/library/copy.rst
python/branches/py3k/Doc/library/ctypes.rst
python/branches/py3k/Doc/library/mutex.rst
python/branches/py3k/Doc/library/queue.rst
python/branches/py3k/Doc/library/re.rst
python/branches/py3k/Doc/library/readline.rst
python/branches/py3k/Doc/library/smtplib.rst
python/branches/py3k/Doc/library/socket.rst
python/branches/py3k/Doc/library/ssl.rst
python/branches/py3k/Doc/library/thread.rst
python/branches/py3k/Doc/library/threading.rst
python/branches/py3k/Doc/whatsnew/2.6.rst
python/branches/py3k/Include/pyerrors.h
python/branches/py3k/Lib/ctypes/__init__.py
python/branches/py3k/Lib/ctypes/test/test_arrays.py
python/branches/py3k/Lib/ctypes/test/test_callbacks.py
python/branches/py3k/Lib/ctypes/test/test_cfuncs.py
python/branches/py3k/Lib/ctypes/test/test_functions.py
python/branches/py3k/Lib/ctypes/test/test_repr.py
python/branches/py3k/Lib/distutils/dep_util.py
python/branches/py3k/Lib/httplib.py
python/branches/py3k/Lib/imaplib.py
python/branches/py3k/Lib/smtplib.py
python/branches/py3k/Lib/test/test_descr.py
python/branches/py3k/Lib/test/test_ssl.py
python/branches/py3k/Lib/test/test_uuid.py
python/branches/py3k/Makefile.pre.in
python/branches/py3k/Misc/ACKS
python/branches/py3k/Modules/_ctypes/_ctypes.c
python/branches/py3k/Modules/_ctypes/_ctypes_test.c
python/branches/py3k/Modules/_ctypes/callproc.c
python/branches/py3k/Modules/_ctypes/cfield.c
python/branches/py3k/Modules/_ctypes/ctypes.h
python/branches/py3k/Modules/_ctypes/libffi/configure
python/branches/py3k/Modules/_ctypes/libffi/configure.ac
python/branches/py3k/Modules/_lsprof.c
python/branches/py3k/Modules/_ssl.c
python/branches/py3k/Modules/makesetup
python/branches/py3k/Modules/posixmodule.c
python/branches/py3k/Modules/readline.c
python/branches/py3k/Objects/abstract.c
python/branches/py3k/Objects/exceptions.c
python/branches/py3k/Objects/typeobject.c
python/branches/py3k/PCbuild8/readme.txt
python/branches/py3k/Parser/parsetok.c
python/branches/py3k/Parser/tokenizer.c
python/branches/py3k/Parser/tokenizer.h
python/branches/py3k/Python/errors.c
python/branches/py3k/configure
python/branches/py3k/configure.in
python/branches/py3k/pyconfig.h.in
Log:
Merged revisions 57778-58052 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r57820 | georg.brandl | 2007-08-31 08:59:27 +0200 (Fri, 31 Aug 2007) | 2 lines
Document new shorthand notation for index entries.
........
r57827 | georg.brandl | 2007-08-31 10:47:51 +0200 (Fri, 31 Aug 2007) | 2 lines
Fix subitem markup.
........
r57833 | martin.v.loewis | 2007-08-31 12:01:07 +0200 (Fri, 31 Aug 2007) | 1 line
Mark registry components as 64-bit on Win64.
........
r57854 | bill.janssen | 2007-08-31 21:02:23 +0200 (Fri, 31 Aug 2007) | 1 line
deprecate use of FakeSocket
........
r57855 | bill.janssen | 2007-08-31 21:02:46 +0200 (Fri, 31 Aug 2007) | 1 line
remove mentions of socket.ssl in comments
........
r57856 | bill.janssen | 2007-08-31 21:03:31 +0200 (Fri, 31 Aug 2007) | 1 line
remove use of non-existent SSLFakeSocket in apparently untested code
........
r57859 | martin.v.loewis | 2007-09-01 08:36:03 +0200 (Sat, 01 Sep 2007) | 3 lines
Bug #1737210: Change Manufacturer of Windows installer to PSF.
Will backport to 2.5.
........
r57865 | georg.brandl | 2007-09-01 09:51:24 +0200 (Sat, 01 Sep 2007) | 2 lines
Fix RST link (backport from Py3k).
........
r57876 | georg.brandl | 2007-09-01 17:49:49 +0200 (Sat, 01 Sep 2007) | 2 lines
Document sets' ">" and "<" operations (backport from py3k).
........
r57878 | skip.montanaro | 2007-09-01 19:40:03 +0200 (Sat, 01 Sep 2007) | 4 lines
Added a note and examples to explain that re.split does not split on an
empty pattern match. (issue 852532).
........
r57879 | walter.doerwald | 2007-09-01 20:18:09 +0200 (Sat, 01 Sep 2007) | 2 lines
Fix wrong function names.
........
r57880 | walter.doerwald | 2007-09-01 20:34:05 +0200 (Sat, 01 Sep 2007) | 2 lines
Fix typo.
........
r57889 | andrew.kuchling | 2007-09-01 22:31:59 +0200 (Sat, 01 Sep 2007) | 1 line
Markup fix
........
r57892 | andrew.kuchling | 2007-09-01 22:43:36 +0200 (Sat, 01 Sep 2007) | 1 line
Add various items
........
r57895 | andrew.kuchling | 2007-09-01 23:17:58 +0200 (Sat, 01 Sep 2007) | 1 line
Wording change
........
r57896 | andrew.kuchling | 2007-09-01 23:18:31 +0200 (Sat, 01 Sep 2007) | 1 line
Add more items
........
r57904 | ronald.oussoren | 2007-09-02 11:46:07 +0200 (Sun, 02 Sep 2007) | 3 lines
Macosx: this patch ensures that the value of MACOSX_DEPLOYMENT_TARGET used
by the Makefile is also used at configure-time.
........
r57925 | georg.brandl | 2007-09-03 09:16:46 +0200 (Mon, 03 Sep 2007) | 2 lines
Fix #883466: don't allow Unicode as arguments to quopri and uu codecs.
........
r57936 | matthias.klose | 2007-09-04 01:33:04 +0200 (Tue, 04 Sep 2007) | 2 lines
- Added support for linking the bsddb module against BerkeleyDB 4.6.x.
........
r57954 | mark.summerfield | 2007-09-04 10:16:15 +0200 (Tue, 04 Sep 2007) | 3 lines
Added cross-references plus a note about dict & list shallow copying.
........
r57958 | martin.v.loewis | 2007-09-04 11:51:57 +0200 (Tue, 04 Sep 2007) | 3 lines
Document that we rely on the OS to release the crypto
context. Fixes #1626801.
........
r57960 | martin.v.loewis | 2007-09-04 15:13:14 +0200 (Tue, 04 Sep 2007) | 3 lines
Patch #1388440: Add set_completion_display_matches_hook and
get_completion_type to readline.
........
r57961 | martin.v.loewis | 2007-09-04 16:19:28 +0200 (Tue, 04 Sep 2007) | 3 lines
Patch #1031213: Decode source line in SyntaxErrors back to its original
source encoding. Will backport to 2.5.
........
r57972 | matthias.klose | 2007-09-04 20:17:36 +0200 (Tue, 04 Sep 2007) | 3 lines
- Makefile.pre.in(buildbottest): Run an optional script pybuildbot.identify
to include some information about the build environment.
........
r57973 | matthias.klose | 2007-09-04 21:05:38 +0200 (Tue, 04 Sep 2007) | 2 lines
- Makefile.pre.in(buildbottest): Remove whitespace at eol.
........
r57975 | matthias.klose | 2007-09-04 22:46:02 +0200 (Tue, 04 Sep 2007) | 2 lines
- Fix libffi configure for hppa*-*-linux* | parisc*-*-linux*.
........
r57980 | bill.janssen | 2007-09-05 02:46:27 +0200 (Wed, 05 Sep 2007) | 1 line
SSL certificate distinguished names should be represented by tuples
........
r57985 | martin.v.loewis | 2007-09-05 08:39:17 +0200 (Wed, 05 Sep 2007) | 3 lines
Patch #1105: Explain that one needs to build the solution
to get dependencies right.
........
r57987 | armin.rigo | 2007-09-05 09:51:21 +0200 (Wed, 05 Sep 2007) | 4 lines
PyDict_GetItem() returns a borrowed reference.
There are probably a number of places that are open to attacks
such as the following one, in bltinmodule.c:min_max().
........
r57991 | martin.v.loewis | 2007-09-05 13:47:34 +0200 (Wed, 05 Sep 2007) | 3 lines
Patch #786737: Allow building in a tree of symlinks pointing to
a readonly source.
........
r57993 | georg.brandl | 2007-09-05 15:36:44 +0200 (Wed, 05 Sep 2007) | 2 lines
Backport from Py3k: Bug #1684991: explain lookup semantics for __special__ methods (new-style classes only).
........
r58004 | armin.rigo | 2007-09-06 10:30:51 +0200 (Thu, 06 Sep 2007) | 4 lines
Patch #1733973 by peaker:
ptrace_enter_call() assumes no exception is currently set.
This assumption is broken when throwing into a generator.
........
r58006 | armin.rigo | 2007-09-06 11:30:38 +0200 (Thu, 06 Sep 2007) | 4 lines
PyDict_GetItem() returns a borrowed reference.
This attack is against ceval.c:IMPORT_NAME, which calls an
object (__builtin__.__import__) without holding a reference to it.
........
r58013 | georg.brandl | 2007-09-06 16:49:56 +0200 (Thu, 06 Sep 2007) | 2 lines
Backport from 3k: #1116: fix reference to old filename.
........
r58021 | thomas.heller | 2007-09-06 22:26:20 +0200 (Thu, 06 Sep 2007) | 1 line
Fix typo: c_float represents to C float type.
........
r58022 | skip.montanaro | 2007-09-07 00:29:06 +0200 (Fri, 07 Sep 2007) | 3 lines
If this is correct for py3k branch and it's already in the release25-maint
branch, seems like it ought to be on the trunk as well.
........
r58023 | gregory.p.smith | 2007-09-07 00:59:59 +0200 (Fri, 07 Sep 2007) | 4 lines
Apply the fix from Issue1112 to make this test more robust and keep
windows happy.
........
r58031 | brett.cannon | 2007-09-07 05:17:50 +0200 (Fri, 07 Sep 2007) | 4 lines
Make uuid1 and uuid4 tests conditional on whether ctypes can be imported;
implementation of either function depends on ctypes but uuid as a whole does
not.
........
r58032 | brett.cannon | 2007-09-07 06:18:30 +0200 (Fri, 07 Sep 2007) | 6 lines
Fix a crasher where Python code managed to infinitely recurse in C code without
ever going back out to Python code in PyObject_Call(). Required introducing a
static RuntimeError instance so that normalizing an exception there is no
reliance on a recursive call that would put the exception system over the
recursion check itself.
........
r58034 | thomas.heller | 2007-09-07 08:32:17 +0200 (Fri, 07 Sep 2007) | 1 line
Add a 'c_longdouble' type to the ctypes module.
........
r58035 | thomas.heller | 2007-09-07 11:30:40 +0200 (Fri, 07 Sep 2007) | 1 line
Remove unneeded #include.
........
r58036 | thomas.heller | 2007-09-07 11:33:24 +0200 (Fri, 07 Sep 2007) | 6 lines
Backport from py3k branch:
Add a workaround for a strange bug on win64, when _ctypes is compiled
with the SDK compiler. This should fix the failing
Lib\ctypes\test\test_as_parameter.py test.
........
r58037 | georg.brandl | 2007-09-07 16:14:40 +0200 (Fri, 07 Sep 2007) | 2 lines
Fix a wrong indentation for sublists.
........
r58043 | georg.brandl | 2007-09-07 22:10:49 +0200 (Fri, 07 Sep 2007) | 2 lines
#1095: ln -f doesn't work portably, fix in Makefile.
........
r58049 | skip.montanaro | 2007-09-08 02:34:17 +0200 (Sat, 08 Sep 2007) | 1 line
be explicit about the actual location of the missing file
........
Modified: python/branches/py3k/Doc/documenting/markup.rst
==============================================================================
--- python/branches/py3k/Doc/documenting/markup.rst (original)
+++ python/branches/py3k/Doc/documenting/markup.rst Sat Sep 8 19:39:28 2007
@@ -707,7 +707,7 @@
For example::
.. index::
- single: execution!context
+ single: execution; context
module: __main__
module: sys
triple: module; search; path
@@ -720,8 +720,8 @@
single
Creates a single index entry. Can be made a subentry by separating the
- subentry text with a semicolon (this is also used below to describe what
- entries are created).
+ subentry text with a semicolon (this notation is also used below to describe
+ what entries are created).
pair
``pair: loop; statement`` is a shortcut that creates two index entries,
namely ``loop; statement`` and ``statement; loop``.
@@ -733,6 +733,13 @@
These all create two index entries. For example, ``module: hashlib`` creates
the entries ``module; hashlib`` and ``hashlib; module``.
+For index directives containing only "single" entries, there is a shorthand
+notation::
+
+ .. index:: BNF, grammar, syntax, notation
+
+This creates four index entries.
+
Grammar production displays
---------------------------
Modified: python/branches/py3k/Doc/library/codecs.rst
==============================================================================
--- python/branches/py3k/Doc/library/codecs.rst (original)
+++ python/branches/py3k/Doc/library/codecs.rst Sat Sep 8 19:39:28 2007
@@ -186,12 +186,12 @@
Implements the ``ignore`` error handling.
-.. function:: xmlcharrefreplace_errors_errors(exception)
+.. function:: xmlcharrefreplace_errors(exception)
Implements the ``xmlcharrefreplace`` error handling.
-.. function:: backslashreplace_errors_errors(exception)
+.. function:: backslashreplace_errors(exception)
Implements the ``backslashreplace`` error handling.
@@ -833,7 +833,7 @@
encoding was used for encoding a Unicode string. Each charmap encoding can
decode any random byte sequence. However that's not possible with UTF-8, as
UTF-8 byte sequences have a structure that doesn't allow arbitrary byte
-sequence. To increase the reliability with which a UTF-8 encoding can be
+sequences. To increase the reliability with which a UTF-8 encoding can be
detected, Microsoft invented a variant of UTF-8 (that Python 2.5 calls
``"utf-8-sig"``) for its Notepad program: Before any of the Unicode characters
is written to the file, a UTF-8 encoded BOM (which looks like this as a byte
Modified: python/branches/py3k/Doc/library/copy.rst
==============================================================================
--- python/branches/py3k/Doc/library/copy.rst (original)
+++ python/branches/py3k/Doc/library/copy.rst Sat Sep 8 19:39:28 2007
@@ -54,6 +54,10 @@
classes (shallow and deeply), by returning the original object unchanged; this
is compatible with the way these are treated by the :mod:`pickle` module.
+Shallow copies of dictionaries can be made using :meth:`dict.copy`, and
+of lists by assigning a slice of the entire list, for example,
+``copied_list = original_list[:]``.
+
.. index:: module: pickle
Classes can use the same interfaces to control copying that they use to control
Modified: python/branches/py3k/Doc/library/ctypes.rst
==============================================================================
--- python/branches/py3k/Doc/library/ctypes.rst (original)
+++ python/branches/py3k/Doc/library/ctypes.rst Sat Sep 8 19:39:28 2007
@@ -247,6 +247,8 @@
+----------------------+--------------------------------+----------------------------+
| :class:`c_double` | ``double`` | float |
+----------------------+--------------------------------+----------------------------+
+ | :class:`c_longdouble`| ``long double`` | float |
+ +----------------------+--------------------------------+----------------------------+
| :class:`c_char_p` | ``char *`` (NUL terminated) | string or ``None`` |
+----------------------+--------------------------------+----------------------------+
| :class:`c_wchar_p` | ``wchar_t *`` (NUL terminated) | unicode or ``None`` |
@@ -2065,9 +2067,16 @@
initializer.
+.. class:: c_longdouble
+
+ Represents the C long double datatype. The constructor accepts an
+ optional float initializer. On platforms where ``sizeof(long
+ double) == sizeof(double)`` it is an alias to :class:`c_double`.
+
+
.. class:: c_float
- Represents the C double datatype. The constructor accepts an optional float
+ Represents the C float datatype. The constructor accepts an optional float
initializer.
Modified: python/branches/py3k/Doc/library/mutex.rst
==============================================================================
--- python/branches/py3k/Doc/library/mutex.rst (original)
+++ python/branches/py3k/Doc/library/mutex.rst Sat Sep 8 19:39:28 2007
@@ -8,8 +8,9 @@
The :mod:`mutex` module defines a class that allows mutual-exclusion via
-acquiring and releasing locks. It does not require (or imply) threading or
-multi-tasking, though it could be useful for those purposes.
+acquiring and releasing locks. It does not require (or imply)
+:mod:`threading` or multi-tasking, though it could be useful for those
+purposes.
The :mod:`mutex` module defines the following class:
Modified: python/branches/py3k/Doc/library/queue.rst
==============================================================================
--- python/branches/py3k/Doc/library/queue.rst (original)
+++ python/branches/py3k/Doc/library/queue.rst Sat Sep 8 19:39:28 2007
@@ -7,10 +7,11 @@
The :mod:`Queue` module implements a multi-producer, multi-consumer FIFO queue.
-It is especially useful in threads programming when information must be
+It is especially useful in threaded programming when information must be
exchanged safely between multiple threads. The :class:`Queue` class in this
module implements all the required locking semantics. It depends on the
-availability of thread support in Python.
+availability of thread support in Python; see the :mod:`threading`
+module.
The :mod:`Queue` module defines the following class and exception:
Modified: python/branches/py3k/Doc/library/re.rst
==============================================================================
--- python/branches/py3k/Doc/library/re.rst (original)
+++ python/branches/py3k/Doc/library/re.rst Sat Sep 8 19:39:28 2007
@@ -546,6 +546,13 @@
>>> re.split('\W+', 'Words, words, words.', 1)
['Words', 'words, words.']
+ Note that *split* will never split a string on an empty pattern match.
+ For example ::
+
+ >>> re.split('x*', 'foo')
+ ['foo']
+ >>> re.split("(?m)^$", "foo\n\nbar\n")
+ ['foo\n\nbar\n']
.. function:: findall(pattern, string[, flags])
Modified: python/branches/py3k/Doc/library/readline.rst
==============================================================================
--- python/branches/py3k/Doc/library/readline.rst (original)
+++ python/branches/py3k/Doc/library/readline.rst Sat Sep 8 19:39:28 2007
@@ -128,6 +128,12 @@
Get the completer function, or ``None`` if no completer function has been set.
+.. function:: get_completion_type()
+
+ Get the type of completion being attempted.
+
+ .. versionadded:: 2.6
+
.. function:: get_begidx()
Get the beginning index of the readline tab-completion scope.
@@ -147,6 +153,16 @@
Get the readline word delimiters for tab-completion.
+.. function:: set_completion_display_matches_hook([function])
+
+ Set or remove the completion display function. If *function* is
+ specified, it will be used as the new completion display function;
+ if omitted or ``None``, any completion display function already
+ installed is removed. The completion display function is called as
+ ``function(substitution, [matches], longest_match_length)`` once
+ each time matches need to be displayed.
+
+ .. versionadded:: 2.6
.. function:: add_history(line)
Modified: python/branches/py3k/Doc/library/smtplib.rst
==============================================================================
--- python/branches/py3k/Doc/library/smtplib.rst (original)
+++ python/branches/py3k/Doc/library/smtplib.rst Sat Sep 8 19:39:28 2007
@@ -47,7 +47,7 @@
.. class:: LMTP([host[, port[, local_hostname]]])
The LMTP protocol, which is very similar to ESMTP, is heavily based on the
- standard SMTP client. It's common to use Unix sockets for LMTP, so our connect()
+ standard SMTP client. It's common to use Unix sockets for LMTP, so our :meth:`connect`
method must support that as well as a regular host:port server. To specify a
Unix socket, you must use an absolute path for *host*, starting with a '/'.
Modified: python/branches/py3k/Doc/library/socket.rst
==============================================================================
--- python/branches/py3k/Doc/library/socket.rst (original)
+++ python/branches/py3k/Doc/library/socket.rst Sat Sep 8 19:39:28 2007
@@ -165,7 +165,7 @@
.. function:: create_connection(address[, timeout])
Connects to the *address* received (as usual, a ``(host, port)`` pair), with an
- optional timeout for the connection. Specially useful for higher-level
+ optional timeout for the connection. Especially useful for higher-level
protocols, it is not normally used directly from application-level code.
Passing the optional *timeout* parameter will set the timeout on the socket
instance (if it is not given or ``None``, the global default timeout setting is
Modified: python/branches/py3k/Doc/library/ssl.rst
==============================================================================
--- python/branches/py3k/Doc/library/ssl.rst (original)
+++ python/branches/py3k/Doc/library/ssl.rst Sat Sep 8 19:39:28 2007
@@ -170,6 +170,8 @@
Some "standard" root certificates are available at
http://www.thawte.com/roots/ (for Thawte roots) and
http://www.verisign.com/support/roots.html (for Verisign roots).
+See also :rfc:`4158` for more discussion of the way in which
+certification chains can be built.
sslsocket Objects
@@ -239,23 +241,23 @@
the certificate), ``notBefore`` (the time before which the certificate should not be trusted),
and ``notAfter`` (the time after which the certificate should not be trusted) filled in.
- The "subject" and "issuer" fields are themselves dictionaries containing the fields given
- in the certificate's data structure for each principal::
+ The "subject" and "issuer" fields are tuples containing the name-value fields
+ given in the certificate's data structure for each principal::
- {'issuer': {'commonName': u'somemachine.python.org',
- 'countryName': u'US',
- 'localityName': u'Wilmington',
- 'organizationName': u'Python Software Foundation',
- 'organizationalUnitName': u'SSL',
- 'stateOrProvinceName': u'Delaware'},
- 'subject': {'commonName': u'somemachine.python.org',
- 'countryName': u'US',
- 'localityName': u'Wilmington',
- 'organizationName': u'Python Software Foundation',
- 'organizationalUnitName': u'SSL',
- 'stateOrProvinceName': u'Delaware'},
- 'notAfter': 'Sep 4 21:54:26 2007 GMT',
- 'notBefore': 'Aug 25 21:54:26 2007 GMT',
+ {'issuer': (('countryName', u'US'),
+ ('stateOrProvinceName', u'Delaware'),
+ ('localityName', u'Wilmington'),
+ ('organizationName', u'Python Software Foundation'),
+ ('organizationalUnitName', u'SSL'),
+ ('commonName', u'somemachine.python.org')),
+ 'notAfter': 'Feb 16 16:54:50 2013 GMT',
+ 'notBefore': 'Aug 27 16:54:50 2007 GMT',
+ 'subject': (('countryName', u'US'),
+ ('stateOrProvinceName', u'Delaware'),
+ ('localityName', u'Wilmington'),
+ ('organizationName', u'Python Software Foundation'),
+ ('organizationalUnitName', u'SSL'),
+ ('commonName', u'somemachine.python.org')),
'version': 2}
This certificate is said to be *self-signed*, because the subject
@@ -311,27 +313,32 @@
# note that closing the sslsocket will also close the underlying socket
ssl_sock.close()
-As of August 25, 2007, the certificate printed by this program
+As of September 4, 2007, the certificate printed by this program
looked like this::
- {'issuer': {'commonName': u'VeriSign Class 3 Extended Validation SSL SGC CA',
- 'countryName': u'US',
- 'organizationName': u'VeriSign, Inc.',
- 'organizationalUnitName': u'Terms of use at https://www.verisign.com/rpa (c)06'},
- 'subject': {'1.3.6.1.4.1.311.60.2.1.2': u'Delaware',
- '1.3.6.1.4.1.311.60.2.1.3': u'US',
- 'commonName': u'www.verisign.com',
- 'countryName': u'US',
- 'localityName': u'Mountain View',
- 'organizationName': u'VeriSign, Inc.',
- 'organizationalUnitName': u'Terms of use at www.verisign.com/rpa (c)06',
- 'postalCode': u'94043',
- 'serialNumber': u'2497886',
- 'stateOrProvinceName': u'California',
- 'streetAddress': u'487 East Middlefield Road'},
- 'notAfter': 'May 8 23:59:59 2009 GMT',
- 'notBefore': 'May 9 00:00:00 2007 GMT',
- 'version': 2}
+ {'issuer': (('countryName', u'US'),
+ ('organizationName', u'VeriSign, Inc.'),
+ ('organizationalUnitName', u'VeriSign Trust Network'),
+ ('organizationalUnitName',
+ u'Terms of use at https://www.verisign.com/rpa (c)06'),
+ ('commonName',
+ u'VeriSign Class 3 Extended Validation SSL SGC CA')),
+ 'notAfter': 'May 8 23:59:59 2009 GMT',
+ 'notBefore': 'May 9 00:00:00 2007 GMT',
+ 'subject': (('serialNumber', u'2497886'),
+ ('1.3.6.1.4.1.311.60.2.1.3', u'US'),
+ ('1.3.6.1.4.1.311.60.2.1.2', u'Delaware'),
+ ('countryName', u'US'),
+ ('postalCode', u'94043'),
+ ('stateOrProvinceName', u'California'),
+ ('localityName', u'Mountain View'),
+ ('streetAddress', u'487 East Middlefield Road'),
+ ('organizationName', u'VeriSign, Inc.'),
+ ('organizationalUnitName', u'Production Security Services'),
+ ('organizationalUnitName',
+ u'Terms of use at www.verisign.com/rpa (c)06'),
+ ('commonName', u'www.verisign.com')),
+ 'version': 2}
Server-side operation
^^^^^^^^^^^^^^^^^^^^^
@@ -383,3 +390,5 @@
`Introducing SSL and Certificates using OpenSSL <http://old.pseudonym.org/ssl/wwwj-index.html>`_, by Frederick J. Hirsch
`Privacy Enhancement for Internet Electronic Mail: Part II: Certificate-Based Key Management`, :rfc:`1422`, by Steve Kent
+
+`Internet X.509 Public Key Infrastructure Certificate and CRL Profile`, :rfc:`3280`, Housley et. al.
Modified: python/branches/py3k/Doc/library/thread.rst
==============================================================================
--- python/branches/py3k/Doc/library/thread.rst (original)
+++ python/branches/py3k/Doc/library/thread.rst Sat Sep 8 19:39:28 2007
@@ -13,9 +13,11 @@
single: semaphores, binary
This module provides low-level primitives for working with multiple threads
-(a.k.a. :dfn:`light-weight processes` or :dfn:`tasks`) --- multiple threads of
+(also called :dfn:`light-weight processes` or :dfn:`tasks`) --- multiple threads of
control sharing their global data space. For synchronization, simple locks
-(a.k.a. :dfn:`mutexes` or :dfn:`binary semaphores`) are provided.
+(also called :dfn:`mutexes` or :dfn:`binary semaphores`) are provided.
+The :mod:`threading` module provides an easier to use and higher-level
+threading API built on top of this module.
.. index::
single: pthreads
Modified: python/branches/py3k/Doc/library/threading.rst
==============================================================================
--- python/branches/py3k/Doc/library/threading.rst (original)
+++ python/branches/py3k/Doc/library/threading.rst Sat Sep 8 19:39:28 2007
@@ -8,6 +8,7 @@
This module constructs higher-level threading interfaces on top of the lower
level :mod:`thread` module.
+See also the :mod:`mutex` and :mod:`Queue` modules.
The :mod:`dummy_threading` module is provided for situations where
:mod:`threading` cannot be used because :mod:`thread` is missing.
Modified: python/branches/py3k/Doc/whatsnew/2.6.rst
==============================================================================
--- python/branches/py3k/Doc/whatsnew/2.6.rst (original)
+++ python/branches/py3k/Doc/whatsnew/2.6.rst Sat Sep 8 19:39:28 2007
@@ -73,6 +73,20 @@
Here are all of the changes that Python 2.6 makes to the core Python language.
+* The :func:`complex` constructor now accepts strings containing
+ parenthesized complex numbers, letting ``complex(repr(cmplx))``
+ will now round-trip values. For example, ``complex('(3+4j)')``
+ now returns the value (3+4j).
+
+ .. % Patch 1491866
+
+* The string :meth:`translate` method now accepts ``None`` as the
+ translation table parameter, which is treated as the identity
+ transformation. This makes it easier to carry out operations
+ that only delete characters. (Contributed by Bengt Richter.)
+
+ .. % Patch 1193128
+
* An obscure change: when you use the the :func:`locals` function inside a
:keyword:`class` statement, the resulting dictionary no longer returns free
variables. (Free variables, in this case, are variables referred to in the
@@ -124,6 +138,11 @@
(Contributed by Fabian Kreutz.)
+* An optional ``timeout`` parameter was added to the
+ :class:`ftplib.FTP` class constructor as well as the :meth:`connect`
+ method, specifying a timeout measured in seconds. (Added by Facundo
+ Batista.)
+
* The :func:`glob.glob` function can now return Unicode filenames if
a Unicode path was used and Unicode filenames are matched within the directory.
@@ -157,6 +176,21 @@
.. % Patch #1490190
+* In the :mod:`os.path` module, the :func:`splitext` function
+ has been changed to not split on leading period characters.
+ This produces better results when operating on Unix's dot-files.
+ For example, ``os.path.splitext('.ipython')``
+ now returns ``('.ipython', '')`` instead of ``('', '.ipython')``.
+
+ .. % Bug #115886
+
+ A new function, :func:`relpath(path, start)` returns a relative path
+ from the ``start`` path, if it's supplied, or from the current
+ working directory to the destination ``path``. (Contributed by
+ Richard Barran.)
+
+ .. % Patch 1339796
+
* New functions in the :mod:`posix` module: :func:`chflags` and :func:`lchflags`
are wrappers for the corresponding system calls (where they're available).
Constants for the flag values are defined in the :mod:`stat` module; some
@@ -166,14 +200,41 @@
* The :mod:`rgbimg` module has been removed.
-* The :mod:`smtplib` module now supports SMTP over SSL thanks to the addition
- of the :class:`SMTP_SSL` class. This class supports an interface identical to
- the existing :class:`SMTP` class. (Contributed by Monty Taylor.)
+* The :mod:`smtplib` module now supports SMTP over SSL thanks to the
+ addition of the :class:`SMTP_SSL` class. This class supports an
+ interface identical to the existing :class:`SMTP` class. Both
+ class constructors also have an optional ``timeout`` parameter
+ that specifies a timeout for the initial connection attempt, measured in
+ seconds.
+
+ An implementation of the LMTP protocol (:rfc:`2033`) was also added to
+ the module. LMTP is used in place of SMTP when transferring e-mail
+ between agents that don't manage a mail queue.
+
+ (SMTP over SSL contributed by Monty Taylor; timeout parameter
+ added by Facundo Batista; LMTP implemented by Leif
+ Hedstrom.)
+
+ .. % Patch #957003
+
+* An optional ``timeout`` parameter was added to the
+ :class:`telnetlib.Telnet` class constructor, specifying a timeout
+ measured in seconds. (Added by Facundo Batista.)
* The :mod:`test.test_support` module now contains a :func:`EnvironmentVarGuard`
context manager that supports temporarily changing environment variables and
automatically restores them to their old values. (Contributed by Brett Cannon.)
+* The :mod:`timeit` module now accepts callables as well as strings
+ for the statement being timed and for the setup code.
+ Two convenience functions were added for creating
+ :class:`Timer` instances:
+ ``repeat(stmt, setup, time, repeat, number)`` and
+ ``timeit(stmt, setup, time, number)`` create an instance and call
+ the corresponding method. (Contributed by Erik Demaine.)
+
+ .. % Patch #1533909
+
.. % ======================================================================
.. % whole new modules get described in \subsections here
Modified: python/branches/py3k/Include/pyerrors.h
==============================================================================
--- python/branches/py3k/Include/pyerrors.h (original)
+++ python/branches/py3k/Include/pyerrors.h Sat Sep 8 19:39:28 2007
@@ -153,6 +153,7 @@
#endif
PyAPI_DATA(PyObject *) PyExc_MemoryErrorInst;
+PyAPI_DATA(PyObject *) PyExc_RecursionErrorInst;
/* Predefined warning categories */
PyAPI_DATA(PyObject *) PyExc_Warning;
Modified: python/branches/py3k/Lib/ctypes/__init__.py
==============================================================================
--- python/branches/py3k/Lib/ctypes/__init__.py (original)
+++ python/branches/py3k/Lib/ctypes/__init__.py Sat Sep 8 19:39:28 2007
@@ -188,6 +188,11 @@
_type_ = "d"
_check_size(c_double)
+class c_longdouble(_SimpleCData):
+ _type_ = "D"
+if sizeof(c_longdouble) == sizeof(c_double):
+ c_longdouble = c_double
+
if _calcsize("l") == _calcsize("q"):
# if long and long long have the same size, make c_longlong an alias for c_long
c_longlong = c_long
Modified: python/branches/py3k/Lib/ctypes/test/test_arrays.py
==============================================================================
--- python/branches/py3k/Lib/ctypes/test/test_arrays.py (original)
+++ python/branches/py3k/Lib/ctypes/test/test_arrays.py Sat Sep 8 19:39:28 2007
@@ -4,7 +4,7 @@
formats = "bBhHiIlLqQfd"
formats = c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint, \
- c_long, c_ulonglong, c_float, c_double
+ c_long, c_ulonglong, c_float, c_double, c_longdouble
class ArrayTestCase(unittest.TestCase):
def test_simple(self):
Modified: python/branches/py3k/Lib/ctypes/test/test_callbacks.py
==============================================================================
--- python/branches/py3k/Lib/ctypes/test/test_callbacks.py (original)
+++ python/branches/py3k/Lib/ctypes/test/test_callbacks.py Sat Sep 8 19:39:28 2007
@@ -77,6 +77,10 @@
self.check_type(c_double, 3.14)
self.check_type(c_double, -3.14)
+ def test_longdouble(self):
+ self.check_type(c_longdouble, 3.14)
+ self.check_type(c_longdouble, -3.14)
+
def test_char(self):
self.check_type(c_char, b"x")
self.check_type(c_char, b"a")
Modified: python/branches/py3k/Lib/ctypes/test/test_cfuncs.py
==============================================================================
--- python/branches/py3k/Lib/ctypes/test/test_cfuncs.py (original)
+++ python/branches/py3k/Lib/ctypes/test/test_cfuncs.py Sat Sep 8 19:39:28 2007
@@ -158,6 +158,18 @@
self.failUnlessEqual(self._dll.tf_bd(0, 42.), 14.)
self.failUnlessEqual(self.S(), 42)
+ def test_longdouble(self):
+ self._dll.tf_D.restype = c_longdouble
+ self._dll.tf_D.argtypes = (c_longdouble,)
+ self.failUnlessEqual(self._dll.tf_D(42.), 14.)
+ self.failUnlessEqual(self.S(), 42)
+
+ def test_longdouble_plus(self):
+ self._dll.tf_bD.restype = c_longdouble
+ self._dll.tf_bD.argtypes = (c_byte, c_longdouble)
+ self.failUnlessEqual(self._dll.tf_bD(0, 42.), 14.)
+ self.failUnlessEqual(self.S(), 42)
+
def test_callwithresult(self):
def process_result(result):
return result * 2
Modified: python/branches/py3k/Lib/ctypes/test/test_functions.py
==============================================================================
--- python/branches/py3k/Lib/ctypes/test/test_functions.py (original)
+++ python/branches/py3k/Lib/ctypes/test/test_functions.py Sat Sep 8 19:39:28 2007
@@ -143,6 +143,18 @@
self.failUnlessEqual(result, -21)
self.failUnlessEqual(type(result), float)
+ def test_longdoubleresult(self):
+ f = dll._testfunc_D_bhilfD
+ f.argtypes = [c_byte, c_short, c_int, c_long, c_float, c_longdouble]
+ f.restype = c_longdouble
+ result = f(1, 2, 3, 4, 5.0, 6.0)
+ self.failUnlessEqual(result, 21)
+ self.failUnlessEqual(type(result), float)
+
+ result = f(-1, -2, -3, -4, -5.0, -6.0)
+ self.failUnlessEqual(result, -21)
+ self.failUnlessEqual(type(result), float)
+
def test_longlongresult(self):
try:
c_longlong
Modified: python/branches/py3k/Lib/ctypes/test/test_repr.py
==============================================================================
--- python/branches/py3k/Lib/ctypes/test/test_repr.py (original)
+++ python/branches/py3k/Lib/ctypes/test/test_repr.py Sat Sep 8 19:39:28 2007
@@ -4,7 +4,7 @@
subclasses = []
for base in [c_byte, c_short, c_int, c_long, c_longlong,
c_ubyte, c_ushort, c_uint, c_ulong, c_ulonglong,
- c_float, c_double, c_bool]:
+ c_float, c_double, c_longdouble, c_bool]:
class X(base):
pass
subclasses.append(X)
Modified: python/branches/py3k/Lib/distutils/dep_util.py
==============================================================================
--- python/branches/py3k/Lib/distutils/dep_util.py (original)
+++ python/branches/py3k/Lib/distutils/dep_util.py Sat Sep 8 19:39:28 2007
@@ -17,7 +17,8 @@
Raise DistutilsFileError if 'source' does not exist.
"""
if not os.path.exists(source):
- raise DistutilsFileError("file '%s' does not exist" % source)
+ raise DistutilsFileError("file '%s' does not exist" %
+ os.path.abspath(source))
if not os.path.exists(target):
return 1
Modified: python/branches/py3k/Lib/httplib.py
==============================================================================
--- python/branches/py3k/Lib/httplib.py (original)
+++ python/branches/py3k/Lib/httplib.py Sat Sep 8 19:39:28 2007
@@ -71,6 +71,7 @@
import mimetools
import socket
from urlparse import urlsplit
+import warnings
__all__ = ["HTTPResponse", "HTTPConnection",
"HTTPException", "NotConnected", "UnknownProtocol",
@@ -988,6 +989,9 @@
def FakeSocket (sock, sslobj):
+ warnings.warn("FakeSocket is deprecated, and won't be in 3.x. " +
+ "Use the result of ssl.sslsocket directly instead.",
+ DeprecationWarning, stacklevel=2)
return sslobj
__all__.append("HTTPSConnection")
Modified: python/branches/py3k/Lib/imaplib.py
==============================================================================
--- python/branches/py3k/Lib/imaplib.py (original)
+++ python/branches/py3k/Lib/imaplib.py Sat Sep 8 19:39:28 2007
@@ -1165,7 +1165,6 @@
def readline(self):
"""Read line from remote."""
- # NB: socket.ssl needs a "readline" method, or perhaps a "makefile" method.
line = []
while 1:
char = self.sslobj.read(1)
@@ -1175,7 +1174,6 @@
def send(self, data):
"""Send data to remote."""
- # NB: socket.ssl needs a "sendall" method to match socket objects.
bytes = len(data)
while bytes > 0:
sent = self.sslobj.write(data)
@@ -1201,7 +1199,7 @@
def ssl(self):
"""Return SSLObject instance used to communicate with the IMAP4 server.
- ssl = <instance>.socket.ssl()
+ ssl = ssl.sslsocket(<instance>.socket)
"""
return self.sslobj
Modified: python/branches/py3k/Lib/smtplib.py
==============================================================================
--- python/branches/py3k/Lib/smtplib.py (original)
+++ python/branches/py3k/Lib/smtplib.py Sat Sep 8 19:39:28 2007
@@ -161,7 +161,6 @@
except ImportError:
_have_ssl = False
else:
-
class SSLFakeFile:
"""A fake file like object that really wraps a SSLObject.
@@ -722,9 +721,8 @@
def _get_socket(self, host, port, timeout):
if self.debuglevel > 0: print('connect:', (host, port), file=stderr)
self.sock = socket.create_connection((host, port), timeout)
- sslobj = socket.ssl(self.sock, self.keyfile, self.certfile)
- self.sock = SSLFakeSocket(self.sock, sslobj)
- self.file = SSLFakeFile(sslobj)
+ self.sock = ssl.sslsocket(self.sock, self.keyfile, self.certfile)
+ self.file = SSLFakeFile(self.sock)
__all__.append("SMTP_SSL")
Deleted: /python/branches/py3k/Lib/test/crashers/infinite_rec_1.py
==============================================================================
--- /python/branches/py3k/Lib/test/crashers/infinite_rec_1.py Sat Sep 8 19:39:28 2007
+++ (empty file)
@@ -1,11 +0,0 @@
-
-# http://python.org/sf/1202533
-
-import new, operator
-
-class A:
- pass
-A.__mul__ = new.instancemethod(operator.mul, None, A)
-
-if __name__ == '__main__':
- A()*2 # segfault: infinite recursion in C
Deleted: /python/branches/py3k/Lib/test/crashers/infinite_rec_2.py
==============================================================================
--- /python/branches/py3k/Lib/test/crashers/infinite_rec_2.py Sat Sep 8 19:39:28 2007
+++ (empty file)
@@ -1,10 +0,0 @@
-
-# http://python.org/sf/1202533
-
-class A(str):
- __get__ = getattr
-
-if __name__ == '__main__':
- a = A('a')
- A.a = a
- a.a # segfault: infinite recursion in C
Modified: python/branches/py3k/Lib/test/test_descr.py
==============================================================================
--- python/branches/py3k/Lib/test/test_descr.py (original)
+++ python/branches/py3k/Lib/test/test_descr.py Sat Sep 8 19:39:28 2007
@@ -4,6 +4,7 @@
from test.test_support import get_original_stdout
from copy import deepcopy
import types
+import new
def veris(a, b):
if a is not b:
@@ -1834,6 +1835,10 @@
## unsafecmp(1, 1L)
## unsafecmp(1L, 1)
+def recursions():
+ if verbose:
+ print("Testing recursion checks ...")
+
## class Letter(str):
## def __new__(cls, letter):
## if letter == 'EPS':
@@ -1843,7 +1848,6 @@
## if not self:
## return 'EPS'
## return self
-
## # sys.stdout needs to be the original to trigger the recursion bug
## import sys
## test_stdout = sys.stdout
@@ -1857,6 +1861,17 @@
## raise TestFailed, "expected a RuntimeError for print recursion"
## sys.stdout = test_stdout
+ # Bug #1202533.
+ class A(object):
+ pass
+ A.__mul__ = new.instancemethod(lambda self, x: self * x, None, A)
+ try:
+ A()*2
+ except RuntimeError:
+ pass
+ else:
+ raise TestFailed("expected a RuntimeError")
+
def weakrefs():
if verbose: print("Testing weak references...")
import weakref
@@ -4153,6 +4168,7 @@
overloading()
methods()
specials()
+ recursions()
weakrefs()
properties()
supers()
Modified: python/branches/py3k/Lib/test/test_ssl.py
==============================================================================
--- python/branches/py3k/Lib/test/test_ssl.py (original)
+++ python/branches/py3k/Lib/test/test_ssl.py Sat Sep 8 19:39:28 2007
@@ -137,18 +137,15 @@
cert = c2.getpeercert()
if not cert:
raise test_support.TestFailed("Can't get peer certificate.")
+ if test_support.verbose:
+ sys.stdout.write(pprint.pformat(cert) + '\n')
if not cert.has_key('subject'):
raise test_support.TestFailed(
"No subject field in certificate: %s." %
pprint.pformat(cert))
- if not (cert['subject'].has_key('organizationName')):
- raise test_support.TestFailed(
- "No 'organizationName' field in certificate subject: %s." %
- pprint.pformat(cert))
- if (cert['subject']['organizationName'] !=
- "Python Software Foundation"):
+ if not ('organizationName', 'Python Software Foundation') in cert['subject']:
raise test_support.TestFailed(
- "Invalid 'organizationName' field in certificate subject; "
+ "Missing or invalid 'organizationName' field in certificate subject; "
"should be 'Python Software Foundation'.");
c2.close()
@@ -336,7 +333,7 @@
def test_main(verbose=False):
if skip_expected:
- raise test_support.TestSkipped("socket module has no ssl support")
+ raise test_support.TestSkipped("No SSL support")
global CERTFILE
CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir,
Modified: python/branches/py3k/Lib/test/test_uuid.py
==============================================================================
--- python/branches/py3k/Lib/test/test_uuid.py (original)
+++ python/branches/py3k/Lib/test/test_uuid.py Sat Sep 8 19:39:28 2007
@@ -364,6 +364,12 @@
self.assertEqual(node1, node2)
def test_uuid1(self):
+ # uuid1 requires ctypes.
+ try:
+ import ctypes
+ except ImportError:
+ return
+
equal = self.assertEqual
# Make sure uuid1() generates UUIDs that are actually version 1.
@@ -417,6 +423,12 @@
equal(str(u), v)
def test_uuid4(self):
+ # uuid4 requires ctypes.
+ try:
+ import ctypes
+ except ImportError:
+ return
+
equal = self.assertEqual
# Make sure uuid4() generates UUIDs that are actually version 4.
Modified: python/branches/py3k/Makefile.pre.in
==============================================================================
--- python/branches/py3k/Makefile.pre.in (original)
+++ python/branches/py3k/Makefile.pre.in Sat Sep 8 19:39:28 2007
@@ -61,7 +61,7 @@
# Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
# be able to build extension modules using the directories specified in the
# environment variables
-CPPFLAGS= -I. -I$(srcdir)/Include @CPPFLAGS@
+CPPFLAGS= -I. -IInclude -I$(srcdir)/Include @CPPFLAGS@
LDFLAGS= @LDFLAGS@
LDLAST= @LDLAST@
SGI_ABI= @SGI_ABI@
@@ -473,6 +473,7 @@
$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
+ -@ mkdir Include
-$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
$(PGEN): $(PGENOBJS)
@@ -619,7 +620,11 @@
# Like testall, but with a single pass only
+# run an optional script to include some information about the build environment
buildbottest: all platform
+ - at if which pybuildbot.identify >/dev/null 2>&1; then \
+ pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
+ fi
$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
@@ -673,7 +678,8 @@
else true; \
fi
(cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
- (cd $(DESTDIR)$(BINDIR); $(LN) -sf python$(VERSION)-config python-config)
+ -rm -f $(DESTDIR)$(BINDIR)/python-config
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python-config)
# Install the interpreter with $(VERSION) affixed
# This goes into $(exec_prefix)
Modified: python/branches/py3k/Misc/ACKS
==============================================================================
--- python/branches/py3k/Misc/ACKS (original)
+++ python/branches/py3k/Misc/ACKS Sat Sep 8 19:39:28 2007
@@ -80,6 +80,7 @@
Peter Bosch
Eric Bouck
Thierry Bousch
+Sebastian Boving
Monty Brandenberg
Georg Brandl
Terrence Brannon
@@ -320,6 +321,7 @@
Tony Ingraldi
John Interrante
Bob Ippolito
+Atsuo Ishimoto
Ben Jackson
Paul Jackson
David Jacobs
Modified: python/branches/py3k/Modules/_ctypes/_ctypes.c
==============================================================================
--- python/branches/py3k/Modules/_ctypes/_ctypes.c (original)
+++ python/branches/py3k/Modules/_ctypes/_ctypes.c Sat Sep 8 19:39:28 2007
@@ -1104,7 +1104,7 @@
*/
-static char *SIMPLE_TYPE_CHARS = "cbBhHiIlLdfuzZqQPXOvt";
+static char *SIMPLE_TYPE_CHARS = "cbBhHiIlLdfuzZqQPXOvtD";
static PyObject *
c_wchar_p_from_param(PyObject *type, PyObject *value)
Modified: python/branches/py3k/Modules/_ctypes/_ctypes_test.c
==============================================================================
--- python/branches/py3k/Modules/_ctypes/_ctypes_test.c (original)
+++ python/branches/py3k/Modules/_ctypes/_ctypes_test.c Sat Sep 8 19:39:28 2007
@@ -12,6 +12,29 @@
/* some functions handy for testing */
+EXPORT(long double)testfunc_Ddd(double a, double b)
+{
+ long double result = (long double)(a * b);
+ printf("testfunc_Ddd(%p, %p)\n", &a, &b);
+ printf("testfunc_Ddd(%g, %g)\n", a, b);
+ return result;
+}
+
+EXPORT(long double)testfunc_DDD(long double a, long double b)
+{
+ long double result = a * b;
+ printf("testfunc_DDD(%p, %p)\n", &a, &b);
+ printf("testfunc_DDD(%Lg, %Lg)\n", a, b);
+ return result;
+}
+
+EXPORT(int)testfunc_iii(int a, int b)
+{
+ int result = a * b;
+ printf("testfunc_iii(%p, %p)\n", &a, &b);
+ return result;
+}
+
EXPORT(int)myprintf(char *fmt, ...)
{
int result;
@@ -77,6 +100,14 @@
return (double)(b + h + i + l + f + d);
}
+EXPORT(long double) _testfunc_D_bhilfD(signed char b, short h, int i, long l, float f, long double d)
+{
+/* printf("_testfunc_d_bhilfd got %d %d %d %ld %f %f\n",
+ b, h, i, l, f, d);
+*/
+ return (long double)(b + h + i + l + f + d);
+}
+
EXPORT(char *) _testfunc_p_p(void *s)
{
return (char *)s;
@@ -391,6 +422,7 @@
EXPORT(unsigned PY_LONG_LONG) tf_Q(unsigned PY_LONG_LONG c) { U; return c/3; }
EXPORT(float) tf_f(float c) { S; return c/3; }
EXPORT(double) tf_d(double c) { S; return c/3; }
+EXPORT(long double) tf_D(long double c) { S; return c/3; }
#ifdef MS_WIN32
EXPORT(signed char) __stdcall s_tf_b(signed char c) { S; return c/3; }
@@ -405,6 +437,7 @@
EXPORT(unsigned PY_LONG_LONG) __stdcall s_tf_Q(unsigned PY_LONG_LONG c) { U; return c/3; }
EXPORT(float) __stdcall s_tf_f(float c) { S; return c/3; }
EXPORT(double) __stdcall s_tf_d(double c) { S; return c/3; }
+EXPORT(long double) __stdcall s_tf_D(long double c) { S; return c/3; }
#endif
/*******/
@@ -420,6 +453,7 @@
EXPORT(unsigned PY_LONG_LONG) tf_bQ(signed char x, unsigned PY_LONG_LONG c) { U; return c/3; }
EXPORT(float) tf_bf(signed char x, float c) { S; return c/3; }
EXPORT(double) tf_bd(signed char x, double c) { S; return c/3; }
+EXPORT(long double) tf_bD(signed char x, long double c) { S; return c/3; }
EXPORT(void) tv_i(int c) { S; return; }
#ifdef MS_WIN32
@@ -435,6 +469,7 @@
EXPORT(unsigned PY_LONG_LONG) __stdcall s_tf_bQ(signed char x, unsigned PY_LONG_LONG c) { U; return c/3; }
EXPORT(float) __stdcall s_tf_bf(signed char x, float c) { S; return c/3; }
EXPORT(double) __stdcall s_tf_bd(signed char x, double c) { S; return c/3; }
+EXPORT(long double) __stdcall s_tf_bD(signed char x, long double c) { S; return c/3; }
EXPORT(void) __stdcall s_tv_i(int c) { S; return; }
#endif
Modified: python/branches/py3k/Modules/_ctypes/callproc.c
==============================================================================
--- python/branches/py3k/Modules/_ctypes/callproc.c (original)
+++ python/branches/py3k/Modules/_ctypes/callproc.c Sat Sep 8 19:39:28 2007
@@ -444,6 +444,7 @@
#ifdef HAVE_LONG_LONG
PY_LONG_LONG q;
#endif
+ long double D;
double d;
float f;
void *p;
Modified: python/branches/py3k/Modules/_ctypes/cfield.c
==============================================================================
--- python/branches/py3k/Modules/_ctypes/cfield.c (original)
+++ python/branches/py3k/Modules/_ctypes/cfield.c Sat Sep 8 19:39:28 2007
@@ -977,6 +977,29 @@
*/
+static PyObject *
+D_set(void *ptr, PyObject *value, Py_ssize_t size)
+{
+ long double x;
+
+ x = PyFloat_AsDouble(value);
+ if (x == -1 && PyErr_Occurred()) {
+ PyErr_Format(PyExc_TypeError,
+ " float expected instead of %s instance",
+ value->ob_type->tp_name);
+ return NULL;
+ }
+ memcpy(ptr, &x, sizeof(long double));
+ _RET(value);
+}
+
+static PyObject *
+D_get(void *ptr, Py_ssize_t size)
+{
+ long double val;
+ memcpy(&val, ptr, sizeof(long double));
+ return PyFloat_FromDouble(val);
+}
static PyObject *
d_set(void *ptr, PyObject *value, Py_ssize_t size)
@@ -1591,6 +1614,7 @@
{ 'B', B_set, B_get, &ffi_type_uchar},
{ 'c', c_set, c_get, &ffi_type_schar},
{ 'd', d_set, d_get, &ffi_type_double, d_set_sw, d_get_sw},
+ { 'D', D_set, D_get, &ffi_type_longdouble},
{ 'f', f_set, f_get, &ffi_type_float, f_set_sw, f_get_sw},
{ 'h', h_set, h_get, &ffi_type_sshort, h_set_sw, h_get_sw},
{ 'H', H_set, H_get, &ffi_type_ushort, H_set_sw, H_get_sw},
@@ -1673,6 +1697,7 @@
typedef struct { char c; long x; } s_long;
typedef struct { char c; float x; } s_float;
typedef struct { char c; double x; } s_double;
+typedef struct { char c; long double x; } s_long_double;
typedef struct { char c; char *x; } s_char_p;
typedef struct { char c; void *x; } s_void_p;
@@ -1684,6 +1709,8 @@
*/
#define FLOAT_ALIGN (sizeof(s_float) - sizeof(float))
#define DOUBLE_ALIGN (sizeof(s_double) - sizeof(double))
+#define LONGDOUBLE_ALIGN (sizeof(s_long_double) - sizeof(long double))
+
/* #define CHAR_P_ALIGN (sizeof(s_char_p) - sizeof(char*)) */
#define VOID_P_ALIGN (sizeof(s_void_p) - sizeof(void*))
@@ -1729,6 +1756,8 @@
ffi_type ffi_type_float = { sizeof(float), FLOAT_ALIGN, FFI_TYPE_FLOAT };
ffi_type ffi_type_double = { sizeof(double), DOUBLE_ALIGN, FFI_TYPE_DOUBLE };
+ffi_type ffi_type_longdouble = { sizeof(long double), LONGDOUBLE_ALIGN,
+ FFI_TYPE_LONGDOUBLE };
/* ffi_type ffi_type_longdouble */
Modified: python/branches/py3k/Modules/_ctypes/ctypes.h
==============================================================================
--- python/branches/py3k/Modules/_ctypes/ctypes.h (original)
+++ python/branches/py3k/Modules/_ctypes/ctypes.h Sat Sep 8 19:39:28 2007
@@ -30,6 +30,7 @@
#ifdef HAVE_LONG_LONG
PY_LONG_LONG ll;
#endif
+ long double D;
};
/*
@@ -283,6 +284,7 @@
#ifdef HAVE_LONG_LONG
PY_LONG_LONG q;
#endif
+ long double D;
double d;
float f;
void *p;
Modified: python/branches/py3k/Modules/_ctypes/libffi/configure
==============================================================================
--- python/branches/py3k/Modules/_ctypes/libffi/configure (original)
+++ python/branches/py3k/Modules/_ctypes/libffi/configure Sat Sep 8 19:39:28 2007
@@ -3533,7 +3533,7 @@
sh-*-linux* | sh[34]*-*-linux*) TARGET=SH; TARGETDIR=sh;;
sh-*-rtems*) TARGET=SH; TARGETDIR=sh;;
sh64-*-linux* | sh5*-*-linux*) TARGET=SH64; TARGETDIR=sh64;;
-hppa-*-linux* | parisc-*-linux*) TARGET=PA; TARGETDIR=pa;;
+hppa*-*-linux* | parisc*-*-linux*) TARGET=PA; TARGETDIR=pa;;
esac
if test $TARGETDIR = unknown; then
Modified: python/branches/py3k/Modules/_ctypes/libffi/configure.ac
==============================================================================
--- python/branches/py3k/Modules/_ctypes/libffi/configure.ac (original)
+++ python/branches/py3k/Modules/_ctypes/libffi/configure.ac Sat Sep 8 19:39:28 2007
@@ -71,7 +71,7 @@
sh-*-linux* | sh[[34]]*-*-linux*) TARGET=SH; TARGETDIR=sh;;
sh-*-rtems*) TARGET=SH; TARGETDIR=sh;;
sh64-*-linux* | sh5*-*-linux*) TARGET=SH64; TARGETDIR=sh64;;
-hppa-*-linux* | parisc-*-linux*) TARGET=PA; TARGETDIR=pa;;
+hppa*-*-linux* | parisc*-*-linux*) TARGET=PA; TARGETDIR=pa;;
esac
if test $TARGETDIR = unknown; then
Modified: python/branches/py3k/Modules/_lsprof.c
==============================================================================
--- python/branches/py3k/Modules/_lsprof.c (original)
+++ python/branches/py3k/Modules/_lsprof.c Sat Sep 8 19:39:28 2007
@@ -372,11 +372,20 @@
ProfilerEntry *profEntry;
ProfilerContext *pContext;
+ /* In the case of entering a generator expression frame via a
+ * throw (gen_send_ex(.., 1)), we may already have an
+ * Exception set here. We must not mess around with this
+ * exception, and some of the code under here assumes that
+ * PyErr_* is its own to mess around with, so we have to
+ * save and restore any current exception. */
+ PyObject *last_type, *last_value, *last_tb;
+ PyErr_Fetch(&last_type, &last_value, &last_tb);
+
profEntry = getEntry(pObj, key);
if (profEntry == NULL) {
profEntry = newProfilerEntry(pObj, key, userObj);
if (profEntry == NULL)
- return;
+ goto restorePyerr;
}
/* grab a ProfilerContext out of the free list */
pContext = pObj->freelistProfilerContext;
@@ -389,10 +398,13 @@
malloc(sizeof(ProfilerContext));
if (pContext == NULL) {
pObj->flags |= POF_NOMEMORY;
- return;
+ goto restorePyerr;
}
}
initContext(pObj, pContext, profEntry);
+
+restorePyerr:
+ PyErr_Restore(last_type, last_value, last_tb);
}
static void
Modified: python/branches/py3k/Modules/_ssl.c
==============================================================================
--- python/branches/py3k/Modules/_ssl.c (original)
+++ python/branches/py3k/Modules/_ssl.c Sat Sep 8 19:39:28 2007
@@ -437,12 +437,15 @@
}
static PyObject *
-_create_dict_for_X509_NAME (X509_NAME *xname)
+_create_tuple_for_X509_NAME (X509_NAME *xname)
{
- PyObject *pd = PyDict_New();
+ PyObject *pt = NULL;
+ PyObject *entry_tuple = NULL;
+ int entry_count = X509_NAME_entry_count(xname);
int index_counter;
- if (pd == NULL)
+ pt = PyTuple_New(entry_count);
+ if (pt == NULL)
return NULL;
for (index_counter = 0;
@@ -480,18 +483,20 @@
Py_DECREF(name_obj);
goto fail0;
}
- if (PyDict_SetItem(pd, name_obj, value_obj) < 0) {
+ entry_tuple = PyTuple_New(2);
+ if (entry_tuple == NULL) {
Py_DECREF(name_obj);
Py_DECREF(value_obj);
goto fail0;
}
- Py_DECREF(name_obj);
- Py_DECREF(value_obj);
+ PyTuple_SET_ITEM(entry_tuple, 0, name_obj);
+ PyTuple_SET_ITEM(entry_tuple, 1, value_obj);
+ PyTuple_SET_ITEM(pt, index_counter, entry_tuple);
}
- return pd;
+ return pt;
fail0:
- Py_XDECREF(pd);
+ Py_XDECREF(pt);
return NULL;
}
@@ -520,7 +525,7 @@
if ((verification & SSL_VERIFY_PEER) == 0)
return retval;
- peer = _create_dict_for_X509_NAME(
+ peer = _create_tuple_for_X509_NAME(
X509_get_subject_name(self->peer_cert));
if (peer == NULL)
goto fail0;
@@ -530,7 +535,7 @@
}
Py_DECREF(peer);
- issuer = _create_dict_for_X509_NAME(
+ issuer = _create_tuple_for_X509_NAME(
X509_get_issuer_name(self->peer_cert));
if (issuer == NULL)
goto fail0;
Modified: python/branches/py3k/Modules/makesetup
==============================================================================
--- python/branches/py3k/Modules/makesetup (original)
+++ python/branches/py3k/Modules/makesetup Sat Sep 8 19:39:28 2007
@@ -238,7 +238,7 @@
no) SHAREDMODS="$SHAREDMODS $file";;
esac
rule="$file: $objs"
- rule="$rule; \$(LDSHARED) $objs $libs $ExtraLibs -o $file"
+ rule="$rule; \$(BLDSHARED) $objs $libs $ExtraLibs -o $file"
echo "$rule" >>$rulesf
done
done
Modified: python/branches/py3k/Modules/posixmodule.c
==============================================================================
--- python/branches/py3k/Modules/posixmodule.c (original)
+++ python/branches/py3k/Modules/posixmodule.c Sat Sep 8 19:39:28 2007
@@ -6540,6 +6540,8 @@
BYTE *pbBuffer );
static CRYPTGENRANDOM pCryptGenRandom = NULL;
+/* This handle is never explicitly released. Instead, the operating
+ system will release it when the process terminates. */
static HCRYPTPROV hCryptProv = 0;
static PyObject*
Modified: python/branches/py3k/Modules/readline.c
==============================================================================
--- python/branches/py3k/Modules/readline.c (original)
+++ python/branches/py3k/Modules/readline.c Sat Sep 8 19:39:28 2007
@@ -198,6 +198,7 @@
/* Exported functions to specify hook functions in Python */
+static PyObject *completion_display_matches_hook = NULL;
static PyObject *startup_hook = NULL;
#ifdef HAVE_RL_PRE_INPUT_HOOK
@@ -205,6 +206,20 @@
#endif
static PyObject *
+set_completion_display_matches_hook(PyObject *self, PyObject *args)
+{
+ return set_hook("completion_display_matches_hook",
+ &completion_display_matches_hook, args);
+}
+
+PyDoc_STRVAR(doc_set_completion_display_matches_hook,
+"set_completion_display_matches_hook([function]) -> None\n\
+Set or remove the completion display function.\n\
+The function is called as\n\
+ function(substitution, [matches], longest_match_length)\n\
+once each time matches need to be displayed.");
+
+static PyObject *
set_startup_hook(PyObject *self, PyObject *args)
{
return set_hook("startup_hook", &startup_hook, args);
@@ -245,6 +260,18 @@
static PyObject *endidx = NULL;
+/* Get the completion type for the scope of the tab-completion */
+static PyObject *
+get_completion_type(PyObject *self, PyObject *noarg)
+{
+ return PyInt_FromLong(rl_completion_type);
+}
+
+PyDoc_STRVAR(doc_get_completion_type,
+"get_completion_type() -> int\n\
+Get the type of completion being attempted.");
+
+
/* Get the beginning index for the scope of the tab-completion */
static PyObject *
@@ -557,6 +584,8 @@
METH_NOARGS, get_history_length_doc},
{"set_completer", set_completer, METH_VARARGS, doc_set_completer},
{"get_completer", get_completer, METH_NOARGS, doc_get_completer},
+ {"get_completion_type", get_completion_type,
+ METH_NOARGS, doc_get_completion_type},
{"get_begidx", get_begidx, METH_NOARGS, doc_get_begidx},
{"get_endidx", get_endidx, METH_NOARGS, doc_get_endidx},
@@ -568,6 +597,8 @@
{"get_completer_delims", get_completer_delims,
METH_NOARGS, doc_get_completer_delims},
+ {"set_completion_display_matches_hook", set_completion_display_matches_hook,
+ METH_VARARGS, doc_set_completion_display_matches_hook},
{"set_startup_hook", set_startup_hook,
METH_VARARGS, doc_set_startup_hook},
#ifdef HAVE_RL_PRE_INPUT_HOOK
@@ -631,6 +662,48 @@
#endif
+/* C function to call the Python completion_display_matches */
+
+static void
+on_completion_display_matches_hook(char **matches,
+ int num_matches, int max_length)
+{
+ if (completion_display_matches_hook != NULL) {
+ int i;
+ PyObject *m, *s;
+ PyObject *r;
+#ifdef WITH_THREAD
+ PyGILState_STATE gilstate = PyGILState_Ensure();
+#endif
+ m = PyList_New(num_matches);
+ for (i = 0; i < num_matches; i++) {
+ s = PyString_FromString(matches[i+1]);
+ PyList_SetItem(m, i, s);
+ }
+
+ r = PyObject_CallFunction(completion_display_matches_hook,
+ "sOi", matches[0], m, max_length);
+
+ Py_DECREF(m);
+
+ if (r == NULL ||
+ (r != Py_None && PyInt_AsLong(r) == -1 && PyErr_Occurred())) {
+ goto error;
+ }
+
+ Py_DECREF(r);
+ goto done;
+ error:
+ PyErr_Clear();
+ Py_XDECREF(r);
+ done:
+#ifdef WITH_THREAD
+ PyGILState_Release(gilstate);
+#endif
+ }
+}
+
+
/* C function to call the Python completer. */
static char *
@@ -708,6 +781,10 @@
rl_bind_key_in_map ('\t', rl_complete, emacs_meta_keymap);
rl_bind_key_in_map ('\033', rl_complete, emacs_meta_keymap);
/* Set our hook functions */
+#ifdef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK
+ rl_completion_display_matches_hook =
+ (rl_compdisp_func_t *)on_completion_display_matches_hook;
+#endif
rl_startup_hook = (Function *)on_startup_hook;
#ifdef HAVE_RL_PRE_INPUT_HOOK
rl_pre_input_hook = (Function *)on_pre_input_hook;
Modified: python/branches/py3k/Objects/abstract.c
==============================================================================
--- python/branches/py3k/Objects/abstract.c (original)
+++ python/branches/py3k/Objects/abstract.c Sat Sep 8 19:39:28 2007
@@ -2047,7 +2047,11 @@
ternaryfunc call;
if ((call = func->ob_type->tp_call) != NULL) {
- PyObject *result = (*call)(func, arg, kw);
+ PyObject *result;
+ if (Py_EnterRecursiveCall(" while calling a Python object"))
+ return NULL;
+ result = (*call)(func, arg, kw);
+ Py_LeaveRecursiveCall();
if (result == NULL && !PyErr_Occurred())
PyErr_SetString(
PyExc_SystemError,
Modified: python/branches/py3k/Objects/exceptions.c
==============================================================================
--- python/branches/py3k/Objects/exceptions.c (original)
+++ python/branches/py3k/Objects/exceptions.c Sat Sep 8 19:39:28 2007
@@ -1715,6 +1715,12 @@
*/
PyObject *PyExc_MemoryErrorInst=NULL;
+/* Pre-computed RuntimeError instance for when recursion depth is reached.
+ Meant to be used when normalizing the exception for exceeding the recursion
+ depth will cause its own infinite recursion.
+*/
+PyObject *PyExc_RecursionErrorInst = NULL;
+
#define PRE_INIT(TYPE) if (PyType_Ready(&_PyExc_ ## TYPE) < 0) \
Py_FatalError("exceptions bootstrapping error.");
@@ -1867,6 +1873,29 @@
if (!PyExc_MemoryErrorInst)
Py_FatalError("Cannot pre-allocate MemoryError instance\n");
+ PyExc_RecursionErrorInst = BaseException_new(&_PyExc_RuntimeError, NULL, NULL);
+ if (!PyExc_RecursionErrorInst)
+ Py_FatalError("Cannot pre-allocate RuntimeError instance for "
+ "recursion errors");
+ else {
+ PyBaseExceptionObject *err_inst =
+ (PyBaseExceptionObject *)PyExc_RecursionErrorInst;
+ PyObject *args_tuple;
+ PyObject *exc_message;
+ exc_message = PyString_FromString("maximum recursion depth exceeded");
+ if (!exc_message)
+ Py_FatalError("cannot allocate argument for RuntimeError "
+ "pre-allocation");
+ args_tuple = PyTuple_Pack(1, exc_message);
+ if (!args_tuple)
+ Py_FatalError("cannot allocate tuple for RuntimeError "
+ "pre-allocation");
+ Py_DECREF(exc_message);
+ if (BaseException_init(err_inst, args_tuple, NULL))
+ Py_FatalError("init of pre-allocated RuntimeError failed");
+ Py_DECREF(args_tuple);
+ }
+
Py_DECREF(bltinmod);
#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
Modified: python/branches/py3k/Objects/typeobject.c
==============================================================================
--- python/branches/py3k/Objects/typeobject.c (original)
+++ python/branches/py3k/Objects/typeobject.c Sat Sep 8 19:39:28 2007
@@ -4647,16 +4647,7 @@
if (meth == NULL)
return NULL;
- /* PyObject_Call() will end up calling slot_tp_call() again if
- the object returned for __call__ has __call__ itself defined
- upon it. This can be an infinite recursion if you set
- __call__ in a class to an instance of it. */
- if (Py_EnterRecursiveCall(" in __call__")) {
- Py_DECREF(meth);
- return NULL;
- }
res = PyObject_Call(meth, args, kwds);
- Py_LeaveRecursiveCall();
Py_DECREF(meth);
return res;
Modified: python/branches/py3k/PCbuild8/readme.txt
==============================================================================
--- python/branches/py3k/PCbuild8/readme.txt (original)
+++ python/branches/py3k/PCbuild8/readme.txt Sat Sep 8 19:39:28 2007
@@ -90,6 +90,13 @@
large tables of Unicode data
winsound
play sounds (typically .wav files) under Windows
+
+Note: Check the dependencies of subprojects when building a subproject. You
+need to manually build each of the dependencies, in order, first. A good
+example of this is the pythoncore subproject. It is dependent on both the
+make_versioninfo and the make_buildinfo subprojects. You can check the build
+order by right clicking on the project name, in the solution explorer, and
+selecting the project build order item.
The following subprojects will generally NOT build out of the box. They
wrap code Python doesn't control, and you'll need to download the base
Modified: python/branches/py3k/Parser/parsetok.c
==============================================================================
--- python/branches/py3k/Parser/parsetok.c (original)
+++ python/branches/py3k/Parser/parsetok.c Sat Sep 8 19:39:28 2007
@@ -213,16 +213,24 @@
err_ret->error = E_EOF;
err_ret->lineno = tok->lineno;
if (tok->buf != NULL) {
+ char *text = NULL;
size_t len;
assert(tok->cur - tok->buf < INT_MAX);
err_ret->offset = (int)(tok->cur - tok->buf);
len = tok->inp - tok->buf;
- err_ret->text = (char *) PyObject_MALLOC(len + 1);
- if (err_ret->text != NULL) {
- if (len > 0)
- strncpy(err_ret->text, tok->buf, len);
- err_ret->text[len] = '\0';
+#ifdef Py_USING_UNICODE
+ text = PyTokenizer_RestoreEncoding(tok, len, &err_ret->offset);
+
+#endif
+ if (text == NULL) {
+ text = (char *) PyObject_MALLOC(len + 1);
+ if (text != NULL) {
+ if (len > 0)
+ strncpy(text, tok->buf, len);
+ text[len] = '\0';
+ }
}
+ err_ret->text = text;
}
} else if (tok->encoding != NULL) {
node* r = PyNode_New(encoding_decl);
Modified: python/branches/py3k/Parser/tokenizer.c
==============================================================================
--- python/branches/py3k/Parser/tokenizer.c (original)
+++ python/branches/py3k/Parser/tokenizer.c Sat Sep 8 19:39:28 2007
@@ -1536,6 +1536,68 @@
return result;
}
+/* This function is only called from parsetok. However, it cannot live
+ there, as it must be empty for PGEN, and we can check for PGEN only
+ in this file. */
+
+#ifdef PGEN
+char*
+PyTokenizer_RestoreEncoding(struct tok_state* tok, int len, int* offset)
+{
+ return NULL;
+}
+#else
+static PyObject *
+dec_utf8(const char *enc, const char *text, size_t len) {
+ PyObject *ret = NULL;
+ PyObject *unicode_text = PyUnicode_DecodeUTF8(text, len, "replace");
+ if (unicode_text) {
+ ret = PyUnicode_AsEncodedString(unicode_text, enc, "replace");
+ Py_DECREF(unicode_text);
+ }
+ if (!ret) {
+ PyErr_Print();
+ }
+ return ret;
+}
+
+char *
+PyTokenizer_RestoreEncoding(struct tok_state* tok, int len, int *offset)
+{
+ char *text = NULL;
+ if (tok->encoding) {
+ /* convert source to original encondig */
+ PyObject *lineobj = dec_utf8(tok->encoding, tok->buf, len);
+ if (lineobj != NULL) {
+ int linelen = PyString_Size(lineobj);
+ const char *line = PyString_AsString(lineobj);
+ text = PyObject_MALLOC(linelen + 1);
+ if (text != NULL && line != NULL) {
+ if (linelen)
+ strncpy(text, line, linelen);
+ text[linelen] = '\0';
+ }
+ Py_DECREF(lineobj);
+
+ /* adjust error offset */
+ if (*offset > 1) {
+ PyObject *offsetobj = dec_utf8(tok->encoding,
+ tok->buf, *offset-1);
+ if (offsetobj) {
+ *offset = PyString_Size(offsetobj) + 1;
+ Py_DECREF(offsetobj);
+ }
+ }
+
+ }
+ }
+ return text;
+
+}
+#endif
+
+
+
#ifdef Py_DEBUG
void
Modified: python/branches/py3k/Parser/tokenizer.h
==============================================================================
--- python/branches/py3k/Parser/tokenizer.h (original)
+++ python/branches/py3k/Parser/tokenizer.h Sat Sep 8 19:39:28 2007
@@ -59,6 +59,8 @@
char *, char *);
extern void PyTokenizer_Free(struct tok_state *);
extern int PyTokenizer_Get(struct tok_state *, char **, char **);
+extern char * PyTokenizer_RestoreEncoding(struct tok_state* tok,
+ int len, int *offset);
#ifdef __cplusplus
}
Modified: python/branches/py3k/Python/errors.c
==============================================================================
--- python/branches/py3k/Python/errors.c (original)
+++ python/branches/py3k/Python/errors.c Sat Sep 8 19:39:28 2007
@@ -139,6 +139,7 @@
PyObject *value = *val;
PyObject *inclass = NULL;
PyObject *initial_tb = NULL;
+ PyThreadState *tstate = NULL;
if (type == NULL) {
/* There was no exception, so nothing to do. */
@@ -214,7 +215,14 @@
Py_DECREF(initial_tb);
}
/* normalize recursively */
+ tstate = PyThreadState_GET();
+ if (++tstate->recursion_depth > Py_GetRecursionLimit()) {
+ --tstate->recursion_depth;
+ PyErr_SetObject(PyExc_RuntimeError, PyExc_RecursionErrorInst);
+ return;
+ }
PyErr_NormalizeException(exc, val, tb);
+ --tstate->recursion_depth;
}
Modified: python/branches/py3k/configure
==============================================================================
--- python/branches/py3k/configure (original)
+++ python/branches/py3k/configure Sat Sep 8 19:39:28 2007
@@ -12002,6 +12002,14 @@
cur_target=10.3
fi
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
+
+ # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
+ # environment with a value that is the same as what we'll use
+ # in the Makefile to ensure that we'll get the same compiler
+ # environment during configure and build time.
+ MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
+ export MACOSX_DEPLOYMENT_TARGET
+
EXPORT_MACOSX_DEPLOYMENT_TARGET=''
if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2
then
@@ -21442,6 +21450,77 @@
fi
+# also in 4.0
+{ echo "$as_me:$LINENO: checking for rl_completion_display_matches_hook in -lreadline" >&5
+echo $ECHO_N "checking for rl_completion_display_matches_hook in -lreadline... $ECHO_C" >&6; }
+if test "${ac_cv_lib_readline_rl_completion_display_matches_hook+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lreadline $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char rl_completion_display_matches_hook ();
+int
+main ()
+{
+return rl_completion_display_matches_hook ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_lib_readline_rl_completion_display_matches_hook=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_readline_rl_completion_display_matches_hook=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_readline_rl_completion_display_matches_hook" >&5
+echo "${ECHO_T}$ac_cv_lib_readline_rl_completion_display_matches_hook" >&6; }
+if test $ac_cv_lib_readline_rl_completion_display_matches_hook = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1
+_ACEOF
+
+fi
+
+
# check for readline 4.2
{ echo "$as_me:$LINENO: checking for rl_completion_matches in -lreadline" >&5
echo $ECHO_N "checking for rl_completion_matches in -lreadline... $ECHO_C" >&6; }
Modified: python/branches/py3k/configure.in
==============================================================================
--- python/branches/py3k/configure.in (original)
+++ python/branches/py3k/configure.in Sat Sep 8 19:39:28 2007
@@ -1480,6 +1480,14 @@
cur_target=10.3
fi
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
+
+ # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
+ # environment with a value that is the same as what we'll use
+ # in the Makefile to ensure that we'll get the same compiler
+ # environment during configure and build time.
+ MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
+ export MACOSX_DEPLOYMENT_TARGET
+
EXPORT_MACOSX_DEPLOYMENT_TARGET=''
if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2
then
@@ -3087,6 +3095,11 @@
AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
[Define if you have readline 4.0]), , )
+# also in 4.0
+AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
+ AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
+ [Define if you have readline 4.0]), , )
+
# check for readline 4.2
AC_CHECK_LIB(readline, rl_completion_matches,
AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
Modified: python/branches/py3k/pyconfig.h.in
==============================================================================
--- python/branches/py3k/pyconfig.h.in (original)
+++ python/branches/py3k/pyconfig.h.in Sat Sep 8 19:39:28 2007
@@ -429,6 +429,9 @@
/* Define if you have readline 2.2 */
#undef HAVE_RL_COMPLETION_APPEND_CHARACTER
+/* Define if you have readline 4.0 */
+#undef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK
+
/* Define if you have readline 4.2 */
#undef HAVE_RL_COMPLETION_MATCHES
More information about the Python-3000-checkins
mailing list