diff options
-rw-r--r-- | Doc/c-api/init.rst | 5 | ||||
-rw-r--r-- | Doc/library/email.message.rst | 7 | ||||
-rw-r--r-- | Doc/whatsnew/3.2.rst | 4 | ||||
-rw-r--r-- | Lib/email/message.py | 5 | ||||
-rw-r--r-- | Lib/test/test_subprocess.py | 21 | ||||
-rw-r--r-- | Modules/_ctypes/libffi/ChangeLog | 4 | ||||
-rw-r--r-- | Modules/_ctypes/libffi/src/dlmalloc.c | 4 | ||||
-rw-r--r-- | Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c | 2 | ||||
-rw-r--r-- | Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c | 2 | ||||
-rw-r--r-- | Modules/_posixsubprocess.c | 4 |
10 files changed, 41 insertions, 17 deletions
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst index 2641c8b..623bd7c 100644 --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -537,10 +537,11 @@ code, or when embedding the Python interpreter: operations such as ``PyEval_ReleaseThread(tstate)``. It is not needed before calling :c:func:`PyEval_SaveThread` or :c:func:`PyEval_RestoreThread`. - .. index:: single: Py_Initialize() - This is a no-op when called for a second time. + .. versionchanged:: 3.2 + This function cannot be called before :c:func:`Py_Initialize()` anymore. + .. index:: module: _thread .. note:: diff --git a/Doc/library/email.message.rst b/Doc/library/email.message.rst index 11984a5..ebe2d9c 100644 --- a/Doc/library/email.message.rst +++ b/Doc/library/email.message.rst @@ -46,15 +46,16 @@ Here are the methods of the :class:`Message` class: be generated or modified). Note that this method is provided as a convenience and may not always - format the message the way you want. For example, by default it mangles - lines that begin with ``From``. For more flexibility, instantiate a + format the message the way you want. For example, by default it does + not do the mangling of lines that begin with ``From`` that is + required by the unix mbox format. For more flexibility, instantiate a :class:`~email.generator.Generator` instance and use its :meth:`flatten` method directly. For example:: from io import StringIO from email.generator import Generator fp = StringIO() - g = Generator(fp, mangle_from_=False, maxheaderlen=60) + g = Generator(fp, mangle_from_=True, maxheaderlen=60) g.flatten(msg) text = fp.getvalue() diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst index 3829ce1..20ce228 100644 --- a/Doc/whatsnew/3.2.rst +++ b/Doc/whatsnew/3.2.rst @@ -2698,3 +2698,7 @@ require changes to your code: a new function, :func:`asyncore.handle_accepted`, was added to replace it. (Contributed by Giampaolo Rodola in :issue:`6706`.) + +* Due to the new :term:`GIL` implementation, :c:func:`PyEval_InitThreads()` + cannot be called before :c:func:`Py_Initialize()` anymore. + diff --git a/Lib/email/message.py b/Lib/email/message.py index b821bfd..2713bc5 100644 --- a/Lib/email/message.py +++ b/Lib/email/message.py @@ -157,8 +157,7 @@ class Message: header. This is a convenience method and may not generate the message exactly - as you intend because by default it mangles lines that begin with - "From ". For more flexibility, use the flatten() method of a + as you intend. For more flexibility, use the flatten() method of a Generator instance. """ from email.generator import Generator @@ -242,7 +241,7 @@ class Message: raise TypeError('Expected list, got %s' % type(self._payload)) payload = self._payload cte = self.get('content-transfer-encoding', '').lower() - # payload can be bytes here, (I wonder if that is actually a bug?) + # payload may be bytes here. if isinstance(payload, str): if _has_surrogates(payload): bpayload = payload.encode('ascii', 'surrogateescape') diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 73f44ad..3cc387b 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -3,6 +3,7 @@ from test import support import subprocess import sys import signal +import io import os import errno import tempfile @@ -1186,6 +1187,24 @@ class POSIXProcessTestCase(BaseTestCase): close_fds=False, pass_fds=(fd, ))) self.assertIn('overriding close_fds', str(context.warning)) + def test_stdout_stdin_are_single_inout_fd(self): + with io.open(os.devnull, "r+") as inout: + p = subprocess.Popen([sys.executable, "-c", "import sys; sys.exit(0)"], + stdout=inout, stdin=inout) + p.wait() + + def test_stdout_stderr_are_single_inout_fd(self): + with io.open(os.devnull, "r+") as inout: + p = subprocess.Popen([sys.executable, "-c", "import sys; sys.exit(0)"], + stdout=inout, stderr=inout) + p.wait() + + def test_stderr_stdin_are_single_inout_fd(self): + with io.open(os.devnull, "r+") as inout: + p = subprocess.Popen([sys.executable, "-c", "import sys; sys.exit(0)"], + stderr=inout, stdin=inout) + p.wait() + def test_wait_when_sigchild_ignored(self): # NOTE: sigchild_ignore.py may not be an effective test on all OSes. sigchild_ignore = support.findfile("sigchild_ignore.py", @@ -1473,4 +1492,4 @@ def test_main(): support.reap_children() if __name__ == "__main__": - test_main() + unittest.main() diff --git a/Modules/_ctypes/libffi/ChangeLog b/Modules/_ctypes/libffi/ChangeLog index 78853c4..00ba7ef 100644 --- a/Modules/_ctypes/libffi/ChangeLog +++ b/Modules/_ctypes/libffi/ChangeLog @@ -3084,7 +3084,7 @@ 2003-09-18 Kaz Kojima <kkojima@gcc.gnu.org> - * src/sh/ffi.c (ffi_prep_args): Take account into the alignment + * src/sh/ffi.c (ffi_prep_args): Take account into the alignement for the register size. (ffi_closure_helper_SYSV): Handle the structure return value address correctly. @@ -3344,7 +3344,7 @@ 2003-02-06 Andreas Tobler <a.tobler@schweiz.ch> * libffi/src/powerpc/darwin_closure.S: - Fix alignment bug, allocate 8 bytes for the result. + Fix alignement bug, allocate 8 bytes for the result. * libffi/src/powerpc/aix_closure.S: Likewise. * libffi/src/powerpc/ffi_darwin.c: diff --git a/Modules/_ctypes/libffi/src/dlmalloc.c b/Modules/_ctypes/libffi/src/dlmalloc.c index 72673a1..783c5c2 100644 --- a/Modules/_ctypes/libffi/src/dlmalloc.c +++ b/Modules/_ctypes/libffi/src/dlmalloc.c @@ -1326,7 +1326,7 @@ static void* win32direct_mmap(size_t size) { return (ptr != 0)? ptr: MFAIL; } -/* This function supports releasing coalesced segments */ +/* This function supports releasing coalesed segments */ static int win32munmap(void* ptr, size_t size) { MEMORY_BASIC_INFORMATION minfo; char* cptr = ptr; @@ -1362,7 +1362,7 @@ static int win32munmap(void* ptr, size_t size) { #define CALL_MORECORE(S) MFAIL #endif /* HAVE_MORECORE */ -/* mstate bit set if contiguous morecore disabled or failed */ +/* mstate bit set if continguous morecore disabled or failed */ #define USE_NONCONTIGUOUS_BIT (4U) /* segment bit set in create_mspace_with_base */ diff --git a/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c b/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c index 5e77720..d84f1c3 100644 --- a/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c +++ b/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c @@ -592,7 +592,7 @@ typedef struct aix_fd_struct { +---------------------------------------+ 160 | result area 8 | +---------------------------------------+ 168 - | alignment to the next multiple of 16 | + | alignement to the next multiple of 16 | SP current --> +---------------------------------------+ 176 <- parent frame | back chain to caller 4 | +---------------------------------------+ 180 diff --git a/Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c b/Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c index dba2184..8953d5f 100644 --- a/Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c +++ b/Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c @@ -650,7 +650,7 @@ ffi_call( +---------------------------------------+ 160 | result area 8 | +---------------------------------------+ 168 - | alignment to the next multiple of 16 | + | alignement to the next multiple of 16 | SP current --> +---------------------------------------+ 176 <- parent frame | back chain to caller 4 | +---------------------------------------+ 180 diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c index 0f85da9..bf10cbb 100644 --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -99,10 +99,10 @@ static void child_exec(char *const exec_array[], if (p2cread > 2) { POSIX_CALL(close(p2cread)); } - if (c2pwrite > 2) { + if (c2pwrite > 2 && c2pwrite != p2cread) { POSIX_CALL(close(c2pwrite)); } - if (errwrite != c2pwrite && errwrite > 2) { + if (errwrite != c2pwrite && errwrite != p2cread && errwrite > 2) { POSIX_CALL(close(errwrite)); } |