Commit Graph

6279 Commits

Author SHA1 Message Date
Miss Islington (bot) 05abf2a61c
Fix -Wstrict-prototypes warning in thread_pthread.h. (GH-21477)
(cherry picked from commit ea62a4bd54)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2020-07-15 12:04:59 -07:00
Miss Islington (bot) 41db8ffc59
bpo-41218: Only mark async code with CO_COROUTINE. (GH-21357)
3.8.3 had a regression where compiling with
ast.PyCF_ALLOW_TOP_LEVEL_AWAIT woudl agressively mark things are
coroutine even if there were not.
(cherry picked from commit bd46174a5a)

Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
2020-07-06 14:44:16 -07:00
Miss Islington (bot) aa7f775614
bpo-29778: Ensure python3.dll is loaded from correct locations when Python is embedded (GH-21297) (GH-21352)
Also enables using debug build of `python3_d.dll`
Reference: CVE-2020-15523
(cherry picked from commit dcbaa1b49c)

Co-authored-by: Steve Dower <steve.dower@python.org>
2020-07-06 19:12:16 +02:00
Steve Dower b9e288cc1b
bpo-41162: Clear audit hooks later during finalization (GH-21222)
Co-authored-by: Konge <zkonge@outlook.com>
2020-07-04 00:04:22 +01:00
Miss Islington (bot) c1d916595e
bpo-41180: Audit code.__new__ when unmarshalling (GH-21271)
(cherry picked from commit d160e0f8e2)

Co-authored-by: tkmikan <36260601+tkmikan@users.noreply.github.com>
2020-07-03 14:13:29 -07:00
Guido van Rossum e653369e76
[3.8] bpo-35975: Only use cf_feature_version if PyCF_ONLY_AST in cf_flags (#21023) 2020-06-27 17:35:05 -07:00
Lysandros Nikolaou 749d3bc041
[3.8] bpo-41132: Use pymalloc allocator in the f-string parser (GH-21173) (GH-21184)
Automerge-Triggered-By: @pablogsal
2020-06-27 11:43:41 -07:00
Miss Islington (bot) 1813d318fd
bpo-41094: Fix decoding errors with audit when open files. (GH-21095)
(cherry picked from commit 6c6810d989)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-06-24 09:45:38 -07:00
Miss Islington (bot) d5ee9b9940
bpo-41056: Fix reference to deallocated stack in pathconfig (Coverity) (GH-21013)
Reported by Coverity.  (CID 1457554 RETURN_LOCAL)

path0 is assigned as a pointer to this right before it goes out of scope.
(cherry picked from commit 81328f3070)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2020-06-22 00:43:41 -07:00
Miss Islington (bot) a8936fa5c0
bpo-40957: Fix refleak in _Py_fopen_obj() (GH-20827)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 9672912e8f)

Co-authored-by: Christian Heimes <christian@python.org>
2020-06-13 09:15:05 -07:00
Miss Islington (bot) 26db10a431
bpo-40834: Fix truncate when sending str object with channel (GH-20555)
(cherry picked from commit 29c117202e)

Co-authored-by: An Long <aisk@users.noreply.github.com>
2020-06-13 05:44:50 -07:00
Miss Islington (bot) 83a9ba4426
bpo-40870: Invalidate usage of some constants with ast.Name (GH-20649)
(cherry picked from commit 68874a8502)

Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2020-06-06 10:04:47 -07:00
Shantanu f7ed4d4e83
bpo-40614: Respect feature version for f-string debug expressions (GH-20196) (GH-20466)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
(cherry picked from commit c116c94ff1)
2020-06-06 11:08:48 +01:00
Miss Islington (bot) 907ee1f14a
bpo-36290: Fix keytword collision handling in AST node constructors (GH-12382)
(cherry picked from commit c73914a562)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
2020-05-24 14:31:47 -07:00
Batuhan Taskaya a4d219b35e
[3.8] bpo-40663: Correctly handle annotations with subscripts in ast_unparse.c (GH-20156). (GH-20191)
(cherry picked from commit 2135e10dc7)

Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
2020-05-22 23:32:40 +01:00
Miss Islington (bot) 460eac20a6
bpo-35890: Use RegQueryInfoKeyW and CryptAcquireContextW explicitly (GH-19974)
(cherry picked from commit 98e42d1f88)

Co-authored-by: Minmin Gong <gongminmin@msn.com>
2020-05-18 10:09:59 -07:00
Miss Islington (bot) ab9d9535aa
bpo-40650: Include winsock2.h in pytime.c, instead of a full windows.h (GH-20137)
(cherry picked from commit f660567937)

Co-authored-by: Minmin Gong <gongminmin@msn.com>
2020-05-18 09:42:14 -07:00
Miss Islington (bot) c3d025a86a
bpo-40636: Clarify the zip built-in docstring. (GH-20118)
Clarify the zip built-in docstring.

This puts much simpler text up front along with an example.

As it was, the zip built-in docstring was technically correct.  But too
technical for the reader who shouldn't _need_ to know about `__next__` and
`StopIteration` as most people do not need to understand the internal
implementation details of the iterator protocol in their daily life.

This is a documentation only change, intended to be backported to 3.8; it is
only tangentially related to PEP-618 which might offer new behavior options
in the future.

Wording based a bit more on enumerate per Brandt's suggestion.

This gets rid of the legacy wording paragraph which seems too tied to
implementation details of the iterator protocol which isn't relevant here.

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
(cherry picked from commit 6a5d3ff676)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2020-05-15 14:43:27 -07:00
Miss Islington (bot) bce4ddafdd
bpo-40527: Fix command line argument parsing (GH-19955)
(cherry picked from commit 2668a9a5aa)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-05-06 06:43:09 -07:00
Robert Rouhani a32587a60d
[3.8] bpo-40417: Fix deprecation warning in PyImport_ReloadModule (GH-19750) (GH-19934)
Automerge-Triggered-By: @brettcannon.
(cherry picked from commit f40bd466bf)

Co-authored-by: Robert Rouhani <robert.rouhani@gmail.com>
2020-05-05 17:32:14 -07:00
Miss Islington (bot) 1205afb3e1
bpo-40412: Nullify inittab_copy during finalization (GH-19746)
Otherwise we leave a dangling pointer to free'd memory. If we
then initialize a new interpreter in the same process and call
PyImport_ExtendInittab, we will (likely) crash when calling
PyMem_RawRealloc(inittab_copy, ...) since the pointer address
is bogus.

Automerge-Triggered-By: @brettcannon
(cherry picked from commit 64224a4727)

Co-authored-by: Gregory Szorc <gregory.szorc@gmail.com>
2020-05-01 16:06:23 -07:00
Pablo Galindo 5055c274c6
[3.8] bpo-39562: Prevent collision of future and compiler flags (GH-19230) (GH-19835)
The constant values of future flags in the __future__ module
is updated in order to prevent collision with compiler flags.
Previously PyCF_ALLOW_TOP_LEVEL_AWAIT was clashing
with CO_FUTURE_DIVISION..
(cherry picked from commit 4454057269)

Co-authored-by: Batuhan Taşkaya <batuhanosmantaskaya@gmail.com>
2020-05-01 07:18:27 -07:00
Victor Stinner d9df63deab
bpo-40048: Fix _PyCode_InitOpcache() error path (GH-19691) (GH-19698)
If _PyCode_InitOpcache() fails in _PyEval_EvalFrameDefault(), use
"goto exit_eval_frame;" rather than "return NULL;" to exit the
function in a consistent state. For example, tstate->frame is now
reset properly.

(cherry picked from commit 25104949a5)
2020-04-24 03:07:20 +02:00
Benjamin Peterson 4115550754
[3.8] closes bpo-40184: Only define pysiphash if the hash algorithm is SIPHASH24. (GH-19373)
(cherry picked from commit 1b21573)

Co-authored-by: Batuhan Taşkaya <batuhanosmantaskaya@gmail.com>
2020-04-04 16:46:54 -05:00
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