Skip to content

Commit b1b8724

Browse files
committed
Merge branch 'master' into fix-issue-12851
2 parents 408308f + a445feb commit b1b8724

42 files changed

Lines changed: 563 additions & 108 deletions

Some content is hidden

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

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ before_script:
9797
echo "Files changed: "
9898
echo $files_changed
9999
100-
if ! echo $files_changed | grep -qvE '(\.rst$)|(^Doc)|(^Misc)'
100+
if ! echo "$files_changed" | grep -qvE '(\.rst$)|(^Doc)|(^Misc)'
101101
then
102102
echo "Only docs were updated, stopping build process."
103103
exit

Doc/c-api/init.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ Initializing and finalizing the interpreter
273273
the last call to :c:func:`Py_Initialize`. Ideally, this frees all memory
274274
allocated by the Python interpreter. This is a no-op when called for a second
275275
time (without calling :c:func:`Py_Initialize` again first). Normally the
276-
return value is 0. If there were errors during finalization
277-
(flushing buffered data), -1 is returned.
276+
return value is ``0``. If there were errors during finalization
277+
(flushing buffered data), ``-1`` is returned.
278278
279279
This function is provided for a number of reasons. An embedding application
280280
might want to restart Python without having to restart the application itself.
@@ -1018,7 +1018,7 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
10181018
.. c:function:: PY_INT64_T PyInterpreterState_GetID(PyInterpreterState *interp)
10191019
10201020
Return the interpreter's unique ID. If there was any error in doing
1021-
so then -1 is returned and an error is set.
1021+
so then ``-1`` is returned and an error is set.
10221022
10231023
.. versionadded:: 3.7
10241024

Doc/c-api/long.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
137137
Raise :exc:`OverflowError` if the value of *obj* is out of range for a
138138
:c:type:`long`.
139139
140-
Returns -1 on error. Use :c:func:`PyErr_Occurred` to disambiguate.
140+
Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate.
141141
142142
143143
.. c:function:: long PyLong_AsLongAndOverflow(PyObject *obj, int *overflow)
@@ -151,7 +151,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
151151
return ``-1``; otherwise, set *\*overflow* to ``0``. If any other exception
152152
occurs set *\*overflow* to ``0`` and return ``-1`` as usual.
153153
154-
Returns -1 on error. Use :c:func:`PyErr_Occurred` to disambiguate.
154+
Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate.
155155
156156
157157
.. c:function:: long long PyLong_AsLongLong(PyObject *obj)
@@ -166,7 +166,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
166166
Raise :exc:`OverflowError` if the value of *obj* is out of range for a
167167
:c:type:`long`.
168168
169-
Returns -1 on error. Use :c:func:`PyErr_Occurred` to disambiguate.
169+
Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate.
170170
171171
172172
.. c:function:: long long PyLong_AsLongLongAndOverflow(PyObject *obj, int *overflow)
@@ -180,7 +180,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
180180
and return ``-1``; otherwise, set *\*overflow* to ``0``. If any other
181181
exception occurs set *\*overflow* to ``0`` and return ``-1`` as usual.
182182
183-
Returns -1 on error. Use :c:func:`PyErr_Occurred` to disambiguate.
183+
Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate.
184184
185185
.. versionadded:: 3.2
186186
@@ -197,7 +197,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
197197
Raise :exc:`OverflowError` if the value of *pylong* is out of range for a
198198
:c:type:`Py_ssize_t`.
199199
200-
Returns -1 on error. Use :c:func:`PyErr_Occurred` to disambiguate.
200+
Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate.
201201
202202
203203
.. c:function:: unsigned long PyLong_AsUnsignedLong(PyObject *pylong)
@@ -259,7 +259,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
259259
If the value of *obj* is out of range for an :c:type:`unsigned long`,
260260
return the reduction of that value modulo ``ULONG_MAX + 1``.
261261
262-
Returns -1 on error. Use :c:func:`PyErr_Occurred` to disambiguate.
262+
Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate.
263263
264264
265265
.. c:function:: unsigned long long PyLong_AsUnsignedLongLongMask(PyObject *obj)
@@ -271,7 +271,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
271271
If the value of *obj* is out of range for an :c:type:`unsigned long long`,
272272
return the reduction of that value modulo ``PY_ULLONG_MAX + 1``.
273273
274-
Returns -1 on error. Use :c:func:`PyErr_Occurred` to disambiguate.
274+
Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate.
275275
276276
277277
.. c:function:: double PyLong_AsDouble(PyObject *pylong)
@@ -282,7 +282,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
282282
Raise :exc:`OverflowError` if the value of *pylong* is out of range for a
283283
:c:type:`double`.
284284
285-
Returns -1.0 on error. Use :c:func:`PyErr_Occurred` to disambiguate.
285+
Returns ``-1.0`` on error. Use :c:func:`PyErr_Occurred` to disambiguate.
286286
287287
288288
.. c:function:: void* PyLong_AsVoidPtr(PyObject *pylong)
@@ -292,4 +292,4 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
292292
is only assured to produce a usable :c:type:`void` pointer for values created
293293
with :c:func:`PyLong_FromVoidPtr`.
294294
295-
Returns NULL on error. Use :c:func:`PyErr_Occurred` to disambiguate.
295+
Returns *NULL* on error. Use :c:func:`PyErr_Occurred` to disambiguate.

Doc/c-api/memory.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ tracemalloc C API
530530
531531
Track an allocated memory block in the :mod:`tracemalloc` module.
532532
533-
Return 0 on success, return ``-1`` on error (failed to allocate memory to
533+
Return ``0`` on success, return ``-1`` on error (failed to allocate memory to
534534
store the trace). Return ``-2`` if tracemalloc is disabled.
535535
536536
If memory block is already tracked, update the existing trace.

Doc/extending/newtypes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,8 @@ is used to initialize an object after it's created. Unlike the new method, we
384384
can't guarantee that the initializer is called. The initializer isn't called
385385
when unpickling objects and it can be overridden. Our initializer accepts
386386
arguments to provide initial values for our instance. Initializers always accept
387-
positional and keyword arguments. Initializers should return either 0 on
388-
success or -1 on error.
387+
positional and keyword arguments. Initializers should return either ``0`` on
388+
success or ``-1`` on error.
389389

390390
Initializers can be called multiple times. Anyone can call the :meth:`__init__`
391391
method on our objects. For this reason, we have to be extra careful when

Doc/faq/extending.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ How can I execute arbitrary Python statements from C?
6262

6363
The highest-level function to do this is :c:func:`PyRun_SimpleString` which takes
6464
a single string argument to be executed in the context of the module
65-
``__main__`` and returns 0 for success and -1 when an exception occurred
65+
``__main__`` and returns ``0`` for success and ``-1`` when an exception occurred
6666
(including ``SyntaxError``). If you want more control, use
6767
:c:func:`PyRun_String`; see the source for :c:func:`PyRun_SimpleString` in
6868
``Python/pythonrun.c``.

Doc/library/dbm.rst

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,23 @@ The module defines the following:
339339
dumbdbm database is created, files with :file:`.dat` and :file:`.dir` extensions
340340
are created.
341341

342-
The optional *flag* argument supports only the semantics of ``'c'``
343-
and ``'n'`` values. Other values will default to database being always
344-
opened for update, and will be created if it does not exist.
342+
The optional *flag* argument can be:
343+
344+
+---------+-------------------------------------------+
345+
| Value | Meaning |
346+
+=========+===========================================+
347+
| ``'r'`` | Open existing database for reading only |
348+
| | (default) |
349+
+---------+-------------------------------------------+
350+
| ``'w'`` | Open existing database for reading and |
351+
| | writing |
352+
+---------+-------------------------------------------+
353+
| ``'c'`` | Open database for reading and writing, |
354+
| | creating it if it doesn't exist |
355+
+---------+-------------------------------------------+
356+
| ``'n'`` | Always create a new, empty database, open |
357+
| | for reading and writing |
358+
+---------+-------------------------------------------+
345359

346360
The optional *mode* argument is the Unix mode of the file, used only when the
347361
database has to be created. It defaults to octal ``0o666`` (and will be modified
@@ -351,9 +365,10 @@ The module defines the following:
351365
:func:`.open` always creates a new database when the flag has the value
352366
``'n'``.
353367

354-
.. deprecated-removed:: 3.6 3.8
355-
Creating database in ``'r'`` and ``'w'`` modes. Modifying database in
356-
``'r'`` mode.
368+
.. versionchanged:: 3.8
369+
A database opened with flags ``'r'`` is now read-only. Opening with
370+
flags ``'r'`` and ``'w'`` no longer creates a database if it does not
371+
exist.
357372

358373
In addition to the methods provided by the
359374
:class:`collections.abc.MutableMapping` class, :class:`dumbdbm` objects

Doc/library/re.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,13 +468,13 @@ Most of the standard escapes supported by Python string literals are also
468468
accepted by the regular expression parser::
469469

470470
\a \b \f \n
471-
\r \t \u \U
472-
\v \x \\
471+
\N \r \t \u
472+
\U \v \x \\
473473

474474
(Note that ``\b`` is used to represent word boundaries, and means "backspace"
475475
only inside character classes.)
476476

477-
``'\u'`` and ``'\U'`` escape sequences are only recognized in Unicode
477+
``'\u'``, ``'\U'``, and ``'\N'`` escape sequences are only recognized in Unicode
478478
patterns. In bytes patterns they are errors.
479479

480480
Octal escapes are included in a limited form. If the first digit is a 0, or if
@@ -488,6 +488,9 @@ three digits in length.
488488
.. versionchanged:: 3.6
489489
Unknown escapes consisting of ``'\'`` and an ASCII letter now are errors.
490490

491+
.. versionchanged:: 3.8
492+
The ``'\N{name}'`` escape sequence has been added. As in string literals,
493+
it expands to the named Unicode character (e.g. ``'\N{EM DASH}'``).
491494

492495
.. seealso::
493496

Doc/library/subprocess.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,9 @@ calls these functions.
10871087
.. versionchanged:: 3.4
10881088
Support for the *input* keyword argument was added.
10891089

1090+
.. versionchanged:: 3.6
1091+
*encoding* and *errors* were added. See :func:`run` for details.
1092+
10901093
.. _subprocess-replacements:
10911094

10921095
Replacing Older Functions with the :mod:`subprocess` Module

Doc/library/tkinter.ttk.rst

Lines changed: 86 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ for improved styling effects.
6666
Ttk Widgets
6767
-----------
6868

69-
Ttk comes with 17 widgets, eleven of which already existed in tkinter:
69+
Ttk comes with 18 widgets, twelve of which already existed in tkinter:
7070
:class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`,
7171
:class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`,
72-
:class:`Radiobutton`, :class:`Scale` and :class:`Scrollbar`. The other six are
73-
new: :class:`Combobox`, :class:`Notebook`, :class:`Progressbar`,
74-
:class:`Separator`, :class:`Sizegrip` and :class:`Treeview`. And all them are
75-
subclasses of :class:`Widget`.
72+
:class:`Radiobutton`, :class:`Scale`, :class:`Scrollbar`, and :class:`Spinbox`.
73+
The other six are new: :class:`Combobox`, :class:`Notebook`,
74+
:class:`Progressbar`, :class:`Separator`, :class:`Sizegrip` and
75+
:class:`Treeview`. And all them are subclasses of :class:`Widget`.
7676

7777
Using the Ttk widgets gives the application an improved look and feel.
7878
As discussed above, there are differences in how the styling is coded.
@@ -381,6 +381,87 @@ ttk.Combobox
381381
Sets the value of the combobox to *value*.
382382

383383

384+
Spinbox
385+
-------
386+
The :class:`ttk.Spinbox` widget is a :class:`ttk.Entry` enhanced with increment
387+
and decrement arrows. It can be used for numbers or lists of string values.
388+
This widget is a subclass of :class:`Entry`.
389+
390+
Besides the methods inherited from :class:`Widget`: :meth:`Widget.cget`,
391+
:meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate`
392+
and :meth:`Widget.state`, and the following inherited from :class:`Entry`:
393+
:meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`,
394+
:meth:`Entry.index`, :meth:`Entry.insert`, :meth:`Entry.xview`,
395+
it has some other methods, described at :class:`ttk.Spinbox`.
396+
397+
Options
398+
^^^^^^^
399+
400+
This widget accepts the following specific options:
401+
402+
.. tabularcolumns:: |l|L|
403+
404+
+----------------------+------------------------------------------------------+
405+
| Option | Description |
406+
+======================+======================================================+
407+
| from | Float value. If set, this is the minimum value to |
408+
| | which the decrement button will decrement. Must be |
409+
| | spelled as ``from_`` when used as an argument, since |
410+
| | ``from`` is a Python keyword. |
411+
+----------------------+------------------------------------------------------+
412+
| to | Float value. If set, this is the maximum value to |
413+
| | which the increment button will increment. |
414+
+----------------------+------------------------------------------------------+
415+
| increment | Float value. Specifies the amount which the |
416+
| | increment/decrement buttons change the |
417+
| | value. Defaults to 1.0. |
418+
+----------------------+------------------------------------------------------+
419+
| values | Sequence of string or float values. If specified, |
420+
| | the increment/decrement buttons will cycle through |
421+
| | the items in this sequence rather than incrementing |
422+
| | or decrementing numbers. |
423+
| | |
424+
+----------------------+------------------------------------------------------+
425+
| wrap | Boolean value. If ``True``, increment and decrement |
426+
| | buttons will cycle from the ``to`` value to the |
427+
| | ``from`` value or the ``from`` value to the ``to`` |
428+
| | value, respectively. |
429+
+----------------------+------------------------------------------------------+
430+
| format | String value. This specifies the format of numbers |
431+
| | set by the increment/decrement buttons. It must be |
432+
| | in the form "%W.Pf", where W is the padded width of |
433+
| | the value, P is the precision, and '%' and 'f' are |
434+
| | literal. |
435+
+----------------------+------------------------------------------------------+
436+
| command | Python callable. Will be called with no arguments |
437+
| | whenever either of the increment or decrement buttons|
438+
| | are pressed. |
439+
| | |
440+
+----------------------+------------------------------------------------------+
441+
442+
443+
Virtual events
444+
^^^^^^^^^^^^^^
445+
446+
The spinbox widget generates an **<<Increment>>** virtual event when the
447+
user presses <Up>, and a **<<Decrement>>** virtual event when the user
448+
presses <Down>.
449+
450+
ttk.Spinbox
451+
^^^^^^^^^^^^
452+
453+
.. class:: Spinbox
454+
455+
.. method:: get()
456+
457+
Returns the current value of the spinbox.
458+
459+
460+
.. method:: set(value)
461+
462+
Sets the value of the spinbox to *value*.
463+
464+
384465
Notebook
385466
--------
386467

0 commit comments

Comments
 (0)