Commit Graph

107391 Commits

Author SHA1 Message Date
Adorilson Bezerra eaca2aa117
Improve IO tutorial's "Old string formatting" section (GH-16251)
* Use a more universal explanation of string interpolation rather than specifically referencing sprintf(), which depends on the reader having a C background.


Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2020-05-27 21:34:01 -04:00
Elazar Gershuni 56853d8ec6
bpo-39939: Fix removeprefix issue number in the What's New in Python 3.9 (GH-20473) 2020-05-28 02:41:24 +02:00
Victor Stinner aa890630bc
bpo-40275: test.support imports subprocess lazily (GH-20471)
test.support module now imports the platform and subprocess modules
lazily to reduce the number of modules imported by
"import test.support".

With this change, the threading module is no longer imported
indirectly by "import test.support".

Use sys.version rather than platform.machine() to detect the Windows
ARM32 buildbot.
2020-05-28 01:56:29 +02:00
Victor Stinner b0461e19b5
bpo-40275: test.support.check_impl_detail() uses sys.implementation (GH-20468)
check_impl_detail() of test.support now uses sys.implementation.name,
instead of platform.python_implementation().lower(). This change
prepares test.support to import the platform module lazily.
2020-05-28 00:44:23 +02:00
Victor Stinner 10228bad04
bpo-40795: ctypes calls unraisablehook with an exception (GH-20452)
If ctypes fails to convert the result of a callback or if a ctypes
callback function raises an exception, sys.unraisablehook is now
called with an exception set. Previously, the error was logged into
stderr by PyErr_Print().
2020-05-28 00:38:12 +02:00
Hai Shi e80697d687
bpo-40275: Adding threading_helper submodule in test.support (GH-20263) 2020-05-28 00:10:27 +02:00
Pablo Galindo 7d80b35af1
Revert "bpo-32604: PEP 554 for use in test suite (GH-19985)" (#20465)
This reverts commit 9d17cbf33d.
2020-05-27 23:33:13 +02:00
YoSTEALTH 76ef255bde
bpo-37129: Add os.RWF_APPEND flag for os.pwritev() (GH-20336) 2020-05-27 23:32:22 +02:00
Pablo Galindo e4799b9594
Fix compiler warnings in _zoneinfo.c (GH-20342)
```
D:\a\cpython\cpython\Modules\_zoneinfo.c(903,52): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data [D:\a\cpython\cpython\PCbuild\_zoneinfo.vcxproj]
D:\a\cpython\cpython\Modules\_zoneinfo.c(904,44): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data [D:\a\cpython\cpython\PCbuild\_zoneinfo.vcxproj]
D:\a\cpython\cpython\Modules\_zoneinfo.c(1772,31): warning C4244: '=': conversion from 'ssize_t' to 'uint8_t', possible loss of data [D:\a\cpython\cpython\PCbuild\_zoneinfo.vcxproj]
```
2020-05-27 13:48:12 -07:00
Shantanu c116c94ff1
bpo-40614: Respect feature version for f-string debug expressions (GH-20196)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2020-05-27 21:30:38 +01:00
Christian Heimes db5aed931f
bpo-40791: Use CRYPTO_memcmp() for compare_digest (#20456)
hashlib.compare_digest uses OpenSSL's CRYPTO_memcmp() function
when OpenSSL is available.

Note: The _operator module is a builtin module. I don't want to add
libcrypto dependency to libpython. Therefore I duplicated the wrapper
function and added a copy to _hashopenssl.c.
2020-05-27 21:50:06 +02:00
Fantix King 210a137396
bpo-30064: Fix asyncio loop.sock_* race condition issue (#20369) 2020-05-27 12:47:30 -07:00
Lysandros Nikolaou 526e23f153
Refactor error handling code in Parser/pegen/pegen.c (GH-20440)
Set p->error_indicator in various places, where it's needed, but it's
not done.

Automerge-Triggered-By: @gvanrossum
2020-05-27 09:04:11 -07:00
Sean Gillespie 29a1384c04
bpo-13097: ctypes: limit callback to 1024 arguments (GH-19914)
ctypes now raises an ArgumentError when a callback
is invoked with more than 1024 arguments.

The ctypes module allocates arguments on the stack in
ctypes_callproc() using alloca(), which is problematic
when large numbers of arguments are passed. Instead
of a stack overflow, this commit raises an ArgumentError
if more than 1024 parameters are passed.
2020-05-27 17:22:07 +02:00
Victor Stinner fe2978b3b9
bpo-39573: Convert Py_REFCNT and Py_SIZE to functions (GH-20429)
Convert Py_REFCNT() and Py_SIZE() macros to static inline functions.
They cannot be used as l-value anymore: use Py_SET_REFCNT() and
Py_SET_SIZE() to set an object reference count and size.

Replace &Py_SIZE(self) with &((PyVarObject*)self)->ob_size
in arraymodule.c.

This change is backward incompatible on purpose, to prepare the C API
for an opaque PyObject structure.
2020-05-27 14:55:10 +02:00
Mark Dickinson 20941de0dd
bpo-37999: Fix outdated __int__ and nb_int references in comments (GH-20449)
* Fix outdated __int__ and nb_int references in comments

* Also update C-API documentation

* Add back missing 'method' word

* Remove .. deprecated notices
2020-05-27 13:43:17 +01:00
Xavier Fernandez feb0846c3a
Upgrade bundled versions of pip & setuptools (#16782) 2020-05-27 20:49:34 +10:00
Oleg Höfling 7da46b676a
Fix the link to ncurses patch download in macos installer build script (GH-20421)
Reason: the link `ftp://invisible-island.net/ncurses//5.9/ncurses-5.9-20120616-patch.sh.bz2` is dead, which prevents `Mac/BuildScript/build-installer.py` from completing. Looks like the host of the FTP server was changed to `ftp.invisible-island.net`, thus this proposal.

Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2020-05-27 03:07:15 -07:00
Pablo Galindo 1cf15af9a6 bpo-40217: Ensure Py_VISIT(Py_TYPE(self)) is always called for PyType_FromSpec types (reverts GH-19414) (GH-20264)
Heap types now always visit the type in tp_traverse. See added docs for details.

This reverts commit 0169d3003b.

Automerge-Triggered-By: @encukou
2020-05-27 02:03:38 -07:00
Pablo Galindo 404b23b85b
Fix lookahead of soft keywords in the PEG parser (GH-20436)
Automerge-Triggered-By: @gvanrossum
2020-05-26 16:15:52 -07:00
Ethan Steinberg 21fda91f8d
bpo-40611: Adds MAP_POPULATE to the mmap module (GH-20061)
MAP_POPULATE constant has now been added to the list of exported
mmap module flags.
2020-05-26 23:42:18 +02:00
Guido van Rossum b45af1a569
Add soft keywords (GH-20370)
These are like keywords but they only work in context; they are not reserved except when there is an exact match.

This would enable things like match statements without reserving `match` (which would be bad for the `re.match()` function and probably lots of other places).

Automerge-Triggered-By: @gvanrossum
2020-05-26 10:58:44 -07:00
Serhiy Storchaka 578c3955e0
bpo-37999: No longer use __int__ in implicit integer conversions. (GH-15636)
Only __index__ should be used to make integer conversions lossless.
2020-05-26 18:43:38 +03:00
Arturo Escaip 8ad052464a
bpo-40756: Default second argument of LoggerAdapter.__init__ to None (GH-20362)
The 'extra' argument is not always used by custom logger adapters. For
example:

```python
class IndentAdapter(logging.LoggerAdapter):
    def process(self, msg, kwargs):
        indent = kwargs.pop(indent, 1)
        return ' ' * indent + msg, kwargs
```

It is cleaner and friendlier to default the 'extra' argument to None
instead of either forcing the subclasses of LoggerAdapter to pass a None
value directly or to override the constructor.

This change is backward compatible because existing calls to
`LoggerAdapter.__init__` are already passing a value for the second
argument.

Automerge-Triggered-By: @vsajip
2020-05-26 07:55:21 -07:00
idomic db098bc1f0
bpo-39244: multiprocessing return default start method first on macOS (GH-18625) 2020-05-26 17:54:21 +03:00
Erlend Egeberg Aasland 5eb45d7d4e
bpo-40737: Fix possible reference leak for sqlite3 initialization (GH-20323) 2020-05-26 21:18:19 +09:00
Christian Heimes be63019ed7
bpo-40637: Fix test_pbkdf2_hmac_py for missing sha1 (#20422) 2020-05-26 12:26:29 +02:00
Zackery Spytz af7553ac95
bpo-39301: State that floor division is used for right shift operations (GH-20347)
* bpo-39301: State that floor division is used for right shift operations

* Remove "without overflow check"
2020-05-26 09:16:34 +01:00
Serhiy Storchaka 1c5d1d7304
Remove duplicated words words (GH-20413) 2020-05-26 01:04:14 -07:00
ziheng 2b0e654f91
bpo-40745: Fix typos in NewType docs (GH-20379) 2020-05-25 21:45:35 -07:00
Raymond Hettinger 3cfe5b7b8f
Simplify creation of the __new__ method in namedtuple() (GH-20361) 2020-05-25 21:39:00 -07:00
Ammar Askar a2bbedc8b1
Fix peg_generator compiler warnings under MSVC (GH-20405) 2020-05-26 05:33:35 +01:00
sth 4a0ac42c52
closes bpo-40774: Fix docs indentation for asyncio.create_subprocess_shell() (GH-20403) 2020-05-25 23:08:40 -05:00
Lysandros Nikolaou f7b1e46156
bpo-38964: Print correct filename on a SyntaxError in an fstring (GH-20399)
When a `SyntaxError` in the expression part of a fstring is found,
the filename attribute of the `SyntaxError` is always `<fstring>`.
With this commit, it gets changed to always have the name of the file
the fstring resides in.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-05-26 01:32:18 +01:00
Ammar Askar 2602d97a0a
[workflow] Use Sphinx problem matcher on GitHub docs builds (GH-20325) 2020-05-25 22:32:24 +01:00
Lysandros Nikolaou 9645930b5b
bpo-40688: Use the correct parser in the peg_generator scripts (GH-20235)
The scripts in `Tools/peg_generator/scripts` mostly assume that
`ast.parse` and `compile` use the old parser, since this was the
state of things, while we were developing them. They need to be
updated to always use the correct parser. `_peg_parser` is being
extended to support both parsing and compiling with both parsers.
2020-05-25 20:51:58 +01:00
Rotuna 448325369f
bpo-23082: Better error message for PurePath.relative_to() from pathlib (GH-19611)
Co-authored-by: Sadhana Srinivasan <rotuna@Sadhanas-MBP.fritz.box>
2020-05-25 20:42:28 +01:00
Hai Shi 2377a9bae3
Closes bpo-40558: update CONTRIBUTING.rst to reflect current branches (GH-19989) 2020-05-25 14:19:42 -05:00
Pablo Galindo deb4355a37
bpo-40750: Do not expand the new parser debug flags if Py_BUILD_CORE is not defined (GH-20393) 2020-05-25 20:17:12 +01:00
Pablo Galindo 800a35c623
bpo-40750: Support -d flag in the new parser (GH-20340) 2020-05-25 18:38:45 +01:00
Dong-hee Na 7d847e29d7
bpo-39573: Fix buildbot failure for tupleobject.c (GH-20391) 2020-05-26 02:25:28 +09:00
Dong-hee Na ad3252bad9
bpo-39573: Convert Py_TYPE() to a static inline function (GH-20290) 2020-05-26 01:52:54 +09:00
Miro Hrončok e50883ccc4
bpo-39245: Fix docs links to the stable ABI (GH-20388)
Automerge-Triggered-By: @vstinner
2020-05-25 08:42:48 -07:00
Sergey Fedoseev e682b26a6b
bpo-34397: Remove redundant overflow checks in list and tuple implementation. (GH-8757) 2020-05-25 07:54:40 -07:00
Miro Hrončok ef16958d17
bpo-38972: Fix typos in PowerShell Execution Policies links (GH-20383) 2020-05-25 16:54:14 +02:00
Christian Heimes 20c22db602
bpo-40671: Prepare _hashlib for PEP 489 (GH-20180) 2020-05-25 10:44:51 +02:00
Christian Heimes 4cc2f9348c
bpo-40695: Limit hashlib builtin hash fallback (GH-20259)
:mod:`hashlib` no longer falls back to builtin hash implementations when
OpenSSL provides a hash digest and the algorithm is blocked by security
policy.

Signed-off-by: Christian Heimes <christian@python.org>
2020-05-25 01:43:10 -07:00
Zackery Spytz 3f59b55316
bpo-35714: Reject null characters in struct format strings (GH-16928)
struct.error is now raised if there is a null character in a struct
format string.
2020-05-25 10:55:09 +03:00
Jakub Stasiak 372ee27d49
bpo-38580: Document that select() accepts iterables, not just sequences (GH-16832) 2020-05-25 10:03:48 +03:00
Batuhan Taskaya cba5031510
bpo-40334: Support suppressing of multiple optional variables in Pegen (GH-20367) 2020-05-24 23:20:18 +01:00