Skip to content

Commit 8e0d255

Browse files
committed
Merge
2 parents 95c1c48 + 541b7c8 commit 8e0d255

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2414
-174
lines changed

Doc/library/shutil.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,30 @@ Directory and files operations
247247

248248
.. versionadded:: 3.3
249249

250+
.. function:: which(cmd, mode=os.F_OK | os.X_OK, path=None)
251+
252+
Return the path to an executable which would be run if the given *cmd*
253+
was called. If no *cmd* would be called, return ``None``.
254+
255+
*mode* is a permission mask passed a to :func:`os.access`, by default
256+
determining if the file exists and executable.
257+
258+
When no *path* is specified, the results of :func:`os.environ` are
259+
used, returning either the "PATH" value or a fallback of :attr:`os.defpath`.
260+
261+
On Windows, the current directory is always prepended to the *path*
262+
whether or not you use the default or provide your own, which
263+
is the behavior the command shell uses when finding executables.
264+
Additionaly, when finding the *cmd* in the *path*, the
265+
``PATHEXT`` environment variable is checked. For example, if you
266+
call ``shutil.which("python")``, :func:`which` will search
267+
``PATHEXT`` to know that it should look for ``python.exe`` within
268+
the *path* directories.
269+
270+
>>> print(shutil.which("python"))
271+
'c:\\python33\\python.exe'
272+
273+
.. versionadded:: 3.3
250274

251275
.. exception:: Error
252276

Doc/library/ssl.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,22 @@ Functions, Constants, and Exceptions
5959
.. versionchanged:: 3.3
6060
:exc:`SSLError` used to be a subtype of :exc:`socket.error`.
6161

62+
.. attribute:: library
63+
64+
A string mnemonic designating the OpenSSL submodule in which the error
65+
occurred, such as ``SSL``, ``PEM`` or ``X509``. The range of possible
66+
values depends on the OpenSSL version.
67+
68+
.. versionadded:: 3.3
69+
70+
.. attribute:: reason
71+
72+
A string mnemonic designating the reason this error occurred, for
73+
example ``CERTIFICATE_VERIFY_FAILED``. The range of possible
74+
values depends on the OpenSSL version.
75+
76+
.. versionadded:: 3.3
77+
6278
.. exception:: SSLZeroReturnError
6379

6480
A subclass of :exc:`SSLError` raised when trying to read or write and

Doc/library/sys.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,22 @@ always available.
106106
This function should be used for internal and specialized purposes only.
107107

108108

109+
.. function:: _debugmallocstats()
110+
111+
Print low-level information to stderr about the state of CPython's memory
112+
allocator.
113+
114+
If Python is configured --with-pydebug, it also performs some expensive
115+
internal consistency checks.
116+
117+
.. versionadded:: 3.3
118+
119+
.. impl-detail::
120+
121+
This function is specific to CPython. The exact output format is not
122+
defined here, and may change.
123+
124+
109125
.. data:: dllhandle
110126

111127
Integer specifying the handle of the Python DLL. Availability: Windows.

Doc/library/time.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ The module defines the following functions and data items:
545545
+-------+-------------------+---------------------------------+
546546
| N/A | :attr:`tm_zone` | abbreviation of timezone name |
547547
+-------+-------------------+---------------------------------+
548-
| N/A | :attr:`tm_gmtoff` | offset from UTC in seconds |
548+
| N/A | :attr:`tm_gmtoff` | offset east of UTC in seconds |
549549
+-------+-------------------+---------------------------------+
550550

551551
Note that unlike the C structure, the month value is a range of [1, 12], not

Include/dictobject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key);
111111
#ifndef Py_LIMITED_API
112112
int _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, PyObject *name, PyObject *value);
113113
PyObject *_PyDict_LoadGlobal(PyDictObject *, PyDictObject *, PyObject *);
114+
PyAPI_FUNC(void) _PyDict_DebugMallocStats(FILE *out);
114115
#endif
115116

116117
#ifdef __cplusplus

Include/floatobject.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le);
110110
/* free list api */
111111
PyAPI_FUNC(int) PyFloat_ClearFreeList(void);
112112

113+
PyAPI_FUNC(void) _PyFloat_DebugMallocStats(FILE* out);
114+
113115
/* Format the object based on the format_spec, as defined in PEP 3101
114116
(Advanced String Formatting). */
115117
PyAPI_FUNC(int) _PyFloat_FormatAdvancedWriter(

Include/frameobject.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);
7979

8080
PyAPI_FUNC(int) PyFrame_ClearFreeList(void);
8181

82+
PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out);
83+
8284
/* Return the line of code the frame is currently executing. */
8385
PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *);
8486

Include/listobject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);
6464
PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *);
6565

6666
PyAPI_FUNC(int) PyList_ClearFreeList(void);
67+
PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out);
6768
#endif
6869

6970
/* Macro, trading safety for speed */

Include/methodobject.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ typedef struct {
8282

8383
PyAPI_FUNC(int) PyCFunction_ClearFreeList(void);
8484

85+
#ifndef Py_LIMITED_API
86+
PyAPI_FUNC(void) _PyCFunction_DebugMallocStats(FILE *out);
87+
PyAPI_FUNC(void) _PyMethod_DebugMallocStats(FILE *out);
88+
#endif
89+
8590
#ifdef __cplusplus
8691
}
8792
#endif

Include/object.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,14 @@ PyAPI_DATA(PyObject *) _PyTrash_delete_later;
977977
else \
978978
_PyTrash_deposit_object((PyObject*)op);
979979

980+
#ifndef Py_LIMITED_API
981+
PyAPI_FUNC(void)
982+
_PyDebugAllocatorStats(FILE *out, const char *block_name, int num_blocks,
983+
size_t sizeof_block);
984+
PyAPI_FUNC(void)
985+
_PyObject_DebugTypeStats(FILE *out);
986+
#endif /* ifndef Py_LIMITED_API */
987+
980988
#ifdef __cplusplus
981989
}
982990
#endif

0 commit comments

Comments
 (0)