bpo-33441: Make the sigset_t converter available in other modules. (GH-6720)
* Expose the sigset_t converter via private API _Py_Sigset_Converter().
* Use Argument Clinic for parsing sigset_t in signalmodule.c.
* Raise ValueError instead OverflowError for integers out of
the C long range.
Ned Deily [Wed, 2 May 2018 05:30:33 +0000 (01:30 -0400)]
bpo-33290: Have macOS installer remove "pip" alias (GH-6683)
Currently, "pip3 install --upgrade pip" unconditionally installs a
"pip" alias even for Python 3. If a user has an existing Python 3.x
installed from a python.org macOS installer and then subsequently
manually updates to a new version of pip, there may now be a stray
"pip" alias in the Python 3.x framework bin directory which can cause
confusion if the user has both a Python 2.7 and 3.x installed;
if the Python 3.x fw bin directory appears early on $PATH, "pip"
might invoke the pip3 for the Python 3.x rather than the pip for
Python 2.7. To try to mitigate this, the macOS installer script
for the ensurepip option will unconditionally remove "pip" from
the 3.x framework bin directory being updated / installed. (The
ambiguity can be avoided by using "pythonx.y -m pip".)
Victor Stinner [Mon, 30 Apr 2018 10:22:17 +0000 (12:22 +0200)]
bpo-27645, sqlite: Fix integer overflow on sleep (#6594)
Use the _PyTime_t type and round away from zero (ROUND_UP,
_PyTime_ROUND_TIMEOUT) the sleep duration, when converting a Python
object to seconds and then to milliseconds. Raise an OverflowError in
case of overflow.
Previously the (int)double conversion rounded towards zero
(ROUND_DOWN).
Terry Jan Reedy [Mon, 30 Apr 2018 07:08:01 +0000 (03:08 -0400)]
bpo-21474: Update IDLE word/identifier definition from ascii to unicode. (GH-6643)
In text and entry boxes, this affects selection by double-click,
movement left/right by control-left/right, and deletion left/right
by control-BACKSPACE/DEL.
bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. (GH-6030)
METH_NOARGS functions need only a single argument but they are cast
into a PyCFunction, which takes two arguments. This triggers an
invalid function cast warning in gcc8 due to the argument mismatch.
Fix this by adding a dummy unused argument.
Brian Curtin [Thu, 26 Apr 2018 23:48:26 +0000 (19:48 -0400)]
Clarify the inspect.getmembers predicate parameter (#6615)
Previously, the predicate parameter was mentioned, but what it was to be
called with was not documented and required either trial-and-error or
looking into the source to find that it is called with the `value`, or
second item, of the full members list. This change addresses what the
predicate will receive, as well as does some light formatting to make
this clear.
Antoine Pitrou [Mon, 23 Apr 2018 18:53:33 +0000 (20:53 +0200)]
bpo-33329: Fix multiprocessing regression on newer glibcs (GH-6575)
Starting with glibc 2.27.9000-xxx, sigaddset() can return EINVAL for some
reserved signal numbers between 1 and NSIG. The `range(1, NSIG)` idiom
is commonly used to select all signals for blocking with `pthread_sigmask`.
So we ignore the sigaddset() return value until we expose sigfillset()
to provide a better idiom.
Gregory P. Smith [Fri, 20 Apr 2018 05:41:19 +0000 (22:41 -0700)]
bpo-33312: Fix clang ubsan out of bounds warnings in dict. (GH-6537)
Fix clang ubsan (undefined behavior sanitizer) warnings in dictobject.c by
adjusting how the internal struct _dictkeysobject shared keys structure is
declared.
This remains ABI compatible. We get rid of the union at the end of the
struct being used for conveinence to avoid typecasting in favor of char[]
variable length array at the end of a struct. This is known to clang to be
used for variable sized objects and will not cause an undefined behavior
problem. Similarly, char arrays do not have strict aliasing undefined
behavior when cast.
PEP-007 does not currently list variable length arrays (VLAs) as allowed
in our subset of C99. If this turns out to be a problem, the fix to this is
to change the char `dk_indices[]` into `dk_indices[1]` and restore the
three size computation subtractions this change removes:
`- Py_MEMBER_SIZE(PyDictKeysObject, dk_indices)`
If this works as is I'll make a separate PR to update PEP-007.
bpo-33295: Skip test using missing external site (GH-6504)
`test_urllib2net.OtherNetworkTests.test_sites_no_connection_close`
used `http://www.imdb.com/` but it is moved to https so the test is
not valid anymore. Skip test for the moment to allow CI to proceed.
Alex Gaynor [Sun, 15 Apr 2018 21:23:47 +0000 (17:23 -0400)]
Removed a confusing line from a docstring in http.cookies (GH-6482)
There's no reason a cookie should _ever_ contain pickled data. That's just asking for a critical security vulnerability. Back in Python2 there were helpers for doing that, but they're no more in Python3. Now coded_value is used when the value needs to be encoded for any reason.
Nick Coghlan [Sun, 15 Apr 2018 11:52:57 +0000 (21:52 +1000)]
bpo-33185: Fix regression in pydoc CLI sys.path handling (GH-6419)
The pydoc CLI assumed -m pydoc would add the empty string
to sys.path, and hence got confused when it switched to
adding the full initial working directory instead.
This refactors the pydoc CLI path manipulation to be
more testable, and ensures it won't accidentally
remove the standard library directory containing
pydoc itself from sys.path.
Mark Nemec [Tue, 10 Apr 2018 17:23:14 +0000 (18:23 +0100)]
bpo-33097: Fix submit accepting callable after executor shutdown by interpreter exit (GH-6144)
Executors in concurrent.futures accepted tasks after executor was shutdown by interpreter exit. Tasks were left in PENDING state forever. This fix changes submit to instead raise a RuntimeError.