Commit Graph

107721 Commits

Author SHA1 Message Date
Miss Islington (bot) d64d78be20
bpo-41531: Fix compilation of dict literals with more than 0xFFFF elements (GH-21850) (GH-22107)
(cherry picked from commit c51db0ea40)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-09-05 00:38:50 +01:00
Miss Islington (bot) 242eac1f04
On path with known exact float, extract the double with the fast macro. (GH-21072)
(cherry picked from commit 930f4518ae)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2020-09-04 16:12:48 -07:00
Miss Islington (bot) e92219d8f8
bpo-29590: fix stack trace for gen.throw() with yield from (GH-19896)
* Add failing test.

* bpo-29590: fix stack trace for gen.throw() with yield from (GH-NNNN)

When gen.throw() is called on a generator after a "yield from", the
intermediate stack trace entries are lost.  This commit fixes that.
(cherry picked from commit 8b33961e4b)

Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
2020-09-04 16:07:18 -07:00
Miss Islington (bot) 106c1df736
closes bpo-41533: Fix a potential memory leak when allocating a stack (GH-21847)
Free the stack allocated in va_build_stack if do_mkstack fails
and the stack is not a small_stack
(cherry picked from commit 75c80b0bda)

Co-authored-by: Tony Solomonik <tony.solomonik@gmail.com>
2020-09-04 15:56:04 -07:00
Miss Islington (bot) 8ed1c177c9
Fix typo in message from assert statement (GH-21283)
The error message was missing space between the action "acquire" and "_wait_semaphore" which is an attribute for instances of Condition.
(cherry picked from commit 99c0ee3c89)

Co-authored-by: Allen <64019758+aboddie@users.noreply.github.com>
2020-09-04 15:55:05 -07:00
Miss Islington (bot) fbb9ee0a90
[3.9] bpo-38787: Clarify docs for PyType_GetModule and warn against common mistake (GH-20215) (GH-21984)
(cherry picked from commit d9a966ae08)


Co-authored-by: Petr Viktorin <encukou@gmail.com>

Automerge-Triggered-By: @Mariatta
2020-09-04 15:32:28 -07:00
Miss Islington (bot) bf8bf1c0dc
[3.9] Improve asyncio-dev 'Concurrency and Multithreading' docs (GH-20882) (GH-22009)
I added some information to the `Concurrency and Multithreading` section of the `Developing with asyncio` guide. 

This is all information that would have helped me when I started using asyncio. I incorrectly assumed that `loop.call_soon_threadsafe()` and `run_coroutine_threadsafe()` could be called from a thread in a process separate from the one that the event loop is running in. Explicitly stating that this will not work will probably help some people starting out with asyncio in the future.

I also added references to some other functions that can be used for inter-process communication without blocking the event loop. The section already mentions running blocking code in a ThreadPoolExecutor, but I think listing these other options in this section will also be helpful.
(cherry picked from commit c68c5af2dc)


Co-authored-by: Roger Iyengar <ri@rogeriyengar.com>
2020-09-04 15:31:06 -07:00
Miss Islington (bot) bd078df283
[3.9] bpo-40486: Specify what happens if directory content change diring iteration (GH-22025) (GH-22093)
(cherry picked from commit 306cfb3a37)


Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-09-04 15:29:06 -07:00
Miss Islington (bot) 78ef1b6b12
[3.9] Fix error in argparse documentation example (GH-17399) (GH-21992)
Automerge-Triggered-By: @rhettinger
(cherry picked from commit 8784d3300e)


Co-authored-by: SarahPythonista <4283226+SarahPythonista@users.noreply.github.com>
2020-09-04 15:26:22 -07:00
Miss Islington (bot) 672d8b9190
[3.9] [doc] Fix a typo in the graphlib docs (GH-22030) (GH-22076)
(cherry picked from commit 8516060076)


Co-authored-by: Mario Šaško <mariosasko777@gmail.com>
2020-09-04 15:25:50 -07:00
Miss Islington (bot) 6386e86bec
bpo-38585: Remove references to defusedexpat (GH-22095)
defusedexpat is not maintained.
(cherry picked from commit 51b84f8e96)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-09-04 14:17:45 -07:00
Miss Islington (bot) fb050d0d60
bpo-41721: Add xlc options (GH-22097)
(cherry picked from commit 84a7917b4c)

Authored-by: Stefan Krah <skrah@bytereef.org>
2020-09-04 23:02:57 +02:00
Miss Islington (bot) 8f13ff959a
bpo-41700: Skip test if the locale is not supported (GH-22081) (GH-22085)
(cherry picked from commit 54a66ade20)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2020-09-04 18:55:25 +09:00
Miss Islington (bot) 8d68e59f11
bpo-39010: Improve test shutdown (GH-22066) (#22082)
Simply closing the event loop isn't enough to avoid warnings. If we
don't also shut down the event loop's default executor, it sometimes
logs a "dangling thread" warning.

Follow-up to GH-22017
(cherry picked from commit be435ae2b0)

Co-authored-by: Ben Darnell <ben@bendarnell.com>

Co-authored-by: Ben Darnell <ben@bendarnell.com>
2020-09-03 13:54:43 -07:00
Miss Islington (bot) a2680058ee
bpo-41696: Fix handling of debug mode in asyncio.run (GH-22069) (#22071)
* bpo-41696: Fix handling of debug mode in asyncio.run

This allows PYTHONASYNCIODEBUG or -X dev to enable asyncio debug mode
when using asyncio.run

* 📜🤖 Added by blurb_it.

Co-authored-by: hauntsaninja <>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit 0770ad948c)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2020-09-03 13:54:09 -07:00
Miss Islington (bot) 49571c0b0e
bpo-39010: Fix errors logged on proactor loop restart (GH-22017) (#22034)
Stopping and restarting a proactor event loop on windows can lead to
spurious errors logged (ConnectionResetError while reading from the
self pipe). This fixes the issue by ensuring that we don't attempt
to start multiple copies of the self-pipe reading loop.
(cherry picked from commit ea5a6363c3)

Co-authored-by: Ben Darnell <ben@bendarnell.com>

Co-authored-by: Ben Darnell <ben@bendarnell.com>
2020-09-03 12:38:29 -07:00
Pablo Galindo 270e249290
[3.9] Fix 'gather' rules in the python parser generator (GH-22021) (GH-22080)
Currently, empty sequences in gather rules make the conditional for
gather rules fail as empty sequences evaluate as "False". We need to
explicitly check for "None" (the failure condition) to avoid false
negatives.
(cherry picked from commit e55a0e9)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-09-03 16:35:36 +01:00
Pablo Galindo be17295280
[3.9] bpo-41697: Correctly handle KeywordOrStarred when parsing arguments in the parser (GH-22077) (GH-22079)
(cherry picked from commit 315a61f7a9)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-09-03 16:35:17 +01:00
Miss Islington (bot) a5d0232b0d
bpo-39883: Use BSD0 license for code in docs (GH-17635) (GH-22073)
The PSF board approved this use.
(cherry picked from commit e223d06a8b)

Co-authored-by: Todd <toddrjen@gmail.com>
2020-09-03 07:40:10 -07:00
Pablo Galindo 8de34cdb95
[3.9] bpo-41690: Use a loop to collect args in the parser instead of recursion (GH-22053) (GH-22067)
This program can segfault the parser by stack overflow:

```
import ast

code = "f(" + ",".join(['a' for _ in range(100000)]) + ")"
print("Ready!")
ast.parse(code)
```

the reason is that the rule for arguments has a simple recursion when collecting args:

args[expr_ty]:
    [...]
    | a=named_expression b=[',' c=args { c }] {
        [...] }.
(cherry picked from commit 4a97b1517a)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-09-02 21:30:51 +01:00
Shantanu a763ee3c58
[3.9] bpo-39349: Add cancel_futures to Executor.shutdown base class (GH-22023) (GH-22048)
* Add cancel_futures parameter to the Executor base class, since it was missed in the original PR (https://github.com/python/cpython/pull/18057) that added cancel_futures.
(cherry picked from commit 17dc1b7)
2020-09-02 15:28:28 -04:00
Miss Islington (bot) 27183f48f2
Fix invalid escape sequences in the peg_highlight Sphinx extension (GH-22047) (GH-22065)
(cherry picked from commit 5a4a963a6c)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-09-02 17:43:43 +01:00
Miss Islington (bot) bafaf07275
[doc] Remove references to PyChecker. (GH-22054)
(cherry picked from commit dea82b6731)

Co-authored-by: Andre Delfino <adelfino@gmail.com>
2020-09-02 08:29:33 -05:00
Miss Islington (bot) e2e033807f
Remove reference to Boa Constructor. (GH-22056)
(cherry picked from commit 1d25f5bf7b)

Co-authored-by: Andre Delfino <adelfino@gmail.com>
2020-09-02 08:29:16 -05:00
Miss Islington (bot) 63fa113c60
Fixed mistake in test for f-string error description (GH-22036) (GH-22059) (GH-22060)
(cherry picked from commit 749ed85e44)

Co-authored-by: han-solo <hanish0019@gmail.com>

Co-authored-by: han-solo <hanish0019@gmail.com>
2020-09-02 08:13:39 -04:00
Miss Islington (bot) e2977f6202
Note the buffer slots can be set with PyType_Spec with the unlimited API. (GH-22052)
Follow up to f7c4e23642.
(cherry picked from commit 700fa1b836)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2020-09-01 22:18:21 -05:00
Pablo Galindo d14775ddbb
[3.9] bpo-41654: Fix deallocator of MemoryError to account for subclasses (GH-22020) (GH-22045)
When allocating MemoryError classes, there is some logic to use
pre-allocated instances in a freelist only if the type that is being
allocated is not a subclass of MemoryError. Unfortunately in the
destructor this logic is not present so the freelist is altered even
with subclasses of MemoryError..
(cherry picked from commit 9b648a95cc)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-09-01 21:40:57 +01:00
Victor Stinner 4217b3c128
bpo-41617: Fix pycore_byteswap.h to support clang 3.0 (GH-22042) (GH-22044)
__builtin_bswap16() is not available in LLVM clang 3.0.

(cherry picked from commit e6905e4c82)
2020-09-01 20:54:37 +02:00
Miss Islington (bot) c16a2a1b64
bpo-41681: Fix for `f-string/str.format` error description when using 2 `,` in format specifier (GH-22036) (GH-22041)
* Fixed `f-string/str.format` error description when using two `,` in format specifier.

Co-authored-by: millefalcon <hanish0019@hmail.com>
(cherry picked from commit 0d6aa7f0ee)

Co-authored-by: han-solo <hanish0019@gmail.com>

Co-authored-by: han-solo <hanish0019@gmail.com>
2020-09-01 11:45:59 -04:00
Miss Islington (bot) ca55ecbf9a
bpo-41344: Raise ValueError when creating shared memory of size 0 (GH-21556) (GH-22018)
(cherry picked from commit 475a5fbb56)

Co-authored-by: Vinay Sharma <vinay04sharma@icloud.com>

Co-authored-by: Vinay Sharma <vinay04sharma@icloud.com>
2020-08-30 20:42:22 +01:00
Miss Islington (bot) 901c2eae6e
bpo-41524: fix pointer bug in PyOS_mystr{n}icmp (GH-21845) (GH-21978) 2020-08-30 15:53:09 +09:00
Miss Islington (bot) 6b5e88744c
bpo-41634: Fix a typo in the curses documentation (GH-21958)
(cherry picked from commit 398575c210)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-08-29 18:33:48 -04:00
Miss Islington (bot) 88b86a9752
bpo-19521: Fix parallel build race condition on AIX (GH-22001)
Patch by Michael Haubenwallner.
(cherry picked from commit e6dcd371b2)

Co-authored-by: Stefan Krah <skrah@bytereef.org>
2020-08-29 18:36:40 +02:00
Karthikeyan Singaravelan c01a7edc67
[3.9] bpo-41624: fix documentation of typing.Coroutine (GH-21952) (#21982)
(cherry picked from commit 8c58d2a)

Co-authored-by: MingZhe Hu <humingzhework@163.com>

Co-authored-by: MingZhe Hu <humingzhework@163.com>
2020-08-28 08:06:31 -07:00
Miss Islington (bot) 7361451b97
bpo-41609: Fix output of pdb's whatis command for instance methods (GH-21935) (#21977)
(cherry picked from commit 022bc7572f)

Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
2020-08-27 03:17:40 +02:00
Miss Islington (bot) 211e4c6e9c
bpo-33660: Fix PosixPath to resolve a relative path on root (#21974)
(cherry picked from commit 94ad6c674f)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2020-08-27 02:51:44 +02:00
Miss Islington (bot) 9de6be4e2a
bpo-37658: Fix asyncio.wait_for() to respect waited task status (GH-21894) (GH-21964)
Currently, if `asyncio.wait_for()` itself is cancelled it will always
raise `CancelledError` regardless if the underlying task is still
running.  This is similar to a race with the timeout, which is handled
already.
(cherry picked from commit a2118a1462)

Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
2020-08-26 19:15:35 +02:00
Miss Islington (bot) 1036ccb55d
bpo-32751: Wait for task cancel in asyncio.wait_for() when timeout <= 0 (GH-21895) (GH-21963)
When I was fixing bpo-32751 back in GH-7216 I missed the case when
*timeout* is zero or negative.  This takes care of that.

Props to @aaliddell for noticing the inconsistency.
(cherry picked from commit c517fc7121)

Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
2020-08-26 19:14:59 +02:00
Miss Islington (bot) d7cd1164c1
Document vars behavior when __dict__ is missing (GH-21466) (GH-21939)
(cherry picked from commit 802726acf6)

Co-authored-by: Andre Delfino <adelfino@gmail.com>
2020-08-22 15:55:00 -03:00
Miss Islington (bot) 72d5ddb930
Fix grammar in Doc/tutorial/controlflow.rst (GH-21885) (#21922)
Automerge-Triggered-By: @csabella
(cherry picked from commit 0be7c216e1)

Co-authored-by: Denis Ovsienko <denis@ovsienko.info>
2020-08-22 05:08:02 -04:00
Miss Islington (bot) f497bbeed0
bpo-40994: Ungroup items in collections.abc documentation for improved clarity (GH-21880) (#21926)
Use a less surprising document structure.

Automerge-Triggered-By: @csabella
(cherry picked from commit 2ce39631f6)

Co-authored-by: Sydney Pemberton <46042811+sydneypemberton1986@users.noreply.github.com>
2020-08-22 05:06:54 -04:00
Miss Islington (bot) 429a86a120
bpo-41573: Update release versions in General FAQ (GH-21915) (#21938)
(cherry picked from commit 7173fc84e6)
Co-authored-by: wyz23x2 <52805709+wyz23x2@users.noreply.github.com>
2020-08-22 03:47:37 -04:00
Miss Islington (bot) a2d00f0473
bpo-41572: Fix grammar in BaseTransport.close docstring (GH-21914) (#21929)
Fix grammar in BaseTransport.close docstring.

https://bugs.python.org/issue41572

Signed-off-by: Cleber Rosa <crosa@redhat.com>
(cherry picked from commit 1afb42cfa8)

Co-authored-by: Cleber Rosa <cleber.gnu@gmail.com>
2020-08-21 17:49:40 +05:30
Miss Islington (bot) 3949827a54
Doc: add a missing period (GH-21819) (#21932)
(cherry picked from commit 12695f4c6d)

Co-authored-by: Mathieu Dupuy <deronnax@gmail.com>

Co-authored-by: Mathieu Dupuy <deronnax@gmail.com>
2020-08-20 17:40:57 -03:00
Victor Stinner 8f88190af5
[3.9] bpo-40204: Allow pre-Sphinx 3 syntax in the doc (GH-21844) (GH-21901)
* bpo-40204: Allow pre-Sphinx 3 syntax in the doc (GH-21844)

Enable Sphinx 3.2 "c_allow_pre_v3" option and disable the
c_warn_on_allowed_pre_v3 option to make the documentation compatible
with Sphinx 2 and Sphinx 3.

(cherry picked from commit 423e77d6de)

* bpo-40204: Fix Sphinx sytanx in howto/instrumentation.rst (GH-21858)

Use generic '.. object::' to declare markers, rather than abusing
'..  c:function::' which fails on Sphinx 3.

(cherry picked from commit 43577c01a2)

* bpo-40204: Fix duplicates in the documentation (GH-21857)

Fix two Sphinx 3 issues:

Doc/c-api/buffer.rst:304: WARNING: Duplicate C declaration, also defined in 'c-api/buffer'.
Declaration is 'PyBUF_ND'.

Doc/c-api/unicode.rst:1603: WARNING: Duplicate C declaration, also defined in 'c-api/unicode'.
Declaration is 'PyObject* PyUnicode_Translate(PyObject *str, PyObject *table, const char *errors)'.

(cherry picked from commit 46d10b1237)

* bpo-40204: Add :noindex: in the documentation (GH-21859)

Add :noindex: to duplicated documentation to fix "duplicate object
description" errors.

For example, fix this Sphinx 3 issue:

Doc/library/configparser.rst:1146: WARNING: duplicate object
description of configparser.ConfigParser.optionxform, other instance
in library/configparser, use :noindex: for one of them

(cherry picked from commit d3ded08048)

* bpo-40204, doc: Fix syntax of C variables (GH-21846)

For example, fix the following Sphinx 3 errors:

Doc/c-api/buffer.rst:102: WARNING: Error in declarator or parameters
Invalid C declaration: Expected identifier in nested name. [error at 5]
  void \*obj
  -----^

Doc/c-api/arg.rst:130: WARNING: Unparseable C cross-reference: 'PyObject*'
Invalid C declaration: Expected end of definition. [error at 8]
  PyObject*
  --------^

The modified documentation is compatible with Sphinx 2 and Sphinx 3.

(cherry picked from commit 474652fe93)

* bpo-40204: Fix reference to terms in the doc (GH-21865)

Sphinx 3 requires to refer to terms with the exact case.

For example, fix the Sphinx 3 warning:

Doc/library/pkgutil.rst:71: WARNING: term Loader not found in case
sensitive match.made a reference to loader instead.

(cherry picked from commit bb0b08540c)

* bpo-40204: Fix duplicated productionlist names in the doc (GH-21900)

Sphinx 3 disallows having more than one productionlist markup with
the same name. Simply remove names in this case, since names are not
shown anyway. For example, fix the Sphinx 3 warning:

Doc/reference/introduction.rst:96: duplicate token description
of *:name, other instance in reference/expressions

(cherry picked from commit 1abeda80f7)
2020-08-19 19:25:22 +02:00
Miss Islington (bot) e3cafebb5c
bpo-41568: Fix refleaks in zoneinfo subclasses (GH-21907)
* Fix refleak in C module __init_subclass__

This was leaking a reference to the weak cache dictionary for every
ZoneInfo subclass created.

* Fix refleak in ZoneInfo subclass's clear_cache

The previous version of the code accidentally cleared the global
ZONEINFO_STRONG_CACHE variable (and inducing `ZoneInfo` to create a new
strong cache) on calls to a subclass's `clear_cache()`. This would not
affect guaranteed behavior, but it's still not the right thing to do
(and it caused reference leaks).
(cherry picked from commit c3dd7e45cc)

Co-authored-by: Paul Ganssle <paul@ganssle.io>
2020-08-17 16:24:15 -07:00
Miss Islington (bot) d6bdf6d52f
bpo-40782: Change asyncio.AbstractEventLoop.run_in_executor to be a method not a coroutine (GH-21852)
asyncio.AbstractEventLoop.run_in_executor should be a method that returns an asyncio Future, not an async method.
This matches the concrete implementations, and the documentation better.
(cherry picked from commit 29f84294d8)

Co-authored-by: James Weaver <james.barrett@bbc.co.uk>
2020-08-17 07:40:26 -07:00
Miss Islington (bot) 2c050e52f1
[3.9] bpo-41503: Fix race between setTarget and flush in logging.handlers.MemoryHandler (GH-21765) (GH-21897)
(cherry picked from commit 2353d77fad)


Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>

Automerge-Triggered-By: @vsajip
2020-08-16 08:34:27 -07:00
Miss Islington (bot) 28bf82661a
bpo-41540: AIX: skip test that is flaky with a default ulimit. (GH-21890) (#21893)
- AIX has extreme over-allocation that is in no relation to the physical
    RAM and swap.

(cherry picked from commit 39dab24621)

Authored-by: Stefan Krah <skrah@bytereef.org>
2020-08-15 20:40:14 +02:00
Miss Islington (bot) 1864eacc22
bpo-40878: xlc cannot handle C99 extern inline. (GH-21891)
This applies to the default "extc99" mode.  Python does not compile with "stdc99".

(cherry picked from commit 40e700ad04)

Authored-by: Stefan Krah <skrah@bytereef.org>
2020-08-15 20:37:08 +02:00