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

Skip to content

Commit 294b93d

Browse files
committed
merge
2 parents 5e4d372 + 778cba7 commit 294b93d

7 files changed

Lines changed: 20 additions & 16 deletions

File tree

Doc/extending/newtypes.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -962,19 +962,18 @@ done. This can be done using the :c:func:`PyErr_Fetch` and
962962

963963
if (self->my_callback != NULL) {
964964
PyObject *err_type, *err_value, *err_traceback;
965-
int have_error = PyErr_Occurred() ? 1 : 0;
966965

967-
if (have_error)
968-
PyErr_Fetch(&err_type, &err_value, &err_traceback);
966+
/* This saves the current exception state */
967+
PyErr_Fetch(&err_type, &err_value, &err_traceback);
969968

970969
cbresult = PyObject_CallObject(self->my_callback, NULL);
971970
if (cbresult == NULL)
972971
PyErr_WriteUnraisable(self->my_callback);
973972
else
974973
Py_DECREF(cbresult);
975974

976-
if (have_error)
977-
PyErr_Restore(err_type, err_value, err_traceback);
975+
/* This restores the saved exception state */
976+
PyErr_Restore(err_type, err_value, err_traceback);
978977

979978
Py_DECREF(self->my_callback);
980979
}

Doc/library/difflib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ It is also contained in the Python source distribution, as
752752
# we're passing these as arguments to the diff function
753753
fromdate = time.ctime(os.stat(fromfile).st_mtime)
754754
todate = time.ctime(os.stat(tofile).st_mtime)
755-
with open(fromlines) as fromf, open(tofile) as tof:
755+
with open(fromfile) as fromf, open(tofile) as tof:
756756
fromlines, tolines = list(fromf), list(tof)
757757

758758
if options.u:

Doc/library/email.iterators.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ The following function has been added as a useful debugging tool. It should
6868
text/plain
6969
text/plain
7070

71-
.. testcleanup::
71+
.. testsetup::
7272

7373
>>> somefile.close()
7474

Doc/library/email.policy.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ file on disk and pass it to the system ``sendmail`` program on a Unix system:
8585
>>> p.stdin.close()
8686
>>> rc = p.wait()
8787

88-
.. testcleanup::
88+
.. testsetup::
8989

9090
>>> mymsg.close()
9191
>>> mocker.stop()

Doc/library/unittest.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -897,12 +897,12 @@ Test cases
897897
Test that a warning is triggered when *callable* is called with any
898898
positional or keyword arguments that are also passed to
899899
:meth:`assertWarns`. The test passes if *warning* is triggered and
900-
fails if it isn't. Also, any unexpected exception is an error.
900+
fails if it isn't. Any exception is an error.
901901
To catch any of a group of warnings, a tuple containing the warning
902902
classes may be passed as *warnings*.
903903

904904
If only the *warning* and possibly the *msg* arguments are given,
905-
returns a context manager so that the code under test can be written
905+
return a context manager so that the code under test can be written
906906
inline rather than as a function::
907907

908908
with self.assertWarns(SomeWarning):
@@ -915,7 +915,7 @@ Test cases
915915
:attr:`warning` attribute, and the source line which triggered the
916916
warnings in the :attr:`filename` and :attr:`lineno` attributes.
917917
This can be useful if the intention is to perform additional checks
918-
on the exception raised::
918+
on the warning caught::
919919

920920
with self.assertWarns(SomeWarning) as cm:
921921
do_something()

Doc/tutorial/inputoutput.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,11 @@ first::
322322
>>> f.write(s)
323323
18
324324

325-
``f.tell()`` returns an integer giving the file object's current position in the
326-
file, measured in bytes from the beginning of the file. To change the file
327-
object's position, use ``f.seek(offset, from_what)``. The position is computed
325+
``f.tell()`` returns an integer giving the file object's current position in the file
326+
represented as number of bytes from the beginning of the file when in `binary mode` and
327+
an opaque number when in `text mode`.
328+
329+
To change the file object's position, use ``f.seek(offset, from_what)``. The position is computed
328330
from adding *offset* to a reference point; the reference point is selected by
329331
the *from_what* argument. A *from_what* value of 0 measures from the beginning
330332
of the file, 1 uses the current file position, and 2 uses the end of the file as
@@ -345,7 +347,10 @@ beginning of the file as the reference point. ::
345347

346348
In text files (those opened without a ``b`` in the mode string), only seeks
347349
relative to the beginning of the file are allowed (the exception being seeking
348-
to the very file end with ``seek(0, 2)``).
350+
to the very file end with ``seek(0, 2)``) and the only valid *offset* values are
351+
those returned from the ``f.tell()``, or zero. Any other *offset* value produces
352+
undefined behaviour.
353+
349354

350355
When you're done with a file, call ``f.close()`` to close it and free up any
351356
system resources taken up by the open file. After calling ``f.close()``,

Makefile.pre.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
10121012
tkinter/test/test_ttk site-packages test \
10131013
test/capath test/data \
10141014
test/cjkencodings test/decimaltestdata test/xmltestdata \
1015-
test/subprocessdata test/sndhdrdata \
1015+
test/subprocessdata test/sndhdrdata test/support \
10161016
test/tracedmodules test/encoded_modules \
10171017
test/namespace_pkgs \
10181018
test/namespace_pkgs/both_portions \

0 commit comments

Comments
 (0)