Skip to content

Commit a29bd63

Browse files
committed
Merge branch 'master' into pep539-tss-api
Resolve conflicts: aa0aa04 bpo-30832: Remove own implementation for thread-local storage (python#2537)
2 parents ab5f7ea + aa0aa04 commit a29bd63

File tree

130 files changed

+3063
-1972
lines changed

Some content is hidden

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

130 files changed

+3063
-1972
lines changed

.github/appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ branches:
88
build_script:
99
- cmd: PCbuild\build.bat -e
1010
test_script:
11-
- cmd: PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
11+
- cmd: PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 --fail-env-changed -j0
1212

1313
# Only trigger AppVeyor if actual code or its configuration changes
1414
only_commits:

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ before_script:
8989
fi
9090
9191
script:
92+
# Using the built Python as patchcheck.py is built around the idea of using
93+
# a checkout-build of CPython to know things like what base branch the changes
94+
# should be compared against.
95+
# Only run on Linux as the check only needs to be run once.
96+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./python Tools/scripts/patchcheck.py --travis $TRAVIS_PULL_REQUEST; fi
9297
# `-r -w` implicitly provided through `make buildbottest`.
9398
- make buildbottest TESTOPTS="-j4 -uall,-cpu,-tzdata"
9499

Doc/c-api/unicode.rst

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -934,16 +934,22 @@ wchar_t Support
934934
Convert the Unicode object to a wide character string. The output string
935935
always ends with a null character. If *size* is not *NULL*, write the number
936936
of wide characters (excluding the trailing null termination character) into
937-
*\*size*.
937+
*\*size*. Note that the resulting :c:type:`wchar_t` string might contain
938+
null characters, which would cause the string to be truncated when used with
939+
most C functions. If *size* is *NULL* and the :c:type:`wchar_t*` string
940+
contains null characters a :exc:`ValueError` is raised.
938941
939942
Returns a buffer allocated by :c:func:`PyMem_Alloc` (use
940-
:c:func:`PyMem_Free` to free it) on success. On error, returns *NULL*,
941-
*\*size* is undefined and raises a :exc:`MemoryError`. Note that the
942-
resulting :c:type:`wchar_t` string might contain null characters, which
943-
would cause the string to be truncated when used with most C functions.
943+
:c:func:`PyMem_Free` to free it) on success. On error, returns *NULL*
944+
and *\*size* is undefined. Raises a :exc:`MemoryError` if memory allocation
945+
is failed.
944946
945947
.. versionadded:: 3.2
946948
949+
.. versionchanged:: 3.7
950+
Raises a :exc:`ValueError` if *size* is *NULL* and the :c:type:`wchar_t*`
951+
string contains null characters.
952+
947953
948954
.. _builtincodecs:
949955

Doc/library/multiprocessing.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,16 @@ The :mod:`multiprocessing` package mostly replicates the API of the
598598
acquired a lock or semaphore etc. then terminating it is liable to
599599
cause other processes to deadlock.
600600

601+
.. method:: close()
602+
603+
Close the :class:`Process` object, releasing all resources associated
604+
with it. :exc:`ValueError` is raised if the underlying process
605+
is still running. Once :meth:`close` returns successfully, most
606+
other methods and attributes of the :class:`Process` object will
607+
raise :exc:`ValueError`.
608+
609+
.. versionadded:: 3.7
610+
601611
Note that the :meth:`start`, :meth:`join`, :meth:`is_alive`,
602612
:meth:`terminate` and :attr:`exitcode` methods should only be called by
603613
the process that created the process object.

Doc/tutorial/controlflow.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ Later we will see more functions that return iterables and take iterables as arg
157157
:keyword:`break` and :keyword:`continue` Statements, and :keyword:`else` Clauses on Loops
158158
=========================================================================================
159159

160-
The :keyword:`break` statement, like in C, breaks out of the smallest enclosing
160+
The :keyword:`break` statement, like in C, breaks out of the innermost enclosing
161161
:keyword:`for` or :keyword:`while` loop.
162162

163163
Loop statements may have an ``else`` clause; it is executed when the loop

Doc/whatsnew/3.7.rst

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ instead of spaces. (Contributed by Xiang Zhang in :issue:`30103`.)
151151
calendar
152152
--------
153153

154-
The :class:`~calendar.HTMLCalendar` has added new class attribute which ease the
155-
customisation the CSS classes in the produced HTML calendar.
154+
The class :class:`~calendar.HTMLCalendar` has new class attributes which ease
155+
the customisation of the CSS classes in the produced HTML calendar.
156156
(Contributed by Oz Tiram in :issue:`30095`.)
157157

158158
cgi
@@ -367,6 +367,25 @@ Changes in the C API
367367
:c:type:`unsigned long`.
368368
(Contributed by Serhiy Storchaka in :issue:`6532`.)
369369

370+
- :c:func:`PyUnicode_AsWideCharString` now raises a :exc:`ValueError` if the
371+
second argument is *NULL* and the :c:type:`wchar_t*` string contains null
372+
characters. (Contributed by Serhiy Storchaka in :issue:`30708`.)
373+
374+
375+
Windows Only
376+
------------
377+
- The python launcher, (py.exe), can accept 32 & 64 bit specifiers **without**
378+
having to specify a minor version as well. So ``py -3-32`` and ``py -3-64``
379+
become valid as well as ``py -3.7-32``, also the -*m*-64 and -*m.n*-64 forms
380+
are now accepted to force 64 bit python even if 32 bit would have otherwise
381+
been used. If the specified version is not available py.exe will error exit.
382+
(Contributed by Steve Barnes in :issue:`30291`.)
383+
384+
- The launcher can be run as "py -0" to produce a list of the installed pythons,
385+
*with default marked with an asterix*. Running "py -0p" will include the paths.
386+
If py is run with a version specifier that cannot be matched it will also print
387+
the *short form* list of available specifiers.
388+
(Contributed by Steve Barnes in :issue:`30362`.)
370389

371390
Removed
372391
=======
@@ -439,6 +458,10 @@ Changes in the Python API
439458
* The :attr:`struct.Struct.format` type is now :class:`str` instead of
440459
:class:`bytes`. (Contributed by Victor Stinner in :issue:`21071`.)
441460

461+
* Due to internal changes in :mod:`socket` you won't be able to
462+
:func:`socket.fromshare` a socket :func:`~socket.socket.share`-ed in older
463+
Python versions.
464+
442465

443466
CPython bytecode changes
444467
------------------------

Include/ceval.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf);
5454
#endif
5555

5656
PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg);
57+
PyAPI_FUNC(void) _PyEval_SignalReceived(void);
5758
PyAPI_FUNC(int) Py_MakePendingCalls(void);
5859

5960
/* Protection against deeply nested recursive calls

Include/unicodeobject.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -756,23 +756,27 @@ PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4(
756756
PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4Copy(PyObject *unicode);
757757
#endif
758758

759+
#ifndef Py_LIMITED_API
759760
/* Return a read-only pointer to the Unicode object's internal
760761
Py_UNICODE buffer.
761762
If the wchar_t/Py_UNICODE representation is not yet available, this
762763
function will calculate it. */
763764

764-
#ifndef Py_LIMITED_API
765765
PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
766766
PyObject *unicode /* Unicode object */
767767
) /* Py_DEPRECATED(3.3) */;
768-
#endif
768+
769+
/* Similar to PyUnicode_AsUnicode(), but raises a ValueError if the string
770+
contains null characters. */
771+
PyAPI_FUNC(const Py_UNICODE *) _PyUnicode_AsUnicode(
772+
PyObject *unicode /* Unicode object */
773+
);
769774

770775
/* Return a read-only pointer to the Unicode object's internal
771776
Py_UNICODE buffer and save the length at size.
772777
If the wchar_t/Py_UNICODE representation is not yet available, this
773778
function will calculate it. */
774779

775-
#ifndef Py_LIMITED_API
776780
PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicodeAndSize(
777781
PyObject *unicode, /* Unicode object */
778782
Py_ssize_t *size /* location where to save the length */

Lib/asyncio/coroutines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def coroutine(func):
197197
"""
198198
if _inspect_iscoroutinefunction(func):
199199
# In Python 3.5 that's all we need to do for coroutines
200-
# defiend with "async def".
200+
# defined with "async def".
201201
# Wrapping in CoroWrapper will happen via
202202
# 'sys.set_coroutine_wrapper' function.
203203
return func

Lib/asyncio/test_utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from . import tasks
3333
from .coroutines import coroutine
3434
from .log import logger
35+
from test import support
3536

3637

3738
if sys.platform == 'win32': # pragma: no cover
@@ -454,6 +455,7 @@ def unpatch_get_running_loop(self):
454455
def setUp(self):
455456
self._get_running_loop = events._get_running_loop
456457
events._get_running_loop = lambda: None
458+
self._thread_cleanup = support.threading_setup()
457459

458460
def tearDown(self):
459461
self.unpatch_get_running_loop()
@@ -464,6 +466,10 @@ def tearDown(self):
464466
# in an except block of a generator
465467
self.assertEqual(sys.exc_info(), (None, None, None))
466468

469+
self.doCleanups()
470+
support.threading_cleanup(*self._thread_cleanup)
471+
support.reap_children()
472+
467473

468474
@contextlib.contextmanager
469475
def disable_logger():

0 commit comments

Comments
 (0)