Commit Graph

106420 Commits

Author SHA1 Message Date
ananthan-123 f2ee21d858
bpo-39479:Add math.lcm() function: Least Common Multiple (#18547)
* Update math.rst

* Update math.rst

* updated whats new

* Update test_math.py

* Update mathmodule.c

* Update mathmodule.c.h

* Update ACKS

* 📜🤖 Added by blurb_it.

* Update 3.9.rst

* Update 2020-02-18-12-37-16.bpo-39479.j3UcCq.rst

* Update math.rst

* Update 2020-02-18-12-37-16.bpo-39479.j3UcCq.rst

* Update test_math.py

* Update ACKS

* Update mathmodule.c.h

* Update mathmodule.c

* Update mathmodule.c.h

* Update mathmodule.c.h

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2020-02-19 18:21:37 +00:00
Victor Stinner 4dee92b0ad
Revert "bpo-38691 Added a switch to ignore PYTHONCASEOK when -E or -I flags passed (#18314)" (GH-18553)
This reverts commit d83b6600b2.
2020-02-19 14:23:47 +01:00
ananthan-123 ab6423fe2d
bpo-39572: Document ’total’ flag of TypedDict (GH-18554) 2020-02-18 20:33:05 -08:00
Cheryl Sabella a4ba8a3983
Include subsections in TOC for PDF version of docs. (GH-9629) 2020-02-19 00:01:15 +01:00
Victor Stinner af5ee3ff61
bpo-39674: Revert "bpo-25988: Do not expose abstract collection classes in the collections module. (GH-10596)" (GH-18545)
This reverts commit ef092fe990.

Update collections __getattr__() and documentation to defer aliases
removal to Python 3.10.
2020-02-18 16:28:53 +01:00
Petr Viktorin 6e35da9763
bpo-37207: Use vectorcall for range() (GH-18464)
This continues the `range()` part of #13930. The complete pull request is stalled on discussions around dicts, but `range()` should not be controversial. (And I plan to open PRs for other parts if this is merged.)
On top of Mark's change, I unified `range_new` and `range_vectorcall`, which had a lot of duplicate code.


https://bugs.python.org/issue37207
2020-02-18 07:13:17 -08:00
Jeroen Demeyer 24bba8cf5b
bpo-36347: stop using RESTRICTED constants (GH-12684)
The constants `RESTRICTED` and `PY_WRITE_RESTRICTED` no longer have a meaning in Python 3. Therefore, CPython should not use them.

CC @matrixise 


https://bugs.python.org/issue36347
2020-02-18 05:14:46 -08:00
Hai Shi 5d38517aa1
bpo-1635741: Port _bz2 extension module to multiphase initialization(PEP 489) (GH-18050)
https://bugs.python.org/issue1635741
2020-02-18 03:17:38 -08:00
Kyle Meyer 8edfc47bae
bpo-39546: argparse: Honor allow_abbrev=False for specified prefix_chars (GH-18337)
When `allow_abbrev` was first added, disabling the abbreviation of
long options broke the grouping of short flags ([bpo-26967](https://bugs.python.org/issue26967)).  As a fix,
b1e4d1b603 (contained in v3.8) ignores `allow_abbrev=False` for a
given argument string if the string does _not_ start with "--"
(i.e. it doesn't look like a long option).

This fix, however, doesn't take into account that long options can
start with alternative characters specified via `prefix_chars`,
introducing a regression: `allow_abbrev=False` has no effect on long
options that start with an alternative prefix character.

The most minimal fix would be to replace the "starts with --" check
with a "starts with two prefix_chars characters".  But
`_get_option_tuples` already distinguishes between long and short
options, so let's instead piggyback off of that check by moving the
`allow_abbrev` condition into `_get_option_tuples`.





https://bugs.python.org/issue39546
2020-02-18 01:48:57 -08:00
Cheryl Sabella ffda25f6b8
bpo-39663: IDLE: Add additional tests for pyparse (GH-18536)
Test when find_good_parse_start should return 0.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-02-17 21:47:52 -05:00
Hai Shi 4c1b6a6f4f
bpo-1635741: Port _abc extension to multiphase initialization (PEP 489) (GH-18030) 2020-02-17 14:50:35 +01:00
Hai Shi 7d7956833c
bpo-1635741: Port _contextvars module to multiphase initialization (PEP 489) (GH-18374) 2020-02-17 14:49:26 +01:00
Hai Shi 3d235f5c5c
bpo-39500: Fix compile warnings in unicodeobject.c (GH-18519) 2020-02-17 14:41:15 +01:00
Dong-hee Na 1b55b65638
bpo-39573: Clean up modules and headers to use Py_IS_TYPE() function (GH-18521) 2020-02-17 11:09:15 +01:00
Hai Shi a7847590f0
bpo-36465: Update doc of init_config.rst (GH-18520) 2020-02-17 10:18:19 +01:00
Hai Shi b2b6e27bca
bpo-1635741: Port _crypt extension module to multiphase initialization (PEP 489) (GH-18404) 2020-02-17 10:11:34 +01:00
idomic d83b6600b2
bpo-38691 Added a switch to ignore PYTHONCASEOK when -E or -I flags passed (#18314)
* Hard reset + cherry piciking the changes.

* 📜🤖 Added by blurb_it.

* Added @vstinner News

* Update Misc/NEWS.d/next/Library/2020-02-11-13-01-38.bpo-38691.oND8Sk.rst

Co-Authored-By: Victor Stinner <vstinner@python.org>

* Hard reset to master

* Hard reset to master + latest changes

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2020-02-17 10:05:11 +01:00
Serhiy Storchaka 85a2eef473
bpo-32892: Update the documentation for handling constants in AST. (GH-18514) 2020-02-17 11:03:00 +02:00
idomic c33bdbb20c
bpo-37970: update and improve urlparse and urlsplit doc-strings (GH-16458) 2020-02-16 21:17:58 +02:00
Thomas Moreau a5cbab552d
bpo-39104: Fix hanging ProcessPoolExecutor on shutdown nowait with pickling failure (GH-17670)
As reported initially by @rad-pat in #6084, the following script causes a deadlock.

```
from concurrent.futures import ProcessPoolExecutor


class ObjectWithPickleError():
    """Triggers a RuntimeError when sending job to the workers"""

    def __reduce__(self):
        raise RuntimeError()


if __name__ == "__main__":
    e = ProcessPoolExecutor()
    f = e.submit(id, ObjectWithPickleError())
    e.shutdown(wait=False)
    f.result()  # Deadlock on get
```

This is caused by the fact that the main process is closing communication channels that might be necessary to the `queue_management_thread` later. To avoid this, this PR let the `queue_management_thread` manage all the closing.



https://bugs.python.org/issue39104



Automerge-Triggered-By: @pitrou
2020-02-16 10:09:26 -08:00
Vinay Sajip 1ed61617a4
bpo-12915: Add pkgutil.resolve_name (GH-18310) 2020-02-14 22:02:13 +00:00
Dong-hee Na 9aeb0ef930
bpo-39573: Update clinic to use Py_IS_TYPE() function (GH-18507) 2020-02-14 08:50:19 +01:00
Dong-hee Na d212c3c55d
bpo-39573: PyXXX_Check() macros use Py_IS_TYPE() (GH-18508)
Update PyXXX_Check() macros in Include/ to use
the new Py_IS_TYPE function.
2020-02-14 08:48:12 +01:00
Andy Lester 7386a70746
closes bpo-39630: Update pointers to string literals to be const char *. (GH-18510) 2020-02-13 20:42:56 -08:00
Ian Norton a9edf44a2d
closes bpo-39619 Fix os.chroot on HP-UX 11.31 (GH-18495)
Setting `-D_XOPEN_SOURCE=700` on HP-UX causes system functions such as chroot to be undefined.  This change stops `_XOPEN_SOURCE` begin set on HP-UX

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2020-02-13 19:09:11 -08:00
Serhiy Storchaka f632736023
bpo-39545: Document changes in the support of await in f-strings. (GH-18456)
https://bugs.python.org/issue39545
2020-02-13 15:57:35 -08:00
Vlad Emelianov 10e87e5ef4
bpo-39627: Fix TypedDict totality check for inherited keys (#18503)
(Adapted from https://github.com/python/typing/pull/700)
2020-02-13 11:53:29 -08:00
mpheath fbeba8f248
bpo-39524: Fixed doc-string in ast._pad_whitespace (GH-18340) 2020-02-13 20:32:09 +02:00
Dong-hee Na d905df766c
bpo-39573: Add Py_IS_TYPE() function (GH-18488)
Co-Author: Neil Schemenauer <nas-github@arctrix.com>
2020-02-13 18:37:17 +01:00
Brandt Bucher 968dcd9e7a
bpo-39573: Fix bad copy-paste in Py_SET_SIZE (GH-18496) 2020-02-13 18:34:45 +01:00
Nathaniel J. Smith 925dc7fb1d
bpo-39606: allow closing async generators that are already closed (GH-18475)
The fix for [bpo-39386](https://bugs.python.org/issue39386) attempted to make it so you couldn't reuse a
agen.aclose() coroutine object. It accidentally also prevented you
from calling aclose() at all on an async generator that was already
closed or exhausted. This commit fixes it so we're only blocking the
actually illegal cases, while allowing the legal cases.

The new tests failed before this patch. Also confirmed that this fixes
the test failures we were seeing in Trio with Python dev builds:
  https://github.com/python-trio/trio/pull/1396


https://bugs.python.org/issue39606
2020-02-13 00:15:38 -08:00
Saiyang Gou 7514f4f625
bpo-39184: Add audit events to functions in `fcntl`, `msvcrt`, `os`, `resource`, `shutil`, `signal`, `syslog` (GH-18407) 2020-02-13 07:47:42 +00:00
Andy Lester 597ebed748
closes bpo-39621: Make buf arg to md5_compress be const. (GH-18497) 2020-02-12 20:53:01 -08:00
Victor Stinner 8c3aee65ed
bpo-35134: Add Include/cpython/fileutils.h header file (GH-18493)
Move CPython C API from Include/fileutils.h into a new
Include/cpython/fileutils.h header file which is included by
Include/fileutils.h.

Exclude the following private symbols from the limited C API:

* _Py_error_handler
* _Py_GetErrorHandler()
* _Py_DecodeLocaleEx()
* _Py_EncodeLocaleEx()
2020-02-12 23:55:09 +01:00
Victor Stinner 98921aeaf5
bpo-35134: Add Include/cpython/bytesobject.h file (GH-18494)
Add Include/cpython/bytearrayobject.h and
Include/cpython/bytesobject.h header files.

Move CPython C API from Include/bytesobject.h into a new
Include/cpython/bytesobject.h header file which is included by
Include/bytesobject.h. Do a similar change for
Include/bytearrayobject.h.
2020-02-12 23:54:31 +01:00
Victor Stinner e9e7d284c4
bpo-35081: Move dtoa.h header to the internal C API (GH-18489)
Move the dtoa.h header file to the internal C API as pycore_dtoa.h:
it only contains private functions (prefixed by "_Py").

The math and cmath modules must now be compiled with the
Py_BUILD_CORE macro defined.
2020-02-12 22:54:42 +01:00
Victor Stinner 45876a90e2
bpo-35081: Move bytes_methods.h to the internal C API (GH-18492)
Move the bytes_methods.h header file to the internal C API as
pycore_bytes_methods.h: it only contains private symbols (prefixed by
"_Py"), except of the PyDoc_STRVAR_shared() macro.
2020-02-12 22:32:34 +01:00
Serhiy Storchaka 6e619c48b8
bpo-39474: Fix AST pos for expressions like (a)(b), (a)[b] and (a).b. (GH-18477) 2020-02-12 22:37:49 +02:00
William Chargin 674935b8ca
bpo-18819: tarfile: only set device fields for device files (GH-18080)
The GNU docs describe the `devmajor` and `devminor` fields of the tar
header struct only in the context of character and block special files,
suggesting that in other cases they are not populated. Typical utilities
behave accordingly; this patch teaches `tarfile` to do the same.
2020-02-12 11:56:02 -08:00
Victor Stinner 4fac7ed43e
bpo-21016: pydoc and trace use sysconfig (GH-18476)
bpo-21016, bpo-1294959: The pydoc and trace modules now use the
sysconfig module to get the path to the Python standard library, to
support uncommon installation path like /usr/lib64/python3.9/ on
Fedora.

Co-Authored-By: Jan Matějek <jmatejek@suse.com>
2020-02-12 13:02:29 +01:00
Serhiy Storchaka 8c579b1cc8
bpo-32856: Optimize the assignment idiom in comprehensions. (GH-16814)
Now `for y in [expr]` in comprehensions is as fast as a simple
assignment `y = expr`.
2020-02-12 12:18:59 +02:00
Serhiy Storchaka 0cc6b5e559
bpo-39219: Fix SyntaxError attributes in the tokenizer. (GH-17828)
* Always set the text attribute.
* Correct the offset attribute for non-ascii sources.
2020-02-12 12:17:00 +02:00
Serhiy Storchaka f4f445b693
bpo-39567: Add audit for os.walk(), os.fwalk(), Path.glob() and Path.rglob(). (GH-18372) 2020-02-12 12:11:34 +02:00
Benjamin Peterson 95905ce0f4
bpo-39605: Remove a cast that causes a warning. (GH-18473) 2020-02-11 19:36:14 -08:00
Jason R. Coombs e5bd73632e
bpo-39595: Improve zipfile.Path performance (#18406)
* Improve zipfile.Path performance on zipfiles with a large number of entries.

* 📜🤖 Added by blurb_it.

* Add bpo to blurb

* Sync with importlib_metadata 1.5 (6fe70ca)

* Update blurb.

* Remove compatibility code

* Add stubs module, omitted from earlier commit

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2020-02-11 21:58:47 -05:00
Andy Lester e6be9b59a9
closes bpo-39605: Fix some casts to not cast away const. (GH-18453)
gcc -Wcast-qual turns up a number of instances of casting away constness of pointers. Some of these can be safely modified, by either:

Adding the const to the type cast, as in:

-    return _PyUnicode_FromUCS1((unsigned char*)s, size);
+    return _PyUnicode_FromUCS1((const unsigned char*)s, size);

or, Removing the cast entirely, because it's not necessary (but probably was at one time), as in:

-    PyDTrace_FUNCTION_ENTRY((char *)filename, (char *)funcname, lineno);
+    PyDTrace_FUNCTION_ENTRY(filename, funcname, lineno);

These changes will not change code, but they will make it much easier to check for errors in consts
2020-02-11 18:28:35 -08:00
@RandyMcMillan 029e8401b7
docs: macos - change "versiona" to "versions" (GH-18467) 2020-02-11 20:20:05 -05:00
Steve Dower b138dd296a
Fix ordering issue in Windows release upload script (GH-18465)
Automerge-Triggered-By: @zooba
2020-02-11 09:32:52 -08:00
Victor Stinner f3fda37468
bpo-38644: Rephrase What's New entry (GH-18461) 2020-02-11 17:50:10 +01:00
Petr Viktorin ffd9753a94
bpo-39245: Switch to public API for Vectorcall (GH-18460)
The bulk of this patch was generated automatically with:

    for name in \
        PyObject_Vectorcall \
        Py_TPFLAGS_HAVE_VECTORCALL \
        PyObject_VectorcallMethod \
        PyVectorcall_Function \
        PyObject_CallOneArg \
        PyObject_CallMethodNoArgs \
        PyObject_CallMethodOneArg \
    ;
    do
        echo $name
        git grep -lwz _$name | xargs -0 sed -i "s/\b_$name\b/$name/g"
    done

    old=_PyObject_FastCallDict
    new=PyObject_VectorcallDict
    git grep -lwz $old | xargs -0 sed -i "s/\b$old\b/$new/g"

and then cleaned up:

- Revert changes to in docs & news
- Revert changes to backcompat defines in headers
- Nudge misaligned comments
2020-02-11 17:46:57 +01:00