Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 5c21749

Browse files
author
Anselm Kruis
committed
merge branch 3.5
2 parents e50dea2 + cd881b8 commit 5c21749

Some content is hidden

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

74 files changed

+1138
-654
lines changed

Doc/c-api/conversion.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ The following functions provide locale-independent string to number conversions.
119119
.. versionadded:: 3.1
120120
121121
122-
.. c:function:: int PyOS_stricmp(char *s1, char *s2)
122+
.. c:function:: int PyOS_stricmp(const char *s1, const char *s2)
123123
124124
Case insensitive comparison of strings. The function works almost
125125
identically to :c:func:`strcmp` except that it ignores the case.
126126
127127
128-
.. c:function:: int PyOS_strnicmp(char *s1, char *s2, Py_ssize_t size)
128+
.. c:function:: int PyOS_strnicmp(const char *s1, const char *s2, Py_ssize_t size)
129129
130130
Case insensitive comparison of strings. The function works almost
131131
identically to :c:func:`strncmp` except that it ignores the case.

Doc/c-api/exceptions.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,15 @@ NULL pointer for use in a ``return`` statement.
244244
.. versionadded:: 3.4
245245
246246
247-
.. c:function:: void PyErr_SyntaxLocationEx(char *filename, int lineno, int col_offset)
247+
.. c:function:: void PyErr_SyntaxLocationEx(const char *filename, int lineno, int col_offset)
248248
249249
Like :c:func:`PyErr_SyntaxLocationObject`, but *filename* is a byte string
250250
decoded from the filesystem encoding (:func:`os.fsdecode`).
251251
252252
.. versionadded:: 3.2
253253
254254
255-
.. c:function:: void PyErr_SyntaxLocation(char *filename, int lineno)
255+
.. c:function:: void PyErr_SyntaxLocation(const char *filename, int lineno)
256256
257257
Like :c:func:`PyErr_SyntaxLocationEx`, but the col_offset parameter is
258258
omitted.
@@ -516,7 +516,7 @@ Signal Handling
516516
Exception Classes
517517
=================
518518
519-
.. c:function:: PyObject* PyErr_NewException(char *name, PyObject *base, PyObject *dict)
519+
.. c:function:: PyObject* PyErr_NewException(const char *name, PyObject *base, PyObject *dict)
520520
521521
This utility function creates and returns a new exception class. The *name*
522522
argument must be the name of the new exception, a C string of the form
@@ -531,7 +531,7 @@ Exception Classes
531531
argument can be used to specify a dictionary of class variables and methods.
532532
533533
534-
.. c:function:: PyObject* PyErr_NewExceptionWithDoc(char *name, char *doc, PyObject *base, PyObject *dict)
534+
.. c:function:: PyObject* PyErr_NewExceptionWithDoc(const char *name, const char *doc, PyObject *base, PyObject *dict)
535535
536536
Same as :c:func:`PyErr_NewException`, except that the new exception class can
537537
easily be given a docstring: If *doc* is non-*NULL*, it will be used as the
@@ -674,7 +674,7 @@ level, both in the core and in extension modules. They are needed if the
674674
recursive code does not necessarily invoke Python code (which tracks its
675675
recursion depth automatically).
676676
677-
.. c:function:: int Py_EnterRecursiveCall(char *where)
677+
.. c:function:: int Py_EnterRecursiveCall(const char *where)
678678
679679
Marks a point where a recursive C-level call is about to be performed.
680680

Doc/c-api/import.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Importing Modules
3939
behaviour isn't needed anymore.
4040
4141
42-
.. c:function:: PyObject* PyImport_ImportModuleEx(char *name, PyObject *globals, PyObject *locals, PyObject *fromlist)
42+
.. c:function:: PyObject* PyImport_ImportModuleEx(const char *name, PyObject *globals, PyObject *locals, PyObject *fromlist)
4343
4444
.. index:: builtin: __import__
4545
@@ -70,7 +70,7 @@ Importing Modules
7070
.. versionadded:: 3.3
7171
7272
73-
.. c:function:: PyObject* PyImport_ImportModuleLevel(char *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level)
73+
.. c:function:: PyObject* PyImport_ImportModuleLevel(const char *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level)
7474
7575
Similar to :c:func:`PyImport_ImportModuleLevelObject`, but the name is an
7676
UTF-8 encoded string instead of a Unicode object.

Doc/c-api/init.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Process-wide parameters
8686
=======================
8787

8888

89-
.. c:function:: int Py_SetStandardStreamEncoding(char *encoding, char *errors)
89+
.. c:function:: int Py_SetStandardStreamEncoding(const char *encoding, const char *errors)
9090
9191
.. index::
9292
single: Py_Initialize()

Doc/c-api/mapping.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Mapping Protocol
3434
failure. This is equivalent to the Python statement ``del o[key]``.
3535
3636
37-
.. c:function:: int PyMapping_HasKeyString(PyObject *o, char *key)
37+
.. c:function:: int PyMapping_HasKeyString(PyObject *o, const char *key)
3838
3939
On success, return ``1`` if the mapping object has the key *key* and ``0``
4040
otherwise. This is equivalent to the Python expression ``key in o``.

Doc/c-api/marshal.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ written using these routines?
8888
:exc:`TypeError`) and returns *NULL*.
8989
9090
91-
.. c:function:: PyObject* PyMarshal_ReadObjectFromString(char *string, Py_ssize_t len)
91+
.. c:function:: PyObject* PyMarshal_ReadObjectFromString(const char *string, Py_ssize_t len)
9292
9393
Return a Python object from the data stream in a character buffer
9494
containing *len* bytes pointed to by *string*.

Doc/c-api/sys.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ These are utility functions that make functionality from the :mod:`sys` module
110110
accessible to C code. They all work with the current interpreter thread's
111111
:mod:`sys` module's dict, which is contained in the internal thread state structure.
112112
113-
.. c:function:: PyObject *PySys_GetObject(char *name)
113+
.. c:function:: PyObject *PySys_GetObject(const char *name)
114114
115115
Return the object *name* from the :mod:`sys` module or *NULL* if it does
116116
not exist, without setting an exception.
117117
118-
.. c:function:: int PySys_SetObject(char *name, PyObject *v)
118+
.. c:function:: int PySys_SetObject(const char *name, PyObject *v)
119119
120120
Set *name* in the :mod:`sys` module to *v* unless *v* is *NULL*, in which
121121
case *name* is deleted from the sys module. Returns ``0`` on success, ``-1``

Doc/c-api/unicode.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,7 @@ They all return *NULL* or ``-1`` if an exception occurs.
16351635
respectively.
16361636
16371637
1638-
.. c:function:: int PyUnicode_CompareWithASCIIString(PyObject *uni, char *string)
1638+
.. c:function:: int PyUnicode_CompareWithASCIIString(PyObject *uni, const char *string)
16391639
16401640
Compare a unicode object, *uni*, with *string* and return -1, 0, 1 for less
16411641
than, equal, and greater than, respectively. It is best to pass only

Doc/extending/extending.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ Extracting Parameters in Extension Functions
600600

601601
The :c:func:`PyArg_ParseTuple` function is declared as follows::
602602

603-
int PyArg_ParseTuple(PyObject *arg, char *format, ...);
603+
int PyArg_ParseTuple(PyObject *arg, const char *format, ...);
604604

605605
The *arg* argument must be a tuple object containing an argument list passed
606606
from Python to a C function. The *format* argument must be a format string,
@@ -693,7 +693,7 @@ Keyword Parameters for Extension Functions
693693
The :c:func:`PyArg_ParseTupleAndKeywords` function is declared as follows::
694694

695695
int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,
696-
char *format, char *kwlist[], ...);
696+
const char *format, char *kwlist[], ...);
697697

698698
The *arg* and *format* parameters are identical to those of the
699699
:c:func:`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of
@@ -770,7 +770,7 @@ Building Arbitrary Values
770770
This function is the counterpart to :c:func:`PyArg_ParseTuple`. It is declared
771771
as follows::
772772

773-
PyObject *Py_BuildValue(char *format, ...);
773+
PyObject *Py_BuildValue(const char *format, ...);
774774

775775
It recognizes a set of format units similar to the ones recognized by
776776
:c:func:`PyArg_ParseTuple`, but the arguments (which are input to the function,

Doc/faq/extending.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ call, a format string like that used with :c:func:`Py_BuildValue`, and the
115115
argument values::
116116

117117
PyObject *
118-
PyObject_CallMethod(PyObject *object, char *method_name,
119-
char *arg_format, ...);
118+
PyObject_CallMethod(PyObject *object, const char *method_name,
119+
const char *arg_format, ...);
120120

121121
This works for any object that has methods -- whether built-in or user-defined.
122122
You are responsible for eventually :c:func:`Py_DECREF`\ 'ing the return value.

Doc/library/csv.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ The :mod:`csv` module defines the following functions:
109109
spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])
110110

111111

112-
.. function:: register_dialect(name[, dialect], **fmtparams)
112+
.. function:: register_dialect(name[, dialect[, **fmtparams]])
113113

114114
Associate *dialect* with *name*. *name* must be a string. The
115115
dialect can be specified either by passing a sub-class of :class:`Dialect`, or

Doc/library/hmac.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
.. module:: hmac
55
:synopsis: Keyed-Hashing for Message Authentication (HMAC) implementation
6-
for Python.
76
.. moduleauthor:: Gerhard Häring <[email protected]>
87
.. sectionauthor:: Gerhard Häring <[email protected]>
98

Doc/library/profile.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ This will sort all the statistics by file name, and then print out statistics
172172
for only the class init methods (since they are spelled with ``__init__`` in
173173
them). As one final example, you could try::
174174

175-
p.sort_stats('time', 'cum').print_stats(.5, 'init')
175+
p.sort_stats('time', 'cumulative').print_stats(.5, 'init')
176176

177177
This line sorts statistics with a primary key of time, and a secondary key of
178178
cumulative time, and then prints out some of the statistics. To be specific, the

Doc/library/stdtypes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4155,6 +4155,10 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
41554155
Return a new view of the dictionary's values. See the
41564156
:ref:`documentation of view objects <dict-views>`.
41574157

4158+
Dictionaries compare equal if and only if they have the same ``(key,
4159+
value)`` pairs. Order comparisons ('<', '<=', '>=', '>') raise
4160+
:exc:`TypeError`.
4161+
41584162
.. seealso::
41594163
:class:`types.MappingProxyType` can be used to create a read-only view
41604164
of a :class:`dict`.

Doc/library/string.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -644,12 +644,14 @@ Instead of the normal ``%``\ -based substitutions, Templates support ``$``\
644644
* ``$$`` is an escape; it is replaced with a single ``$``.
645645

646646
* ``$identifier`` names a substitution placeholder matching a mapping key of
647-
``"identifier"``. By default, ``"identifier"`` must spell a Python
648-
identifier. The first non-identifier character after the ``$`` character
649-
terminates this placeholder specification.
650-
651-
* ``${identifier}`` is equivalent to ``$identifier``. It is required when valid
652-
identifier characters follow the placeholder but are not part of the
647+
``"identifier"``. By default, ``"identifier"`` is restricted to any
648+
case-insensitive ASCII alphanumeric string (including underscores) that
649+
starts with an underscore or ASCII letter. The first non-identifier
650+
character after the ``$`` character terminates this placeholder
651+
specification.
652+
653+
* ``${identifier}`` is equivalent to ``$identifier``. It is required when
654+
valid identifier characters follow the placeholder but are not part of the
653655
placeholder, such as ``"${noun}ification"``.
654656

655657
Any other appearance of ``$`` in the string will result in a :exc:`ValueError`

Doc/library/sys.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ always available.
585585

586586
.. note::
587587
This function has been added on a provisional basis (see :pep:`411`
588-
for details.) Use it only for debug purposes.
588+
for details.) Use it only for debugging purposes.
589589

590590

591591
.. data:: hash_info
@@ -1106,7 +1106,7 @@ always available.
11061106

11071107
.. note::
11081108
This function has been added on a provisional basis (see :pep:`411`
1109-
for details.) Use it only for debug purposes.
1109+
for details.) Use it only for debugging purposes.
11101110

11111111

11121112
.. data:: stdin

Doc/reference/expressions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ Comparison of objects of the same type depends on the type:
11171117

11181118
* Sets and frozensets define comparison operators to mean subset and superset
11191119
tests. Those relations do not define total orderings (the two sets ``{1,2}``
1120-
and {2,3} are not equal, nor subsets of one another, nor supersets of one
1120+
and ``{2,3}`` are not equal, nor subsets of one another, nor supersets of one
11211121
another). Accordingly, sets are not appropriate arguments for functions
11221122
which depend on total ordering. For example, :func:`min`, :func:`max`, and
11231123
:func:`sorted` produce undefined results given a list of sets as inputs.

Doc/tutorial/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ The :ref:`glossary` is also worth going through.
5353
classes.rst
5454
stdlib.rst
5555
stdlib2.rst
56+
venv.rst
5657
whatnow.rst
5758
interactive.rst
5859
floatingpoint.rst

Doc/tutorial/stdlib.rst

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,18 @@ The :mod:`random` module provides tools for making random selections::
140140
>>> random.randrange(6) # random integer chosen from range(6)
141141
4
142142

143+
The :mod:`statistics` module calculates basic statistical properties
144+
(the mean, median, variance, etc.) of numeric data::
145+
146+
>>> import statistics
147+
>>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]
148+
>>> statistics.mean(data)
149+
1.6071428571428572
150+
>>> statistics.median(data)
151+
1.25
152+
>>> statistics.variance(data)
153+
1.3720238095238095
154+
143155
The SciPy project <http://scipy.org> has many other modules for numerical
144156
computations.
145157

@@ -311,13 +323,18 @@ sophisticated and robust capabilities of its larger packages. For example:
311323
(including attachments) and for implementing internet encoding and header
312324
protocols.
313325

314-
* The :mod:`xml.dom` and :mod:`xml.sax` packages provide robust support for
315-
parsing this popular data interchange format. Likewise, the :mod:`csv` module
316-
supports direct reads and writes in a common database format. Together, these
317-
modules and packages greatly simplify data interchange between Python
318-
applications and other tools.
326+
* The :mod:`json` package provides robust support for parsing this
327+
popular data interchange format. The :mod:`csv` module supports
328+
direct reading and writing of files in Comma-Separated Value format,
329+
commonly supported by databases and spreadsheets. XML processing is
330+
supported by the :mod:`xml.etree.ElementTree`, :mod:`xml.dom` and
331+
:mod:`xml.sax` packages. Together, these modules and packages
332+
greatly simplify data interchange between Python applications and
333+
other tools.
334+
335+
* The :mod:`sqlite3` module is a wrapper for the SQLite database
336+
library, providing a persistent database that can be updated and
337+
accessed using slightly nonstandard SQL syntax.
319338

320339
* Internationalization is supported by a number of modules including
321340
:mod:`gettext`, :mod:`locale`, and the :mod:`codecs` package.
322-
323-

0 commit comments

Comments
 (0)