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 ........
This commit is contained in:
parent
4a625c33c1
commit
89d996e5c2
|
@ -707,7 +707,7 @@ consists of a type and a value, separated by a colon.
|
||||||
For example::
|
For example::
|
||||||
|
|
||||||
.. index::
|
.. index::
|
||||||
single: execution!context
|
single: execution; context
|
||||||
module: __main__
|
module: __main__
|
||||||
module: sys
|
module: sys
|
||||||
triple: module; search; path
|
triple: module; search; path
|
||||||
|
@ -720,8 +720,8 @@ The possible entry types are:
|
||||||
|
|
||||||
single
|
single
|
||||||
Creates a single index entry. Can be made a subentry by separating the
|
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
|
subentry text with a semicolon (this notation is also used below to describe
|
||||||
entries are created).
|
what entries are created).
|
||||||
pair
|
pair
|
||||||
``pair: loop; statement`` is a shortcut that creates two index entries,
|
``pair: loop; statement`` is a shortcut that creates two index entries,
|
||||||
namely ``loop; statement`` and ``statement; loop``.
|
namely ``loop; statement`` and ``statement; loop``.
|
||||||
|
@ -733,6 +733,13 @@ module, keyword, operator, object, exception, statement, builtin
|
||||||
These all create two index entries. For example, ``module: hashlib`` creates
|
These all create two index entries. For example, ``module: hashlib`` creates
|
||||||
the entries ``module; hashlib`` and ``hashlib; module``.
|
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
|
Grammar production displays
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
|
@ -186,12 +186,12 @@ functions which use :func:`lookup` for the codec lookup:
|
||||||
Implements the ``ignore`` error handling.
|
Implements the ``ignore`` error handling.
|
||||||
|
|
||||||
|
|
||||||
.. function:: xmlcharrefreplace_errors_errors(exception)
|
.. function:: xmlcharrefreplace_errors(exception)
|
||||||
|
|
||||||
Implements the ``xmlcharrefreplace`` error handling.
|
Implements the ``xmlcharrefreplace`` error handling.
|
||||||
|
|
||||||
|
|
||||||
.. function:: backslashreplace_errors_errors(exception)
|
.. function:: backslashreplace_errors(exception)
|
||||||
|
|
||||||
Implements the ``backslashreplace`` error handling.
|
Implements the ``backslashreplace`` error handling.
|
||||||
|
|
||||||
|
@ -833,7 +833,7 @@ Without external information it's impossible to reliably determine which
|
||||||
encoding was used for encoding a Unicode string. Each charmap encoding can
|
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
|
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
|
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
|
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
|
``"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
|
is written to the file, a UTF-8 encoded BOM (which looks like this as a byte
|
||||||
|
|
|
@ -54,6 +54,10 @@ file, socket, window, array, or any similar types. It does "copy" functions and
|
||||||
classes (shallow and deeply), by returning the original object unchanged; this
|
classes (shallow and deeply), by returning the original object unchanged; this
|
||||||
is compatible with the way these are treated by the :mod:`pickle` module.
|
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
|
.. index:: module: pickle
|
||||||
|
|
||||||
Classes can use the same interfaces to control copying that they use to control
|
Classes can use the same interfaces to control copying that they use to control
|
||||||
|
|
|
@ -247,6 +247,8 @@ Fundamental data types
|
||||||
+----------------------+--------------------------------+----------------------------+
|
+----------------------+--------------------------------+----------------------------+
|
||||||
| :class:`c_double` | ``double`` | float |
|
| :class:`c_double` | ``double`` | float |
|
||||||
+----------------------+--------------------------------+----------------------------+
|
+----------------------+--------------------------------+----------------------------+
|
||||||
|
| :class:`c_longdouble`| ``long double`` | float |
|
||||||
|
+----------------------+--------------------------------+----------------------------+
|
||||||
| :class:`c_char_p` | ``char *`` (NUL terminated) | string or ``None`` |
|
| :class:`c_char_p` | ``char *`` (NUL terminated) | string or ``None`` |
|
||||||
+----------------------+--------------------------------+----------------------------+
|
+----------------------+--------------------------------+----------------------------+
|
||||||
| :class:`c_wchar_p` | ``wchar_t *`` (NUL terminated) | unicode or ``None`` |
|
| :class:`c_wchar_p` | ``wchar_t *`` (NUL terminated) | unicode or ``None`` |
|
||||||
|
@ -2065,9 +2067,16 @@ These are the fundamental ctypes data types:
|
||||||
initializer.
|
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
|
.. 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.
|
initializer.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,9 @@
|
||||||
|
|
||||||
|
|
||||||
The :mod:`mutex` module defines a class that allows mutual-exclusion via
|
The :mod:`mutex` module defines a class that allows mutual-exclusion via
|
||||||
acquiring and releasing locks. It does not require (or imply) threading or
|
acquiring and releasing locks. It does not require (or imply)
|
||||||
multi-tasking, though it could be useful for those purposes.
|
:mod:`threading` or multi-tasking, though it could be useful for those
|
||||||
|
purposes.
|
||||||
|
|
||||||
The :mod:`mutex` module defines the following class:
|
The :mod:`mutex` module defines the following class:
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,11 @@
|
||||||
|
|
||||||
|
|
||||||
The :mod:`Queue` module implements a multi-producer, multi-consumer FIFO queue.
|
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
|
exchanged safely between multiple threads. The :class:`Queue` class in this
|
||||||
module implements all the required locking semantics. It depends on the
|
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:
|
The :mod:`Queue` module defines the following class and exception:
|
||||||
|
|
||||||
|
|
|
@ -546,6 +546,13 @@ form.
|
||||||
>>> re.split('\W+', 'Words, words, words.', 1)
|
>>> re.split('\W+', 'Words, words, words.', 1)
|
||||||
['Words', 'words, words.']
|
['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])
|
.. function:: findall(pattern, string[, flags])
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,12 @@ The :mod:`readline` module defines the following functions:
|
||||||
Get the completer function, or ``None`` if no completer function has been set.
|
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()
|
.. function:: get_begidx()
|
||||||
|
|
||||||
Get the beginning index of the readline tab-completion scope.
|
Get the beginning index of the readline tab-completion scope.
|
||||||
|
@ -147,6 +153,16 @@ The :mod:`readline` module defines the following functions:
|
||||||
|
|
||||||
Get the readline word delimiters for tab-completion.
|
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)
|
.. function:: add_history(line)
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
|
||||||
.. class:: LMTP([host[, port[, local_hostname]]])
|
.. class:: LMTP([host[, port[, local_hostname]]])
|
||||||
|
|
||||||
The LMTP protocol, which is very similar to ESMTP, is heavily based on the
|
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
|
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 '/'.
|
Unix socket, you must use an absolute path for *host*, starting with a '/'.
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ The module :mod:`socket` exports the following constants and functions:
|
||||||
.. function:: create_connection(address[, timeout])
|
.. function:: create_connection(address[, timeout])
|
||||||
|
|
||||||
Connects to the *address* received (as usual, a ``(host, port)`` pair), with an
|
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.
|
protocols, it is not normally used directly from application-level code.
|
||||||
Passing the optional *timeout* parameter will set the timeout on the socket
|
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
|
instance (if it is not given or ``None``, the global default timeout setting is
|
||||||
|
|
|
@ -170,6 +170,8 @@ use the first chain it finds in the file which matches.
|
||||||
Some "standard" root certificates are available at
|
Some "standard" root certificates are available at
|
||||||
http://www.thawte.com/roots/ (for Thawte roots) and
|
http://www.thawte.com/roots/ (for Thawte roots) and
|
||||||
http://www.verisign.com/support/roots.html (for Verisign roots).
|
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
|
sslsocket Objects
|
||||||
|
@ -239,23 +241,23 @@ sslsocket Objects
|
||||||
the certificate), ``notBefore`` (the time before which the certificate should not be trusted),
|
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.
|
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
|
The "subject" and "issuer" fields are tuples containing the name-value fields
|
||||||
in the certificate's data structure for each principal::
|
given in the certificate's data structure for each principal::
|
||||||
|
|
||||||
{'issuer': {'commonName': u'somemachine.python.org',
|
{'issuer': (('countryName', u'US'),
|
||||||
'countryName': u'US',
|
('stateOrProvinceName', u'Delaware'),
|
||||||
'localityName': u'Wilmington',
|
('localityName', u'Wilmington'),
|
||||||
'organizationName': u'Python Software Foundation',
|
('organizationName', u'Python Software Foundation'),
|
||||||
'organizationalUnitName': u'SSL',
|
('organizationalUnitName', u'SSL'),
|
||||||
'stateOrProvinceName': u'Delaware'},
|
('commonName', u'somemachine.python.org')),
|
||||||
'subject': {'commonName': u'somemachine.python.org',
|
'notAfter': 'Feb 16 16:54:50 2013 GMT',
|
||||||
'countryName': u'US',
|
'notBefore': 'Aug 27 16:54:50 2007 GMT',
|
||||||
'localityName': u'Wilmington',
|
'subject': (('countryName', u'US'),
|
||||||
'organizationName': u'Python Software Foundation',
|
('stateOrProvinceName', u'Delaware'),
|
||||||
'organizationalUnitName': u'SSL',
|
('localityName', u'Wilmington'),
|
||||||
'stateOrProvinceName': u'Delaware'},
|
('organizationName', u'Python Software Foundation'),
|
||||||
'notAfter': 'Sep 4 21:54:26 2007 GMT',
|
('organizationalUnitName', u'SSL'),
|
||||||
'notBefore': 'Aug 25 21:54:26 2007 GMT',
|
('commonName', u'somemachine.python.org')),
|
||||||
'version': 2}
|
'version': 2}
|
||||||
|
|
||||||
This certificate is said to be *self-signed*, because the subject
|
This certificate is said to be *self-signed*, because the subject
|
||||||
|
@ -311,27 +313,32 @@ sends some bytes, and reads part of the response::
|
||||||
# note that closing the sslsocket will also close the underlying socket
|
# note that closing the sslsocket will also close the underlying socket
|
||||||
ssl_sock.close()
|
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::
|
looked like this::
|
||||||
|
|
||||||
{'issuer': {'commonName': u'VeriSign Class 3 Extended Validation SSL SGC CA',
|
{'issuer': (('countryName', u'US'),
|
||||||
'countryName': u'US',
|
('organizationName', u'VeriSign, Inc.'),
|
||||||
'organizationName': u'VeriSign, Inc.',
|
('organizationalUnitName', u'VeriSign Trust Network'),
|
||||||
'organizationalUnitName': u'Terms of use at https://www.verisign.com/rpa (c)06'},
|
('organizationalUnitName',
|
||||||
'subject': {'1.3.6.1.4.1.311.60.2.1.2': u'Delaware',
|
u'Terms of use at https://www.verisign.com/rpa (c)06'),
|
||||||
'1.3.6.1.4.1.311.60.2.1.3': u'US',
|
('commonName',
|
||||||
'commonName': u'www.verisign.com',
|
u'VeriSign Class 3 Extended Validation SSL SGC CA')),
|
||||||
'countryName': u'US',
|
'notAfter': 'May 8 23:59:59 2009 GMT',
|
||||||
'localityName': u'Mountain View',
|
'notBefore': 'May 9 00:00:00 2007 GMT',
|
||||||
'organizationName': u'VeriSign, Inc.',
|
'subject': (('serialNumber', u'2497886'),
|
||||||
'organizationalUnitName': u'Terms of use at www.verisign.com/rpa (c)06',
|
('1.3.6.1.4.1.311.60.2.1.3', u'US'),
|
||||||
'postalCode': u'94043',
|
('1.3.6.1.4.1.311.60.2.1.2', u'Delaware'),
|
||||||
'serialNumber': u'2497886',
|
('countryName', u'US'),
|
||||||
'stateOrProvinceName': u'California',
|
('postalCode', u'94043'),
|
||||||
'streetAddress': u'487 East Middlefield Road'},
|
('stateOrProvinceName', u'California'),
|
||||||
'notAfter': 'May 8 23:59:59 2009 GMT',
|
('localityName', u'Mountain View'),
|
||||||
'notBefore': 'May 9 00:00:00 2007 GMT',
|
('streetAddress', u'487 East Middlefield Road'),
|
||||||
'version': 2}
|
('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
|
Server-side operation
|
||||||
^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -383,3 +390,5 @@ Class :class:`socket.socket`
|
||||||
`Introducing SSL and Certificates using OpenSSL <http://old.pseudonym.org/ssl/wwwj-index.html>`_, by Frederick J. Hirsch
|
`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
|
`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.
|
||||||
|
|
|
@ -13,9 +13,11 @@
|
||||||
single: semaphores, binary
|
single: semaphores, binary
|
||||||
|
|
||||||
This module provides low-level primitives for working with multiple threads
|
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
|
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::
|
.. index::
|
||||||
single: pthreads
|
single: pthreads
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
This module constructs higher-level threading interfaces on top of the lower
|
This module constructs higher-level threading interfaces on top of the lower
|
||||||
level :mod:`thread` module.
|
level :mod:`thread` module.
|
||||||
|
See also the :mod:`mutex` and :mod:`Queue` modules.
|
||||||
|
|
||||||
The :mod:`dummy_threading` module is provided for situations where
|
The :mod:`dummy_threading` module is provided for situations where
|
||||||
:mod:`threading` cannot be used because :mod:`thread` is missing.
|
:mod:`threading` cannot be used because :mod:`thread` is missing.
|
||||||
|
|
|
@ -73,6 +73,20 @@ Other Language Changes
|
||||||
|
|
||||||
Here are all of the changes that Python 2.6 makes to the core Python language.
|
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
|
* An obscure change: when you use the the :func:`locals` function inside a
|
||||||
:keyword:`class` statement, the resulting dictionary no longer returns free
|
:keyword:`class` statement, the resulting dictionary no longer returns free
|
||||||
variables. (Free variables, in this case, are variables referred to in the
|
variables. (Free variables, in this case, are variables referred to in the
|
||||||
|
@ -124,6 +138,11 @@ complete list of changes, or look through the CVS logs for all the details.
|
||||||
|
|
||||||
(Contributed by Fabian Kreutz.)
|
(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
|
* The :func:`glob.glob` function can now return Unicode filenames if
|
||||||
a Unicode path was used and Unicode filenames are matched within the directory.
|
a Unicode path was used and Unicode filenames are matched within the directory.
|
||||||
|
|
||||||
|
@ -157,6 +176,21 @@ complete list of changes, or look through the CVS logs for all the details.
|
||||||
|
|
||||||
.. % Patch #1490190
|
.. % 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`
|
* New functions in the :mod:`posix` module: :func:`chflags` and :func:`lchflags`
|
||||||
are wrappers for the corresponding system calls (where they're available).
|
are wrappers for the corresponding system calls (where they're available).
|
||||||
Constants for the flag values are defined in the :mod:`stat` module; some
|
Constants for the flag values are defined in the :mod:`stat` module; some
|
||||||
|
@ -166,14 +200,41 @@ complete list of changes, or look through the CVS logs for all the details.
|
||||||
|
|
||||||
* The :mod:`rgbimg` module has been removed.
|
* The :mod:`rgbimg` module has been removed.
|
||||||
|
|
||||||
* The :mod:`smtplib` module now supports SMTP over SSL thanks to the addition
|
* The :mod:`smtplib` module now supports SMTP over SSL thanks to the
|
||||||
of the :class:`SMTP_SSL` class. This class supports an interface identical to
|
addition of the :class:`SMTP_SSL` class. This class supports an
|
||||||
the existing :class:`SMTP` class. (Contributed by Monty Taylor.)
|
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`
|
* The :mod:`test.test_support` module now contains a :func:`EnvironmentVarGuard`
|
||||||
context manager that supports temporarily changing environment variables and
|
context manager that supports temporarily changing environment variables and
|
||||||
automatically restores them to their old values. (Contributed by Brett Cannon.)
|
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
|
.. % whole new modules get described in \subsections here
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,7 @@ PyAPI_DATA(PyObject *) PyExc_VMSError;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PyAPI_DATA(PyObject *) PyExc_MemoryErrorInst;
|
PyAPI_DATA(PyObject *) PyExc_MemoryErrorInst;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_RecursionErrorInst;
|
||||||
|
|
||||||
/* Predefined warning categories */
|
/* Predefined warning categories */
|
||||||
PyAPI_DATA(PyObject *) PyExc_Warning;
|
PyAPI_DATA(PyObject *) PyExc_Warning;
|
||||||
|
|
|
@ -188,6 +188,11 @@ class c_double(_SimpleCData):
|
||||||
_type_ = "d"
|
_type_ = "d"
|
||||||
_check_size(c_double)
|
_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 _calcsize("l") == _calcsize("q"):
|
||||||
# if long and long long have the same size, make c_longlong an alias for c_long
|
# if long and long long have the same size, make c_longlong an alias for c_long
|
||||||
c_longlong = c_long
|
c_longlong = c_long
|
||||||
|
|
|
@ -4,7 +4,7 @@ from ctypes import *
|
||||||
formats = "bBhHiIlLqQfd"
|
formats = "bBhHiIlLqQfd"
|
||||||
|
|
||||||
formats = c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint, \
|
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):
|
class ArrayTestCase(unittest.TestCase):
|
||||||
def test_simple(self):
|
def test_simple(self):
|
||||||
|
|
|
@ -77,6 +77,10 @@ class Callbacks(unittest.TestCase):
|
||||||
self.check_type(c_double, 3.14)
|
self.check_type(c_double, 3.14)
|
||||||
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):
|
def test_char(self):
|
||||||
self.check_type(c_char, b"x")
|
self.check_type(c_char, b"x")
|
||||||
self.check_type(c_char, b"a")
|
self.check_type(c_char, b"a")
|
||||||
|
|
|
@ -158,6 +158,18 @@ class CFunctions(unittest.TestCase):
|
||||||
self.failUnlessEqual(self._dll.tf_bd(0, 42.), 14.)
|
self.failUnlessEqual(self._dll.tf_bd(0, 42.), 14.)
|
||||||
self.failUnlessEqual(self.S(), 42)
|
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 test_callwithresult(self):
|
||||||
def process_result(result):
|
def process_result(result):
|
||||||
return result * 2
|
return result * 2
|
||||||
|
|
|
@ -143,6 +143,18 @@ class FunctionTestCase(unittest.TestCase):
|
||||||
self.failUnlessEqual(result, -21)
|
self.failUnlessEqual(result, -21)
|
||||||
self.failUnlessEqual(type(result), float)
|
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):
|
def test_longlongresult(self):
|
||||||
try:
|
try:
|
||||||
c_longlong
|
c_longlong
|
||||||
|
|
|
@ -4,7 +4,7 @@ import unittest
|
||||||
subclasses = []
|
subclasses = []
|
||||||
for base in [c_byte, c_short, c_int, c_long, c_longlong,
|
for base in [c_byte, c_short, c_int, c_long, c_longlong,
|
||||||
c_ubyte, c_ushort, c_uint, c_ulong, c_ulonglong,
|
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):
|
class X(base):
|
||||||
pass
|
pass
|
||||||
subclasses.append(X)
|
subclasses.append(X)
|
||||||
|
|
|
@ -17,7 +17,8 @@ def newer (source, target):
|
||||||
Raise DistutilsFileError if 'source' does not exist.
|
Raise DistutilsFileError if 'source' does not exist.
|
||||||
"""
|
"""
|
||||||
if not os.path.exists(source):
|
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):
|
if not os.path.exists(target):
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@ import io
|
||||||
import mimetools
|
import mimetools
|
||||||
import socket
|
import socket
|
||||||
from urlparse import urlsplit
|
from urlparse import urlsplit
|
||||||
|
import warnings
|
||||||
|
|
||||||
__all__ = ["HTTPResponse", "HTTPConnection",
|
__all__ = ["HTTPResponse", "HTTPConnection",
|
||||||
"HTTPException", "NotConnected", "UnknownProtocol",
|
"HTTPException", "NotConnected", "UnknownProtocol",
|
||||||
|
@ -988,6 +989,9 @@ else:
|
||||||
|
|
||||||
|
|
||||||
def FakeSocket (sock, sslobj):
|
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
|
return sslobj
|
||||||
|
|
||||||
__all__.append("HTTPSConnection")
|
__all__.append("HTTPSConnection")
|
||||||
|
|
|
@ -1165,7 +1165,6 @@ else:
|
||||||
|
|
||||||
def readline(self):
|
def readline(self):
|
||||||
"""Read line from remote."""
|
"""Read line from remote."""
|
||||||
# NB: socket.ssl needs a "readline" method, or perhaps a "makefile" method.
|
|
||||||
line = []
|
line = []
|
||||||
while 1:
|
while 1:
|
||||||
char = self.sslobj.read(1)
|
char = self.sslobj.read(1)
|
||||||
|
@ -1175,7 +1174,6 @@ else:
|
||||||
|
|
||||||
def send(self, data):
|
def send(self, data):
|
||||||
"""Send data to remote."""
|
"""Send data to remote."""
|
||||||
# NB: socket.ssl needs a "sendall" method to match socket objects.
|
|
||||||
bytes = len(data)
|
bytes = len(data)
|
||||||
while bytes > 0:
|
while bytes > 0:
|
||||||
sent = self.sslobj.write(data)
|
sent = self.sslobj.write(data)
|
||||||
|
@ -1201,7 +1199,7 @@ else:
|
||||||
def ssl(self):
|
def ssl(self):
|
||||||
"""Return SSLObject instance used to communicate with the IMAP4 server.
|
"""Return SSLObject instance used to communicate with the IMAP4 server.
|
||||||
|
|
||||||
ssl = <instance>.socket.ssl()
|
ssl = ssl.sslsocket(<instance>.socket)
|
||||||
"""
|
"""
|
||||||
return self.sslobj
|
return self.sslobj
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,6 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
_have_ssl = False
|
_have_ssl = False
|
||||||
else:
|
else:
|
||||||
|
|
||||||
class SSLFakeFile:
|
class SSLFakeFile:
|
||||||
"""A fake file like object that really wraps a SSLObject.
|
"""A fake file like object that really wraps a SSLObject.
|
||||||
|
|
||||||
|
@ -722,9 +721,8 @@ if _have_ssl:
|
||||||
def _get_socket(self, host, port, timeout):
|
def _get_socket(self, host, port, timeout):
|
||||||
if self.debuglevel > 0: print('connect:', (host, port), file=stderr)
|
if self.debuglevel > 0: print('connect:', (host, port), file=stderr)
|
||||||
self.sock = socket.create_connection((host, port), timeout)
|
self.sock = socket.create_connection((host, port), timeout)
|
||||||
sslobj = socket.ssl(self.sock, self.keyfile, self.certfile)
|
self.sock = ssl.sslsocket(self.sock, self.keyfile, self.certfile)
|
||||||
self.sock = SSLFakeSocket(self.sock, sslobj)
|
self.file = SSLFakeFile(self.sock)
|
||||||
self.file = SSLFakeFile(sslobj)
|
|
||||||
|
|
||||||
__all__.append("SMTP_SSL")
|
__all__.append("SMTP_SSL")
|
||||||
|
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -4,6 +4,7 @@ from test.test_support import verify, vereq, verbose, TestFailed, TESTFN
|
||||||
from test.test_support import get_original_stdout
|
from test.test_support import get_original_stdout
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import types
|
import types
|
||||||
|
import new
|
||||||
|
|
||||||
def veris(a, b):
|
def veris(a, b):
|
||||||
if a is not b:
|
if a is not b:
|
||||||
|
@ -1834,6 +1835,10 @@ def specials():
|
||||||
## unsafecmp(1, 1L)
|
## unsafecmp(1, 1L)
|
||||||
## unsafecmp(1L, 1)
|
## unsafecmp(1L, 1)
|
||||||
|
|
||||||
|
def recursions():
|
||||||
|
if verbose:
|
||||||
|
print("Testing recursion checks ...")
|
||||||
|
|
||||||
## class Letter(str):
|
## class Letter(str):
|
||||||
## def __new__(cls, letter):
|
## def __new__(cls, letter):
|
||||||
## if letter == 'EPS':
|
## if letter == 'EPS':
|
||||||
|
@ -1843,7 +1848,6 @@ def specials():
|
||||||
## if not self:
|
## if not self:
|
||||||
## return 'EPS'
|
## return 'EPS'
|
||||||
## return self
|
## return self
|
||||||
|
|
||||||
## # sys.stdout needs to be the original to trigger the recursion bug
|
## # sys.stdout needs to be the original to trigger the recursion bug
|
||||||
## import sys
|
## import sys
|
||||||
## test_stdout = sys.stdout
|
## test_stdout = sys.stdout
|
||||||
|
@ -1857,6 +1861,17 @@ def specials():
|
||||||
## raise TestFailed, "expected a RuntimeError for print recursion"
|
## raise TestFailed, "expected a RuntimeError for print recursion"
|
||||||
## sys.stdout = test_stdout
|
## 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():
|
def weakrefs():
|
||||||
if verbose: print("Testing weak references...")
|
if verbose: print("Testing weak references...")
|
||||||
import weakref
|
import weakref
|
||||||
|
@ -4153,6 +4168,7 @@ def test_main():
|
||||||
overloading()
|
overloading()
|
||||||
methods()
|
methods()
|
||||||
specials()
|
specials()
|
||||||
|
recursions()
|
||||||
weakrefs()
|
weakrefs()
|
||||||
properties()
|
properties()
|
||||||
supers()
|
supers()
|
||||||
|
|
|
@ -137,18 +137,15 @@ class ConnectedTests(unittest.TestCase):
|
||||||
cert = c2.getpeercert()
|
cert = c2.getpeercert()
|
||||||
if not cert:
|
if not cert:
|
||||||
raise test_support.TestFailed("Can't get peer certificate.")
|
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'):
|
if not cert.has_key('subject'):
|
||||||
raise test_support.TestFailed(
|
raise test_support.TestFailed(
|
||||||
"No subject field in certificate: %s." %
|
"No subject field in certificate: %s." %
|
||||||
pprint.pformat(cert))
|
pprint.pformat(cert))
|
||||||
if not (cert['subject'].has_key('organizationName')):
|
if not ('organizationName', 'Python Software Foundation') in cert['subject']:
|
||||||
raise test_support.TestFailed(
|
raise test_support.TestFailed(
|
||||||
"No 'organizationName' field in certificate subject: %s." %
|
"Missing or invalid 'organizationName' field in certificate subject; "
|
||||||
pprint.pformat(cert))
|
|
||||||
if (cert['subject']['organizationName'] !=
|
|
||||||
"Python Software Foundation"):
|
|
||||||
raise test_support.TestFailed(
|
|
||||||
"Invalid 'organizationName' field in certificate subject; "
|
|
||||||
"should be 'Python Software Foundation'.");
|
"should be 'Python Software Foundation'.");
|
||||||
c2.close()
|
c2.close()
|
||||||
|
|
||||||
|
@ -336,7 +333,7 @@ def create_cert_files(hostname=None):
|
||||||
|
|
||||||
def test_main(verbose=False):
|
def test_main(verbose=False):
|
||||||
if skip_expected:
|
if skip_expected:
|
||||||
raise test_support.TestSkipped("socket module has no ssl support")
|
raise test_support.TestSkipped("No SSL support")
|
||||||
|
|
||||||
global CERTFILE
|
global CERTFILE
|
||||||
CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir,
|
CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir,
|
||||||
|
|
|
@ -364,6 +364,12 @@ class TestUUID(TestCase):
|
||||||
self.assertEqual(node1, node2)
|
self.assertEqual(node1, node2)
|
||||||
|
|
||||||
def test_uuid1(self):
|
def test_uuid1(self):
|
||||||
|
# uuid1 requires ctypes.
|
||||||
|
try:
|
||||||
|
import ctypes
|
||||||
|
except ImportError:
|
||||||
|
return
|
||||||
|
|
||||||
equal = self.assertEqual
|
equal = self.assertEqual
|
||||||
|
|
||||||
# Make sure uuid1() generates UUIDs that are actually version 1.
|
# Make sure uuid1() generates UUIDs that are actually version 1.
|
||||||
|
@ -417,6 +423,12 @@ class TestUUID(TestCase):
|
||||||
equal(str(u), v)
|
equal(str(u), v)
|
||||||
|
|
||||||
def test_uuid4(self):
|
def test_uuid4(self):
|
||||||
|
# uuid4 requires ctypes.
|
||||||
|
try:
|
||||||
|
import ctypes
|
||||||
|
except ImportError:
|
||||||
|
return
|
||||||
|
|
||||||
equal = self.assertEqual
|
equal = self.assertEqual
|
||||||
|
|
||||||
# Make sure uuid4() generates UUIDs that are actually version 4.
|
# Make sure uuid4() generates UUIDs that are actually version 4.
|
||||||
|
|
|
@ -61,7 +61,7 @@ CFLAGS= $(BASECFLAGS) $(OPT) $(EXTRA_CFLAGS)
|
||||||
# Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
|
# 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
|
# be able to build extension modules using the directories specified in the
|
||||||
# environment variables
|
# environment variables
|
||||||
CPPFLAGS= -I. -I$(srcdir)/Include @CPPFLAGS@
|
CPPFLAGS= -I. -IInclude -I$(srcdir)/Include @CPPFLAGS@
|
||||||
LDFLAGS= @LDFLAGS@
|
LDFLAGS= @LDFLAGS@
|
||||||
LDLAST= @LDLAST@
|
LDLAST= @LDLAST@
|
||||||
SGI_ABI= @SGI_ABI@
|
SGI_ABI= @SGI_ABI@
|
||||||
|
@ -473,6 +473,7 @@ Modules/python.o: $(srcdir)/Modules/python.c
|
||||||
|
|
||||||
|
|
||||||
$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
|
$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
|
||||||
|
-@ mkdir Include
|
||||||
-$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
|
-$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
|
||||||
|
|
||||||
$(PGEN): $(PGENOBJS)
|
$(PGEN): $(PGENOBJS)
|
||||||
|
@ -619,7 +620,11 @@ testuniversal: all platform
|
||||||
|
|
||||||
|
|
||||||
# Like testall, but with a single pass only
|
# Like testall, but with a single pass only
|
||||||
|
# run an optional script to include some information about the build environment
|
||||||
buildbottest: all platform
|
buildbottest: all platform
|
||||||
|
-@if which pybuildbot.identify >/dev/null 2>&1; then \
|
||||||
|
pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
|
||||||
|
fi
|
||||||
$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
|
$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
|
||||||
|
|
||||||
QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
|
QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
|
||||||
|
@ -673,7 +678,8 @@ bininstall: altbininstall
|
||||||
else true; \
|
else true; \
|
||||||
fi
|
fi
|
||||||
(cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
|
(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
|
# Install the interpreter with $(VERSION) affixed
|
||||||
# This goes into $(exec_prefix)
|
# This goes into $(exec_prefix)
|
||||||
|
|
|
@ -80,6 +80,7 @@ Jurjen Bos
|
||||||
Peter Bosch
|
Peter Bosch
|
||||||
Eric Bouck
|
Eric Bouck
|
||||||
Thierry Bousch
|
Thierry Bousch
|
||||||
|
Sebastian Boving
|
||||||
Monty Brandenberg
|
Monty Brandenberg
|
||||||
Georg Brandl
|
Georg Brandl
|
||||||
Terrence Brannon
|
Terrence Brannon
|
||||||
|
@ -320,6 +321,7 @@ Lars Immisch
|
||||||
Tony Ingraldi
|
Tony Ingraldi
|
||||||
John Interrante
|
John Interrante
|
||||||
Bob Ippolito
|
Bob Ippolito
|
||||||
|
Atsuo Ishimoto
|
||||||
Ben Jackson
|
Ben Jackson
|
||||||
Paul Jackson
|
Paul Jackson
|
||||||
David Jacobs
|
David Jacobs
|
||||||
|
|
|
@ -1104,7 +1104,7 @@ _type_ attribute.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *SIMPLE_TYPE_CHARS = "cbBhHiIlLdfuzZqQPXOvt";
|
static char *SIMPLE_TYPE_CHARS = "cbBhHiIlLdfuzZqQPXOvtD";
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
c_wchar_p_from_param(PyObject *type, PyObject *value)
|
c_wchar_p_from_param(PyObject *type, PyObject *value)
|
||||||
|
|
|
@ -12,6 +12,29 @@
|
||||||
|
|
||||||
/* some functions handy for testing */
|
/* 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, ...)
|
EXPORT(int)myprintf(char *fmt, ...)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
@ -77,6 +100,14 @@ EXPORT(double) _testfunc_d_bhilfd(signed char b, short h, int i, long l, float f
|
||||||
return (double)(b + h + i + l + f + d);
|
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)
|
EXPORT(char *) _testfunc_p_p(void *s)
|
||||||
{
|
{
|
||||||
return (char *)s;
|
return (char *)s;
|
||||||
|
@ -391,6 +422,7 @@ EXPORT(PY_LONG_LONG) tf_q(PY_LONG_LONG c) { S; return c/3; }
|
||||||
EXPORT(unsigned PY_LONG_LONG) tf_Q(unsigned PY_LONG_LONG c) { U; return c/3; }
|
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(float) tf_f(float c) { S; return c/3; }
|
||||||
EXPORT(double) tf_d(double 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
|
#ifdef MS_WIN32
|
||||||
EXPORT(signed char) __stdcall s_tf_b(signed char c) { S; return c/3; }
|
EXPORT(signed char) __stdcall s_tf_b(signed char c) { S; return c/3; }
|
||||||
|
@ -405,6 +437,7 @@ EXPORT(PY_LONG_LONG) __stdcall s_tf_q(PY_LONG_LONG c) { S; return c/3; }
|
||||||
EXPORT(unsigned PY_LONG_LONG) __stdcall s_tf_Q(unsigned PY_LONG_LONG c) { U; return c/3; }
|
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(float) __stdcall s_tf_f(float c) { S; return c/3; }
|
||||||
EXPORT(double) __stdcall s_tf_d(double 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
|
#endif
|
||||||
/*******/
|
/*******/
|
||||||
|
|
||||||
|
@ -420,6 +453,7 @@ EXPORT(PY_LONG_LONG) tf_bq(signed char x, PY_LONG_LONG c) { S; return c/3; }
|
||||||
EXPORT(unsigned PY_LONG_LONG) tf_bQ(signed char x, unsigned PY_LONG_LONG c) { U; return c/3; }
|
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(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(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; }
|
EXPORT(void) tv_i(int c) { S; return; }
|
||||||
|
|
||||||
#ifdef MS_WIN32
|
#ifdef MS_WIN32
|
||||||
|
@ -435,6 +469,7 @@ EXPORT(PY_LONG_LONG) __stdcall s_tf_bq(signed char x, PY_LONG_LONG c) { S; retur
|
||||||
EXPORT(unsigned PY_LONG_LONG) __stdcall s_tf_bQ(signed char x, unsigned PY_LONG_LONG c) { U; return c/3; }
|
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(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(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; }
|
EXPORT(void) __stdcall s_tv_i(int c) { S; return; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -444,6 +444,7 @@ union result {
|
||||||
#ifdef HAVE_LONG_LONG
|
#ifdef HAVE_LONG_LONG
|
||||||
PY_LONG_LONG q;
|
PY_LONG_LONG q;
|
||||||
#endif
|
#endif
|
||||||
|
long double D;
|
||||||
double d;
|
double d;
|
||||||
float f;
|
float f;
|
||||||
void *p;
|
void *p;
|
||||||
|
|
|
@ -977,6 +977,29 @@ Q_get_sw(void *ptr, Py_ssize_t size)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
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 *
|
static PyObject *
|
||||||
d_set(void *ptr, PyObject *value, Py_ssize_t size)
|
d_set(void *ptr, PyObject *value, Py_ssize_t size)
|
||||||
|
@ -1591,6 +1614,7 @@ static struct fielddesc formattable[] = {
|
||||||
{ 'B', B_set, B_get, &ffi_type_uchar},
|
{ 'B', B_set, B_get, &ffi_type_uchar},
|
||||||
{ 'c', c_set, c_get, &ffi_type_schar},
|
{ '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_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},
|
{ '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_sshort, h_set_sw, h_get_sw},
|
||||||
{ 'H', H_set, H_get, &ffi_type_ushort, 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; int x; } s_int;
|
||||||
typedef struct { char c; long x; } s_long;
|
typedef struct { char c; long x; } s_long;
|
||||||
typedef struct { char c; float x; } s_float;
|
typedef struct { char c; float x; } s_float;
|
||||||
typedef struct { char c; double x; } s_double;
|
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; char *x; } s_char_p;
|
||||||
typedef struct { char c; void *x; } s_void_p;
|
typedef struct { char c; void *x; } s_void_p;
|
||||||
|
|
||||||
|
@ -1684,6 +1709,8 @@ typedef struct { char c; void *x; } s_void_p;
|
||||||
*/
|
*/
|
||||||
#define FLOAT_ALIGN (sizeof(s_float) - sizeof(float))
|
#define FLOAT_ALIGN (sizeof(s_float) - sizeof(float))
|
||||||
#define DOUBLE_ALIGN (sizeof(s_double) - sizeof(double))
|
#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 CHAR_P_ALIGN (sizeof(s_char_p) - sizeof(char*)) */
|
||||||
#define VOID_P_ALIGN (sizeof(s_void_p) - sizeof(void*))
|
#define VOID_P_ALIGN (sizeof(s_void_p) - sizeof(void*))
|
||||||
|
|
||||||
|
@ -1729,6 +1756,8 @@ ffi_type ffi_type_sint64 = { 8, LONG_LONG_ALIGN, FFI_TYPE_SINT64 };
|
||||||
|
|
||||||
ffi_type ffi_type_float = { sizeof(float), FLOAT_ALIGN, FFI_TYPE_FLOAT };
|
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_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 */
|
/* ffi_type ffi_type_longdouble */
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ union value {
|
||||||
#ifdef HAVE_LONG_LONG
|
#ifdef HAVE_LONG_LONG
|
||||||
PY_LONG_LONG ll;
|
PY_LONG_LONG ll;
|
||||||
#endif
|
#endif
|
||||||
|
long double D;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -283,6 +284,7 @@ struct tagPyCArgObject {
|
||||||
#ifdef HAVE_LONG_LONG
|
#ifdef HAVE_LONG_LONG
|
||||||
PY_LONG_LONG q;
|
PY_LONG_LONG q;
|
||||||
#endif
|
#endif
|
||||||
|
long double D;
|
||||||
double d;
|
double d;
|
||||||
float f;
|
float f;
|
||||||
void *p;
|
void *p;
|
||||||
|
|
|
@ -3533,7 +3533,7 @@ x86_64-*-linux* | x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) TARGET=X86_64; TAR
|
||||||
sh-*-linux* | sh[34]*-*-linux*) TARGET=SH; TARGETDIR=sh;;
|
sh-*-linux* | sh[34]*-*-linux*) TARGET=SH; TARGETDIR=sh;;
|
||||||
sh-*-rtems*) TARGET=SH; TARGETDIR=sh;;
|
sh-*-rtems*) TARGET=SH; TARGETDIR=sh;;
|
||||||
sh64-*-linux* | sh5*-*-linux*) TARGET=SH64; TARGETDIR=sh64;;
|
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
|
esac
|
||||||
|
|
||||||
if test $TARGETDIR = unknown; then
|
if test $TARGETDIR = unknown; then
|
||||||
|
|
|
@ -71,7 +71,7 @@ x86_64-*-linux* | x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) TARGET=X86_64; TAR
|
||||||
sh-*-linux* | sh[[34]]*-*-linux*) TARGET=SH; TARGETDIR=sh;;
|
sh-*-linux* | sh[[34]]*-*-linux*) TARGET=SH; TARGETDIR=sh;;
|
||||||
sh-*-rtems*) TARGET=SH; TARGETDIR=sh;;
|
sh-*-rtems*) TARGET=SH; TARGETDIR=sh;;
|
||||||
sh64-*-linux* | sh5*-*-linux*) TARGET=SH64; TARGETDIR=sh64;;
|
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
|
esac
|
||||||
|
|
||||||
if test $TARGETDIR = unknown; then
|
if test $TARGETDIR = unknown; then
|
||||||
|
|
|
@ -372,11 +372,20 @@ ptrace_enter_call(PyObject *self, void *key, PyObject *userObj)
|
||||||
ProfilerEntry *profEntry;
|
ProfilerEntry *profEntry;
|
||||||
ProfilerContext *pContext;
|
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);
|
profEntry = getEntry(pObj, key);
|
||||||
if (profEntry == NULL) {
|
if (profEntry == NULL) {
|
||||||
profEntry = newProfilerEntry(pObj, key, userObj);
|
profEntry = newProfilerEntry(pObj, key, userObj);
|
||||||
if (profEntry == NULL)
|
if (profEntry == NULL)
|
||||||
return;
|
goto restorePyerr;
|
||||||
}
|
}
|
||||||
/* grab a ProfilerContext out of the free list */
|
/* grab a ProfilerContext out of the free list */
|
||||||
pContext = pObj->freelistProfilerContext;
|
pContext = pObj->freelistProfilerContext;
|
||||||
|
@ -389,10 +398,13 @@ ptrace_enter_call(PyObject *self, void *key, PyObject *userObj)
|
||||||
malloc(sizeof(ProfilerContext));
|
malloc(sizeof(ProfilerContext));
|
||||||
if (pContext == NULL) {
|
if (pContext == NULL) {
|
||||||
pObj->flags |= POF_NOMEMORY;
|
pObj->flags |= POF_NOMEMORY;
|
||||||
return;
|
goto restorePyerr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initContext(pObj, pContext, profEntry);
|
initContext(pObj, pContext, profEntry);
|
||||||
|
|
||||||
|
restorePyerr:
|
||||||
|
PyErr_Restore(last_type, last_value, last_tb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -437,12 +437,15 @@ PySSL_issuer(PySSLObject *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
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;
|
int index_counter;
|
||||||
|
|
||||||
if (pd == NULL)
|
pt = PyTuple_New(entry_count);
|
||||||
|
if (pt == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (index_counter = 0;
|
for (index_counter = 0;
|
||||||
|
@ -480,18 +483,20 @@ _create_dict_for_X509_NAME (X509_NAME *xname)
|
||||||
Py_DECREF(name_obj);
|
Py_DECREF(name_obj);
|
||||||
goto fail0;
|
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(name_obj);
|
||||||
Py_DECREF(value_obj);
|
Py_DECREF(value_obj);
|
||||||
goto fail0;
|
goto fail0;
|
||||||
}
|
}
|
||||||
Py_DECREF(name_obj);
|
PyTuple_SET_ITEM(entry_tuple, 0, name_obj);
|
||||||
Py_DECREF(value_obj);
|
PyTuple_SET_ITEM(entry_tuple, 1, value_obj);
|
||||||
|
PyTuple_SET_ITEM(pt, index_counter, entry_tuple);
|
||||||
}
|
}
|
||||||
return pd;
|
return pt;
|
||||||
|
|
||||||
fail0:
|
fail0:
|
||||||
Py_XDECREF(pd);
|
Py_XDECREF(pt);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -520,7 +525,7 @@ PySSL_peercert(PySSLObject *self)
|
||||||
if ((verification & SSL_VERIFY_PEER) == 0)
|
if ((verification & SSL_VERIFY_PEER) == 0)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
peer = _create_dict_for_X509_NAME(
|
peer = _create_tuple_for_X509_NAME(
|
||||||
X509_get_subject_name(self->peer_cert));
|
X509_get_subject_name(self->peer_cert));
|
||||||
if (peer == NULL)
|
if (peer == NULL)
|
||||||
goto fail0;
|
goto fail0;
|
||||||
|
@ -530,7 +535,7 @@ PySSL_peercert(PySSLObject *self)
|
||||||
}
|
}
|
||||||
Py_DECREF(peer);
|
Py_DECREF(peer);
|
||||||
|
|
||||||
issuer = _create_dict_for_X509_NAME(
|
issuer = _create_tuple_for_X509_NAME(
|
||||||
X509_get_issuer_name(self->peer_cert));
|
X509_get_issuer_name(self->peer_cert));
|
||||||
if (issuer == NULL)
|
if (issuer == NULL)
|
||||||
goto fail0;
|
goto fail0;
|
||||||
|
|
|
@ -238,7 +238,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
|
||||||
no) SHAREDMODS="$SHAREDMODS $file";;
|
no) SHAREDMODS="$SHAREDMODS $file";;
|
||||||
esac
|
esac
|
||||||
rule="$file: $objs"
|
rule="$file: $objs"
|
||||||
rule="$rule; \$(LDSHARED) $objs $libs $ExtraLibs -o $file"
|
rule="$rule; \$(BLDSHARED) $objs $libs $ExtraLibs -o $file"
|
||||||
echo "$rule" >>$rulesf
|
echo "$rule" >>$rulesf
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
|
@ -6540,6 +6540,8 @@ typedef BOOL (WINAPI *CRYPTGENRANDOM)(HCRYPTPROV hProv, DWORD dwLen,\
|
||||||
BYTE *pbBuffer );
|
BYTE *pbBuffer );
|
||||||
|
|
||||||
static CRYPTGENRANDOM pCryptGenRandom = NULL;
|
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 HCRYPTPROV hCryptProv = 0;
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
|
|
|
@ -198,12 +198,27 @@ set_hook(const char *funcname, PyObject **hook_var, PyObject *args)
|
||||||
|
|
||||||
/* Exported functions to specify hook functions in Python */
|
/* Exported functions to specify hook functions in Python */
|
||||||
|
|
||||||
|
static PyObject *completion_display_matches_hook = NULL;
|
||||||
static PyObject *startup_hook = NULL;
|
static PyObject *startup_hook = NULL;
|
||||||
|
|
||||||
#ifdef HAVE_RL_PRE_INPUT_HOOK
|
#ifdef HAVE_RL_PRE_INPUT_HOOK
|
||||||
static PyObject *pre_input_hook = NULL;
|
static PyObject *pre_input_hook = NULL;
|
||||||
#endif
|
#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 *
|
static PyObject *
|
||||||
set_startup_hook(PyObject *self, PyObject *args)
|
set_startup_hook(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
|
@ -245,6 +260,18 @@ static PyObject *begidx = NULL;
|
||||||
static PyObject *endidx = NULL;
|
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 */
|
/* Get the beginning index for the scope of the tab-completion */
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -557,6 +584,8 @@ static struct PyMethodDef readline_methods[] =
|
||||||
METH_NOARGS, get_history_length_doc},
|
METH_NOARGS, get_history_length_doc},
|
||||||
{"set_completer", set_completer, METH_VARARGS, doc_set_completer},
|
{"set_completer", set_completer, METH_VARARGS, doc_set_completer},
|
||||||
{"get_completer", get_completer, METH_NOARGS, doc_get_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_begidx", get_begidx, METH_NOARGS, doc_get_begidx},
|
||||||
{"get_endidx", get_endidx, METH_NOARGS, doc_get_endidx},
|
{"get_endidx", get_endidx, METH_NOARGS, doc_get_endidx},
|
||||||
|
|
||||||
|
@ -568,6 +597,8 @@ static struct PyMethodDef readline_methods[] =
|
||||||
{"get_completer_delims", get_completer_delims,
|
{"get_completer_delims", get_completer_delims,
|
||||||
METH_NOARGS, doc_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,
|
{"set_startup_hook", set_startup_hook,
|
||||||
METH_VARARGS, doc_set_startup_hook},
|
METH_VARARGS, doc_set_startup_hook},
|
||||||
#ifdef HAVE_RL_PRE_INPUT_HOOK
|
#ifdef HAVE_RL_PRE_INPUT_HOOK
|
||||||
|
@ -631,6 +662,48 @@ on_pre_input_hook(void)
|
||||||
#endif
|
#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. */
|
/* C function to call the Python completer. */
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
@ -708,6 +781,10 @@ setup_readline(void)
|
||||||
rl_bind_key_in_map ('\t', rl_complete, emacs_meta_keymap);
|
rl_bind_key_in_map ('\t', rl_complete, emacs_meta_keymap);
|
||||||
rl_bind_key_in_map ('\033', rl_complete, emacs_meta_keymap);
|
rl_bind_key_in_map ('\033', rl_complete, emacs_meta_keymap);
|
||||||
/* Set our hook functions */
|
/* 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;
|
rl_startup_hook = (Function *)on_startup_hook;
|
||||||
#ifdef HAVE_RL_PRE_INPUT_HOOK
|
#ifdef HAVE_RL_PRE_INPUT_HOOK
|
||||||
rl_pre_input_hook = (Function *)on_pre_input_hook;
|
rl_pre_input_hook = (Function *)on_pre_input_hook;
|
||||||
|
|
|
@ -2047,7 +2047,11 @@ PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw)
|
||||||
ternaryfunc call;
|
ternaryfunc call;
|
||||||
|
|
||||||
if ((call = func->ob_type->tp_call) != NULL) {
|
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())
|
if (result == NULL && !PyErr_Occurred())
|
||||||
PyErr_SetString(
|
PyErr_SetString(
|
||||||
PyExc_SystemError,
|
PyExc_SystemError,
|
||||||
|
|
|
@ -1715,6 +1715,12 @@ SimpleExtendsException(PyExc_Warning, UnicodeWarning,
|
||||||
*/
|
*/
|
||||||
PyObject *PyExc_MemoryErrorInst=NULL;
|
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) \
|
#define PRE_INIT(TYPE) if (PyType_Ready(&_PyExc_ ## TYPE) < 0) \
|
||||||
Py_FatalError("exceptions bootstrapping error.");
|
Py_FatalError("exceptions bootstrapping error.");
|
||||||
|
|
||||||
|
@ -1867,6 +1873,29 @@ _PyExc_Init(void)
|
||||||
if (!PyExc_MemoryErrorInst)
|
if (!PyExc_MemoryErrorInst)
|
||||||
Py_FatalError("Cannot pre-allocate MemoryError instance\n");
|
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);
|
Py_DECREF(bltinmod);
|
||||||
|
|
||||||
#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
|
#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
|
||||||
|
|
|
@ -4647,16 +4647,7 @@ slot_tp_call(PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
if (meth == NULL)
|
if (meth == NULL)
|
||||||
return 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);
|
res = PyObject_Call(meth, args, kwds);
|
||||||
Py_LeaveRecursiveCall();
|
|
||||||
|
|
||||||
Py_DECREF(meth);
|
Py_DECREF(meth);
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -90,6 +90,13 @@ unicodedata
|
||||||
large tables of Unicode data
|
large tables of Unicode data
|
||||||
winsound
|
winsound
|
||||||
play sounds (typically .wav files) under Windows
|
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
|
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
|
wrap code Python doesn't control, and you'll need to download the base
|
||||||
|
|
|
@ -213,16 +213,24 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
|
||||||
err_ret->error = E_EOF;
|
err_ret->error = E_EOF;
|
||||||
err_ret->lineno = tok->lineno;
|
err_ret->lineno = tok->lineno;
|
||||||
if (tok->buf != NULL) {
|
if (tok->buf != NULL) {
|
||||||
|
char *text = NULL;
|
||||||
size_t len;
|
size_t len;
|
||||||
assert(tok->cur - tok->buf < INT_MAX);
|
assert(tok->cur - tok->buf < INT_MAX);
|
||||||
err_ret->offset = (int)(tok->cur - tok->buf);
|
err_ret->offset = (int)(tok->cur - tok->buf);
|
||||||
len = tok->inp - tok->buf;
|
len = tok->inp - tok->buf;
|
||||||
err_ret->text = (char *) PyObject_MALLOC(len + 1);
|
#ifdef Py_USING_UNICODE
|
||||||
if (err_ret->text != NULL) {
|
text = PyTokenizer_RestoreEncoding(tok, len, &err_ret->offset);
|
||||||
if (len > 0)
|
|
||||||
strncpy(err_ret->text, tok->buf, len);
|
#endif
|
||||||
err_ret->text[len] = '\0';
|
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) {
|
} else if (tok->encoding != NULL) {
|
||||||
node* r = PyNode_New(encoding_decl);
|
node* r = PyNode_New(encoding_decl);
|
||||||
|
|
|
@ -1536,6 +1536,68 @@ PyTokenizer_Get(struct tok_state *tok, char **p_start, char **p_end)
|
||||||
return result;
|
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
|
#ifdef Py_DEBUG
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -59,6 +59,8 @@ extern struct tok_state *PyTokenizer_FromFile(FILE *, char*,
|
||||||
char *, char *);
|
char *, char *);
|
||||||
extern void PyTokenizer_Free(struct tok_state *);
|
extern void PyTokenizer_Free(struct tok_state *);
|
||||||
extern int PyTokenizer_Get(struct tok_state *, char **, char **);
|
extern int PyTokenizer_Get(struct tok_state *, char **, char **);
|
||||||
|
extern char * PyTokenizer_RestoreEncoding(struct tok_state* tok,
|
||||||
|
int len, int *offset);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,6 +139,7 @@ PyErr_NormalizeException(PyObject **exc, PyObject **val, PyObject **tb)
|
||||||
PyObject *value = *val;
|
PyObject *value = *val;
|
||||||
PyObject *inclass = NULL;
|
PyObject *inclass = NULL;
|
||||||
PyObject *initial_tb = NULL;
|
PyObject *initial_tb = NULL;
|
||||||
|
PyThreadState *tstate = NULL;
|
||||||
|
|
||||||
if (type == NULL) {
|
if (type == NULL) {
|
||||||
/* There was no exception, so nothing to do. */
|
/* There was no exception, so nothing to do. */
|
||||||
|
@ -214,7 +215,14 @@ finally:
|
||||||
Py_DECREF(initial_tb);
|
Py_DECREF(initial_tb);
|
||||||
}
|
}
|
||||||
/* normalize recursively */
|
/* 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);
|
PyErr_NormalizeException(exc, val, tb);
|
||||||
|
--tstate->recursion_depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12002,6 +12002,14 @@ then
|
||||||
cur_target=10.3
|
cur_target=10.3
|
||||||
fi
|
fi
|
||||||
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
|
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=''
|
EXPORT_MACOSX_DEPLOYMENT_TARGET=''
|
||||||
if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2
|
if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2
|
||||||
then
|
then
|
||||||
|
@ -21442,6 +21450,77 @@ _ACEOF
|
||||||
fi
|
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
|
# check for readline 4.2
|
||||||
{ echo "$as_me:$LINENO: checking for rl_completion_matches in -lreadline" >&5
|
{ 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; }
|
echo $ECHO_N "checking for rl_completion_matches in -lreadline... $ECHO_C" >&6; }
|
||||||
|
|
13
configure.in
13
configure.in
|
@ -1480,6 +1480,14 @@ then
|
||||||
cur_target=10.3
|
cur_target=10.3
|
||||||
fi
|
fi
|
||||||
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
|
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=''
|
EXPORT_MACOSX_DEPLOYMENT_TARGET=''
|
||||||
if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2
|
if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2
|
||||||
then
|
then
|
||||||
|
@ -3087,6 +3095,11 @@ AC_CHECK_LIB(readline, rl_pre_input_hook,
|
||||||
AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
|
AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
|
||||||
[Define if you have readline 4.0]), , )
|
[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
|
# check for readline 4.2
|
||||||
AC_CHECK_LIB(readline, rl_completion_matches,
|
AC_CHECK_LIB(readline, rl_completion_matches,
|
||||||
AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
|
AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
|
||||||
|
|
|
@ -429,6 +429,9 @@
|
||||||
/* Define if you have readline 2.2 */
|
/* Define if you have readline 2.2 */
|
||||||
#undef HAVE_RL_COMPLETION_APPEND_CHARACTER
|
#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 */
|
/* Define if you have readline 4.2 */
|
||||||
#undef HAVE_RL_COMPLETION_MATCHES
|
#undef HAVE_RL_COMPLETION_MATCHES
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue