Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 16215c7

Browse files
committed
Merged revisions 78959,79170,79175,79177,79180,79183,79186,79193,79581 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k ................ r78959 | georg.brandl | 2010-03-14 11:56:14 +0100 (So, 14 Mär 2010) | 33 lines Merged revisions 78760,78771-78773,78802,78922,78952 via svnmerge from svn+ssh://[email protected]/python/trunk ........ r78760 | georg.brandl | 2010-03-07 16:23:59 +0100 (So, 07 Mär 2010) | 1 line #5341: more built-in vs builtin fixes. ........ r78771 | georg.brandl | 2010-03-07 21:58:31 +0100 (So, 07 Mär 2010) | 1 line #8085: The function is called PyObject_NewVar, not PyObject_VarNew. ........ r78772 | georg.brandl | 2010-03-07 22:12:28 +0100 (So, 07 Mär 2010) | 1 line #8039: document conditional expressions better, giving them their own section. ........ r78773 | georg.brandl | 2010-03-07 22:32:06 +0100 (So, 07 Mär 2010) | 1 line #8044: document Py_{Enter,Leave}RecursiveCall functions. ........ r78802 | georg.brandl | 2010-03-08 17:28:40 +0100 (Mo, 08 Mär 2010) | 1 line Fix typo. ........ r78922 | georg.brandl | 2010-03-13 14:41:58 +0100 (Sa, 13 Mär 2010) | 1 line Update for new download location. ........ r78952 | georg.brandl | 2010-03-14 10:55:08 +0100 (So, 14 Mär 2010) | 1 line #8137: add iso-8859-16 to the standard encodings table. ........ ................ r79170 | georg.brandl | 2010-03-21 10:02:59 +0100 (So, 21 Mär 2010) | 1 line Fix some issues found by Jacques Ducasse on the docs list. ................ r79175 | georg.brandl | 2010-03-21 10:10:32 +0100 (So, 21 Mär 2010) | 9 lines Merged revisions 79172 via svnmerge from svn+ssh://[email protected]/python/trunk ........ r79172 | georg.brandl | 2010-03-21 10:08:00 +0100 (So, 21 Mär 2010) | 1 line Add a paragraph about set displays. ........ ................ r79177 | georg.brandl | 2010-03-21 10:25:54 +0100 (So, 21 Mär 2010) | 1 line Need to use list(range()) to get a list. ................ r79180 | georg.brandl | 2010-03-21 10:50:49 +0100 (So, 21 Mär 2010) | 9 lines Merged revisions 79178 via svnmerge from svn+ssh://[email protected]/python/trunk ........ r79178 | georg.brandl | 2010-03-21 10:28:16 +0100 (So, 21 Mär 2010) | 1 line Clarify that for shell=True, the shell PID will be the child PID. ........ ................ r79183 | georg.brandl | 2010-03-21 10:52:24 +0100 (So, 21 Mär 2010) | 9 lines Merged revisions 79181 via svnmerge from svn+ssh://[email protected]/python/trunk ........ r79181 | georg.brandl | 2010-03-21 10:51:16 +0100 (So, 21 Mär 2010) | 1 line Update os.kill() emulation example for Windows to use ctypes. ........ ................ r79186 | georg.brandl | 2010-03-21 11:03:36 +0100 (So, 21 Mär 2010) | 13 lines Merged revisions 79184-79185 via svnmerge from svn+ssh://[email protected]/python/trunk ........ r79184 | georg.brandl | 2010-03-21 10:58:36 +0100 (So, 21 Mär 2010) | 1 line Update text for newest US DST regulation. The sample file already has the calculation right. ........ r79185 | georg.brandl | 2010-03-21 11:02:47 +0100 (So, 21 Mär 2010) | 1 line Include structmember.h correctly. ........ ................ r79193 | georg.brandl | 2010-03-21 12:53:50 +0100 (So, 21 Mär 2010) | 9 lines Merged revisions 79192 via svnmerge from svn+ssh://[email protected]/python/trunk ........ r79192 | georg.brandl | 2010-03-21 12:50:58 +0100 (So, 21 Mär 2010) | 1 line Remove leftover word. ........ ................ r79581 | georg.brandl | 2010-04-02 10:47:07 +0200 (Fr, 02 Apr 2010) | 1 line #8213: document behavior of -u on py3k better. ................
1 parent d6abb72 commit 16215c7

19 files changed

Lines changed: 155 additions & 99 deletions

Doc/c-api/exceptions.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,36 @@ Exception Objects
446446
This steals a reference to *ctx*.
447447

448448

449+
Recursion Control
450+
=================
451+
452+
These two functions provide a way to perform safe recursive calls at the C
453+
level, both in the core and in extension modules. They are needed if the
454+
recursive code does not necessarily invoke Python code (which tracks its
455+
recursion depth automatically).
456+
457+
.. cfunction:: int Py_EnterRecursiveCall(char *where)
458+
459+
Marks a point where a recursive C-level call is about to be performed.
460+
461+
If :const:`USE_STACKCHECK` is defined, this function checks if the the OS
462+
stack overflowed using :cfunc:`PyOS_CheckStack`. In this is the case, it
463+
sets a :exc:`MemoryError` and returns a nonzero value.
464+
465+
The function then checks if the recursion limit is reached. If this is the
466+
case, a :exc:`RuntimeError` is set and a nonzero value is returned.
467+
Otherwise, zero is returned.
468+
469+
*where* should be a string such as ``" in instance check"`` to be
470+
concatenated to the :exc:`RuntimeError` message caused by the recursion depth
471+
limit.
472+
473+
.. cfunction:: void Py_LeaveRecursiveCall()
474+
475+
Ends a :cfunc:`Py_EnterRecursiveCall`. Must be called once for each
476+
*successful* invocation of :cfunc:`Py_EnterRecursiveCall`.
477+
478+
449479
.. _standardexceptions:
450480

451481
Standard Exceptions

Doc/c-api/gcsupport.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ include the :const:`Py_TPFLAGS_HAVE_GC` and provide an implementation of the
2828
Constructors for container types must conform to two rules:
2929

3030
#. The memory for the object must be allocated using :cfunc:`PyObject_GC_New`
31-
or :cfunc:`PyObject_GC_VarNew`.
31+
or :cfunc:`PyObject_GC_NewVar`.
3232

3333
#. Once all the fields which may contain references to other containers are
3434
initialized, it must call :cfunc:`PyObject_GC_Track`.

Doc/c-api/typeobj.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ type objects) *must* have the :attr:`ob_size` field.
182182
instance; this is normally :cfunc:`PyObject_Del` if the instance was allocated
183183
using :cfunc:`PyObject_New` or :cfunc:`PyObject_VarNew`, or
184184
:cfunc:`PyObject_GC_Del` if the instance was allocated using
185-
:cfunc:`PyObject_GC_New` or :cfunc:`PyObject_GC_VarNew`.
185+
:cfunc:`PyObject_GC_New` or :cfunc:`PyObject_GC_NewVar`.
186186

187187
This field is inherited by subtypes.
188188

Doc/extending/newtypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ This version of the module has a number of changes.
236236

237237
We've added an extra include::
238238

239-
#include "structmember.h"
239+
#include <structmember.h>
240240

241241
This include provides declarations that we use to handle attributes, as
242242
described a bit later.

Doc/faq/windows.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,13 +445,15 @@ present, and ``getch()`` which gets one character without echoing it.
445445
How do I emulate os.kill() in Windows?
446446
--------------------------------------
447447

448-
Use win32api::
448+
To terminate a process, you can use ctypes::
449+
450+
import ctypes
449451

450452
def kill(pid):
451453
"""kill function for Win32"""
452-
import win32api
453-
handle = win32api.OpenProcess(1, 0, pid)
454-
return (0 != win32api.TerminateProcess(handle, 0))
454+
kernel32 = ctypes.windll.kernel32
455+
handle = kernel32.OpenProcess(1, 0, pid)
456+
return (0 != kernel32.TerminateProcess(handle, 0))
455457

456458

457459
Why does os.path.isdir() fail on NT shared directories?

Doc/library/codecs.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,11 +1063,13 @@ particular, the following variants typically exist:
10631063
+-----------------+--------------------------------+--------------------------------+
10641064
| iso8859_10 | iso-8859-10, latin6, L6 | Nordic languages |
10651065
+-----------------+--------------------------------+--------------------------------+
1066-
| iso8859_13 | iso-8859-13 | Baltic languages |
1066+
| iso8859_13 | iso-8859-13, latin7, L7 | Baltic languages |
10671067
+-----------------+--------------------------------+--------------------------------+
10681068
| iso8859_14 | iso-8859-14, latin8, L8 | Celtic languages |
10691069
+-----------------+--------------------------------+--------------------------------+
1070-
| iso8859_15 | iso-8859-15 | Western Europe |
1070+
| iso8859_15 | iso-8859-15, latin9, L9 | Western Europe |
1071+
+-----------------+--------------------------------+--------------------------------+
1072+
| iso8859_16 | iso-8859-16, latin10, L10 | South-Eastern Europe |
10711073
+-----------------+--------------------------------+--------------------------------+
10721074
| johab | cp1361, ms1361 | Korean |
10731075
+-----------------+--------------------------------+--------------------------------+

Doc/library/datetime.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,8 +1460,8 @@ Example :class:`tzinfo` classes:
14601460
Note that there are unavoidable subtleties twice per year in a :class:`tzinfo`
14611461
subclass accounting for both standard and daylight time, at the DST transition
14621462
points. For concreteness, consider US Eastern (UTC -0500), where EDT begins the
1463-
minute after 1:59 (EST) on the first Sunday in April, and ends the minute after
1464-
1:59 (EDT) on the last Sunday in October::
1463+
minute after 1:59 (EST) on the second Sunday in March, and ends the minute after
1464+
1:59 (EDT) on the first Sunday in November::
14651465

14661466
UTC 3:MM 4:MM 5:MM 6:MM 7:MM 8:MM
14671467
EST 22:MM 23:MM 0:MM 1:MM 2:MM 3:MM

Doc/library/doctest.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ example. Use ``+`` to enable the named behavior, or ``-`` to disable it.
633633

634634
For example, this test passes::
635635

636-
>>> print(range(20)) #doctest: +NORMALIZE_WHITESPACE
636+
>>> print(list(range(20))) #doctest: +NORMALIZE_WHITESPACE
637637
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
638638
10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
639639

@@ -642,28 +642,28 @@ two blanks before the single-digit list elements, and because the actual output
642642
is on a single line. This test also passes, and also requires a directive to do
643643
so::
644644

645-
>>> print(range(20)) # doctest: +ELLIPSIS
645+
>>> print(list(range(20))) # doctest: +ELLIPSIS
646646
[0, 1, ..., 18, 19]
647647

648648
Multiple directives can be used on a single physical line, separated by commas::
649649

650-
>>> print(range(20)) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
650+
>>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
651651
[0, 1, ..., 18, 19]
652652

653653
If multiple directive comments are used for a single example, then they are
654654
combined::
655655

656-
>>> print(range(20)) # doctest: +ELLIPSIS
657-
... # doctest: +NORMALIZE_WHITESPACE
656+
>>> print(list(range(20))) # doctest: +ELLIPSIS
657+
... # doctest: +NORMALIZE_WHITESPACE
658658
[0, 1, ..., 18, 19]
659659

660660
As the previous example shows, you can add ``...`` lines to your example
661661
containing only directives. This can be useful when an example is too long for
662662
a directive to comfortably fit on the same line::
663663

664-
>>> print(range(5) + range(10,20) + range(30,40) + range(50,60))
664+
>>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40)))
665665
... # doctest: +ELLIPSIS
666-
[0, ..., 4, 10, ..., 19, 30, ..., 39, 50, ..., 59]
666+
[0, ..., 4, 10, ..., 19, 30, ..., 39]
667667

668668
Note that since all options are disabled by default, and directives apply only
669669
to the example they appear in, enabling options (via ``+`` in a directive) is

Doc/library/stdtypes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,6 +1639,10 @@ The :class:`frozenset` type is immutable and :term:`hashable` --- its contents c
16391639
altered after it is created; it can therefore be used as a dictionary key or as
16401640
an element of another set.
16411641

1642+
Non-empty sets (not frozensets) can be created by placing a comma-separated list
1643+
of elements within braces, for example: ``{'jack', 'sjoerd'}``, in addition to the
1644+
:class:`set` constructor.
1645+
16421646
The constructors for both classes work the same:
16431647

16441648
.. class:: set([iterable])

Doc/library/subprocess.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,9 @@ The following attributes are also available:
396396

397397
The process ID of the child process.
398398

399+
Note that if you set the *shell* argument to ``True``, this is the process ID
400+
of the spawned shell.
401+
399402

400403
.. attribute:: Popen.returncode
401404

0 commit comments

Comments
 (0)