Commit Graph

6255 Commits

Author SHA1 Message Date
Victor Stinner 40e1b04e38
Document most common signals (GH-19245) (GH-19257)
Document individual signals (only the most common signals):
description, default action, availability.

(cherry picked from commit 400e1dbcad)
2020-03-31 19:44:28 +02:00
Victor Stinner e97c8b0688
bpo-20526: Fix PyThreadState_Clear(): don't decref frame (GH-19120) (GH-19136)
PyThreadState.frame is a borrowed reference, not a strong reference:
PyThreadState_Clear() must not call Py_CLEAR(tstate->frame).

Remove test_threading.test_warnings_at_exit(): we cannot warranty
that the Python thread state of daemon threads is cleared in a
reliable way during Python shutdown.

(cherry picked from commit 5804f878e7)
2020-03-24 17:12:19 +01:00
Miss Islington (bot) c959fa9353
bpo-22490: Remove __PYVENV_LAUNCHER__ from environment during launch (GH-9516) (GH-19110)
* bpo-22490: Remove "__PYVENV_LAUNCHER__" from the shell environment on macOS

This changeset removes the environment varialbe "__PYVENV_LAUNCHER__"
during interpreter launch as it is only needed to communicate between
the stub executable in framework installs and the actual interpreter.

Leaving the environment variable present may lead to misbehaviour when
launching other scripts.

* Actually commit the changes for issue 22490...

* Correct typo

Co-Authored-By: Nicola Soranzo <nicola.soranzo@gmail.com>

* Run make patchcheck

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Nicola Soranzo <nicola.soranzo@gmail.com>
(cherry picked from commit 044cf94f61)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2020-03-22 14:56:26 -04:00
Miss Islington (bot) ec8a973f7c
bpo-39562: Allow executing asynchronous comprehensions in the asyncio REPL (GH-18968)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
(cherry picked from commit 9052f7a41b)

Co-authored-by: Batuhan Taşkaya <47358913+isidentical@users.noreply.github.com>
2020-03-19 04:54:16 -07:00
Victor Stinner 046255c40f
bpo-35370: PyEval_SetTrace() logs unraisable error (GH-18977) (GH-19029)
If PySys_Audit() fails in PyEval_SetProfile() or PyEval_SetTrace(),
log the error as an unraisable exception.

(cherry picked from commit f6a5850782)
2020-03-16 18:18:20 +01:00
Miss Islington (bot) f7e32fcbd6
bpo-39965: Correctly raise SyntaxError if await is used outside async functions when PyCF_ALLOW_TOP_LEVEL_AWAIT is set (GH-19010)
(cherry picked from commit 90235810ec)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-03-14 21:46:26 -07:00
Miss Islington (bot) 60b1b5ac56
bpo-39847: EnterNonRecursiveMutex() uses GetTickCount64() (GH-18780)
The 32-bit (49-day) TickCount relied on in EnterNonRecursiveMutex can overflow
in the gap between the 'target' time and the 'now' time WaitForSingleObjectEx
returns, causing the loop to think it needs to wait another 49 days. This is
most likely to happen when the machine is hibernated during
WaitForSingleObjectEx.

This makes acquiring a lock/event/etc from the _thread or threading module
appear to never timeout.

Replace with GetTickCount64 - this is OK now Python no longer supports XP which
lacks it, and is in use for time.monotonic().

Co-authored-by: And Clover <and.clover@bromium.com>
(cherry picked from commit 64838ce717)

Co-authored-by: bobince <and+github@doxdesk.com>
2020-03-11 16:57:16 -07:00
Miss Islington (bot) cd07b4da65
bpo-39520: Fix un-parsing of ext slices with no dimensions (GH-18304)
(cherry picked from commit 185903de12)

Co-authored-by: Batuhan Taşkaya <47358913+isidentical@users.noreply.github.com>
2020-03-11 13:18:01 -07:00
Miss Islington (bot) 57fb29219f
bpo-39831: Remove outdated comment. (GH-18764)
(cherry picked from commit ae75a29435)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-03-03 10:01:09 -08:00
Stefan Krah 5a92f42d87
bpo-39776: Lock ++interp->tstate_next_unique_id. (GH-18746) (#18746) (#18752)
- Threads created by PyGILState_Ensure() could have a duplicate tstate->id.

(cherry picked from commit b3b9ade4a3)
2020-03-03 09:18:55 +01:00
Pablo Galindo 394dc0db87
[3.8] bpo-39831: Fix a reference leak in PyErr_WarnEx(). (GH-18750) (GH-18761)
(cherry picked from commit 2d2f855)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-03-03 01:13:10 +00:00
Serhiy Storchaka 87a4cd5fbe
bpo-38410: Properly handle PySys_Audit() failures (GH-18658)
_PyEval_SetAsyncGenFinalizer() and _PyEval_SetAsyncGenFirstiter()
didn't include proper error handling for their PySys_Audit() calls.

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-03-02 09:58:48 +02:00
Serhiy Storchaka a7b8a969eb
[3.8] bpo-38913: Fix segfault in Py_BuildValue("(sGH-O)", ...) if entered with exception raised. (GH-18656). (GH-18732)
(cherry picked from commit 28d0bcac8b)
2020-03-02 09:54:43 +02:00
Pablo Galindo 13951c7f25
[3.8] bpo-39427: Document -X opt options in the CLI --help and the man page (GH-18131) (GH-18133)
https://bugs.python.org/issue39427

Automerge-Triggered-By: @pablogsal
(cherry picked from commit 41f0ef6abb)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-02-23 20:48:27 +00:00
Benjamin Peterson 0d860dd43c
[3.8] closes bpo-39630: Update pointers to string literals to be const char *. (GH-18511)
(cherry picked from commit 7386a70746)

Co-authored-by: Andy Lester <andy@petdance.com>
2020-02-13 21:05:00 -08:00
Miss Islington (bot) 2076d4f97e
bpo-39474: Fix AST pos for expressions like (a)(b), (a)[b] and (a).b. (GH-18477)
(cherry picked from commit 6e619c48b8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-02-12 12:56:44 -08:00
Miss Islington (bot) 190433d815
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
(cherry picked from commit e6be9b59a9)

Co-authored-by: Andy Lester <andy@petdance.com>
2020-02-11 18:47:20 -08:00
Lysandros Nikolaou 8b9cebce09
[3.8] bpo-39579: Fix Attribute end_col_offset to point at the current node (GH-18405) (GH-18408)
(cherry picked from commit d2e1098641)





https://bugs.python.org/issue39579



Automerge-Triggered-By: @gvanrossum
2020-02-07 16:21:38 -08:00
Miss Islington (bot) 92135775ce
Fix compiler warning on Windows (GH-18012)
Python-ast.h contains a macro named Yield that conflicts with the Yield macro
in Windows system headers. While Python-ast.h has an "undef Yield" directive
to prevent this, it means that Python-ast.h must be included before Windows
header files or we run into a re-declaration warning. In commit c96be811fa
an include for pycore_pystate.h was added which indirectly includes Windows
header files. In this commit we re-order the includes to fix this warning.
(cherry picked from commit e92d39303f)

Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
2020-01-15 09:07:09 -08:00
Karthikeyan Singaravelan 9955f33cdb [3.8] bpo-39033: Fix NameError in zipimport during hash validation (GH-17588) (GH-17642)
Fix `NameError` in `zipimport` during hash validation and add a regression test.

(cherry picked from commit 79f02fee1a)



https://bugs.python.org/issue39033
2020-01-14 03:39:19 -08:00
Miss Islington (bot) 33e033da3c
bpo-39235: Fix end location for genexp in call args (GH-17925)
The fix changes copy_location() to require an extra node from which to extract the end location, and fixing all 5 call sites.

https://bugs.python.org/issue39235
(cherry picked from commit a796d8ef9d)

Co-authored-by: Guido van Rossum <guido@python.org>
2020-01-09 11:39:00 -08:00
Miss Islington (bot) a9a43c221b
bpo-29778: Fix incorrect NULL check in _PyPathConfig_InitDLLPath() (GH-17818)
(cherry picked from commit 7b79dc9200)

Co-authored-by: Anthony Wee <awee@box.com>
2020-01-06 09:17:36 -08:00
Miss Islington (bot) 49c108c832
Fix constant folding optimization for positional only arguments (GH-17837)
(cherry picked from commit b121a4a45f)

Co-authored-by: Anthony Sottile <asottile@umich.edu>
2020-01-05 09:21:47 -08:00
Miss Islington (bot) 859525590c
Fix SystemError when nested function has annotation on positional-only argument (GH-17826)
(cherry picked from commit ec007cb43f)

Co-authored-by: Anthony Sottile <asottile@umich.edu>
2020-01-04 18:14:58 -08:00
Miss Islington (bot) 10dc738bda
Bring Python into the next decade. (GH-17801)
(cherry picked from commit 946b29ea0b)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2020-01-02 19:15:37 -08:00
Miss Islington (bot) 6c004955ac bpo-39176: Improve error message for 'named assignment' (GH-17777) (GH-17778)
(cherry picked from commit 37143a8e3b)

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2019-12-31 21:28:08 -06:00
Miss Islington (bot) a278ae19b4
closes bpo-37446: resolve undefined behavior in Python/hamt.c (GH-17727)
(cherry picked from commit d0c92e81aa)

Co-authored-by: Batuhan Taşkaya <47358913+isidentical@users.noreply.github.com>
2019-12-30 18:51:18 -08:00
Pablo Galindo b1f2044710 [3.8] bpo-39080: Starred Expression's column offset fix when inside a CALL (GH-17645) (GH-17649)
… 
Co-Authored-By: Pablo Galindo <Pablogsal@gmail.com>
(cherry picked from commit 50d4f12958)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>





https://bugs.python.org/issue39080
2019-12-17 17:41:58 -08:00
Miss Islington (bot) cd968dea28
The comment in ast_for_namedexpr shouldn't include if_stmt (GH-17586)
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit b08d3f71be)

Co-authored-by: Guido van Rossum <guido@python.org>
2019-12-15 12:04:07 -08:00
Miss Islington (bot) ce333cd7d5 Fix elif start column offset when there is an else following (GH-17596) (GH-17600)
(cherry picked from commit 5936a4ce91)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2019-12-14 10:43:42 +00:00
Miss Islington (bot) 4a5db78c9a Add PYTHONUTF8 to commandline usage. (GH-17587)
Co-Authored-By: Victor Stinner <vstinner@python.org>
(cherry picked from commit 95826c773a)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2019-12-14 19:38:35 +09:00
Miss Islington (bot) 3b18b17efc bpo-39031: Include elif keyword when producing lineno/col-offset info for if_stmt (GH-17582) (GH-17589)
When parsing an "elif" node, lineno and col_offset of the node now point to the "elif" keyword and not to its condition, making it consistent with the "if" node.

https://bugs.python.org/issue39031

Automerge-Triggered-By: @pablogsal
(cherry picked from commit 025a602af7)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2019-12-13 16:21:54 +00:00
Miss Islington (bot) c93d68bbb9
bpo-39008: Require Py_ssize_t for PySys_Audit formats rather than raise a deprecation warning (GH-17540)
(cherry picked from commit b8cbe74c34)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-12-09 11:22:30 -08:00
Miss Islington (bot) 960fca1a58
bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497)
now contextvars.ContextVar "__class_getitem__" method returns ContextVar class, not None.

https://bugs.python.org/issue38979

Automerge-Triggered-By: @asvetlov
(cherry picked from commit 28c91631c2)

Co-authored-by: AMIR <31338382+amiremohamadi@users.noreply.github.com>
2019-12-08 04:49:07 -08:00
Steve Dower b74a6f14b9
bpo-38920: Add audit hooks for when sys.excepthook and sys.unraisablehook are invoked (GH-17392)
Also fixes some potential segfaults in unraisable hook handling.
2019-11-28 08:46:23 -08:00
Miss Islington (bot) 2ea4c37c1e
bpo-38823: Fix refleak in marshal init error path (GH-17260)
(cherry picked from commit 33b671e724)

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2019-11-20 02:16:02 -08:00
Miss Islington (bot) 4c22e1665c
closes bpo-37633: Reëxport some function compatibility wrappers for macros in ``pythonrun.h``. (GH-17056)
(cherry picked from commit 62161ce989)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2019-11-04 21:52:59 -08:00
Miss Skeleton (bot) dcb338ea1b
bpo-38640: Allow break and continue in always false while loops (GH-16992)
(cherry picked from commit 6c3e66a34b)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-10-30 05:11:41 -07:00
Miss Skeleton (bot) ba3a566328
bpo-38535: Fix positions for AST nodes for calls without arguments in decorators. (GH-16861)
(cherry picked from commit 26ae9f6d3d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-10-26 07:06:40 -07:00
Miss Skeleton (bot) edf9e8e98a
Fix typo in formatter_unicode (GH-16831)
numbers's -> number's
(cherry picked from commit 7320ec05f7)

Co-authored-by: Hansraj Das <raj.das.136@gmail.com>
2019-10-25 10:03:23 -07:00
Miss Skeleton (bot) b1fc8c0c8a
bpo-38540: Fix possible leak in PyArg_Parse for "esGH-" and "etGH-". (GH-16869)
(cherry picked from commit 5bc6a7c06e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-10-21 02:12:37 -07:00
Miss Islington (bot) 8ca282f12a
Typo fix - implemention should be implementation (GH-16806)
(cherry picked from commit 2798b60c55)

Co-authored-by: Hansraj Das <raj.das.136@gmail.com>
2019-10-15 14:09:19 -07:00
Miss Islington (bot) 927f07c816 bpo-38469: Handle named expression scope with global/nonlocal keywords (GH-16755) (#16760)
The symbol table handing of PEP572's assignment expressions is not resolving correctly the scope of some variables in presence of global/nonlocal keywords in conjunction with comprehensions.
(cherry picked from commit fd5c414880)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-10-14 13:40:15 +02:00
Miss Islington (bot) a04c7ebcb9
Correct signature of __build_class__ (GH-16735)
(cherry picked from commit e3babbd03c)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-10-13 08:53:54 -07:00
Benjamin Peterson 380eb427dd
[3.8] Typo fix: "throuhgh" should be "through". (GH-16713)
(cherry picked from commit a8e0d3141e)

Co-authored-by: Hansraj Das <raj.das.136@gmail.com>
2019-10-10 21:02:38 -07:00
Miss Islington (bot) 6b6935e563
bpo-38425: Fix ‘res’ may be used uninitialized warning (GH-16688)
(cherry picked from commit a05fcd3c7a)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2019-10-10 01:00:19 -07:00
Miss Islington (bot) d8071cbf5b
Typo fix: "empy" should be "empty". (GH-16666)
(cherry picked from commit 01171ebd96)

Co-authored-by: Hansraj Das <raj.das.136@gmail.com>
2019-10-08 19:42:22 -07:00
Miss Islington (bot) aa9d5b8ec3
Fix typo in _warnings.warn_explicit() docstring (GH-16625)
(cherry picked from commit 5dfbb4d503)

Co-authored-by: Hansraj Das <raj.das.136@gmail.com>
2019-10-08 02:16:06 -07:00
Miss Islington (bot) d49f096cc4
bpo-38304: PyConfig_InitPythonConfig() cannot fail anymore (GH-16509)
PyConfig_InitPythonConfig() and PyConfig_InitIsolatedConfig() no
longer return PyStatus: they cannot fail anymore.
(cherry picked from commit 8462a4936b)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-10-01 03:26:04 -07:00
Victor Stinner bdace21b76 bpo-38304: Remove PyConfig.struct_size (GH-16500)
For now, we'll rely on the fact that the config structures aren't covered by the stable ABI.

We may revisit this in the future if we further explore the idea of offering a stable embedding API.
2019-10-01 08:46:42 +10:00