Commit Graph

26150 Commits

Author SHA1 Message Date
Miss Islington (bot) 0f1748d66e
gh-78630: Drop invalid HP aCC compiler switch -fPIC on HP-UX (GH-8847)
At compile time, '+z' is already properly used with HP aCC, and shared
libraries are correctly linked with '+b'. The '-fPIC' switch can safely be
dropped.
(cherry picked from commit 09be18a73d)

Co-authored-by: Michael Osipov <michael.osipov@siemens.com>
2022-05-19 09:51:08 -07:00
Miss Islington (bot) 4d1e243fca
bpo-45393: help() on operator precedence has misleading entries (GH-31246) (GH-92965)
(cherry picked from commit fb082c2fc5)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2022-05-19 17:40:49 +02:00
Miss Islington (bot) 71cdf6a38a
gh-92675: venv: Fix ensure_directories() to again accept a Path for env_dir (GH-92676)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
(cherry picked from commit 30deeac649)

Co-authored-by: David Foster <david@dafoster.net>
2022-05-19 08:17:28 -07:00
Miss Islington (bot) 7afccd34a6
gh-90473: Decrease recursion limit and skip tests on WASI (GH-92803)
(cherry picked from commit 137fd3d88a)

Co-authored-by: Christian Heimes <christian@python.org>
2022-05-19 08:05:52 -07:00
Miss Islington (bot) ad2363d54c
gh-92670: Skip test_shutil.TestCopy.test_copyfile_nonexistent_dir on AIX (GH-92718)
(cherry picked from commit 654032ac5f)

Co-authored-by: Ayappan Perumal <ayappap2@in.ibm.com>
2022-05-19 02:50:39 -07:00
Miss Islington (bot) aa55985aa8
gh-87901: Remove the encoding argument from os.popen (GH-92836)
(cherry picked from commit 96f65835f8)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2022-05-18 20:12:47 -07:00
Miss Islington (bot) 9a61afec20
bpo-40838: document `getdoc`, `getmodule`, `getsourcefile` in `inspect` returns `None` (GH-30575)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit b86d783a4e)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-05-17 18:41:55 -07:00
Miss Islington (bot) 36da1a77c6
gh-92841: Fix asyncio's RuntimeError: Event loop is closed (GH-92842)
(cherry picked from commit 33880b4b1c)

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2022-05-17 15:59:29 -07:00
Miss Islington (bot) 38d95b5500
[3.11] gh-92530: Fix an issue that occurred after interrupting threading.Condition.notify (GH-92534) (GH-92829)
If Condition.notify() was interrupted just after it released the waiter lock,
but before removing it from the queue, the following calls of notify() failed
with RuntimeError: cannot release un-acquired lock.
(cherry picked from commit 70af994fee)


Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

Automerge-Triggered-By: GH:serhiy-storchaka
2022-05-17 09:45:40 -07:00
Miss Islington (bot) 52e6596fb5
gh-92671: Don't omit parentheses when unparsing empty tuples (GH-92673)
(cherry picked from commit f6fd8aac13)

Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2022-05-16 06:01:34 -07:00
Victor Stinner a3d2ce95d1
gh-92781: Avoid mixing declarations and code in C API (#92783) (#92813)
Avoid mixing declarations and code in the C API to fix the compiler
warning: "ISO C90 forbids mixed declarations and code"
[-Werror=declaration-after-statement].

(cherry picked from commit 90e7230073)
2022-05-16 13:19:52 +02:00
Miss Islington (bot) 2bcae11302
gh-90473: Fail subprocess early on Emscripten/WASI (GH-92802)
(cherry picked from commit db0b455ff4)

Co-authored-by: Christian Heimes <christian@python.org>
2022-05-14 11:47:17 -07:00
Miss Islington (bot) dae3e2fea3
Check result of utc_to_seconds and skip fold probe in pure Python (GH-91582)
The `utc_to_seconds` call can fail, here's a minimal reproducer on
Linux:

TZ=UTC python -c "from datetime import *; datetime.fromtimestamp(253402300799 + 1)"

The old behavior still raised an error in a similar way, but only
because subsequent calculations happened to fail as well. Better to fail
fast.

This also refactors the tests to split out the `fromtimestamp` and
`utcfromtimestamp` tests, and to get us closer to the actual desired
limits of the functions. As part of this, we also changed the way we
detect platforms where the same limits don't necessarily apply (e.g.
Windows).

As part of refactoring the tests to hit this condition explicitly (even
though the user-facing behvior doesn't change in any way we plan to
guarantee), I noticed that there was a difference in the places that
`datetime.utcfromtimestamp` fails in the C and pure Python versions, which
was fixed by skipping the "probe for fold" logic for UTC specifically —
since UTC doesn't have any folds or gaps, we were never going to find a
fold value anyway. This should prevent some failures in the pure python
`utcfromtimestamp` method on timestamps close to 0001-01-01.

There are two separate news entries for this because one is a
potentially user-facing change, the other is an internal code
correctness change that, if anything, changes some error messages. The
two happen to be coupled because of the test refactoring, but they are
probably best thought of as independent changes.

Fixes GH-91581
(cherry picked from commit 83c0247d47)

Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
2022-05-14 07:59:52 -07:00
Miss Islington (bot) d9089c0e8b
GH-92804: Fix memory leak in memoryview iterator (gh-92805)
(cherry picked from commit d923fdf54b)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-05-14 07:55:03 -07:00
Miss Islington (bot) 2e8b2d0ee2
GH-92236: Remove spurious "line" event when starting coroutine or generator. (GH-92722) (GH-92772)
(cherry picked from commit 22a1db378c)
2022-05-13 11:52:54 +01:00
Miss Islington (bot) c41667e71b
gh-90473: Increase stack size, disable obmalloc on WASI (GH-92732)
(cherry picked from commit d81d57e959)

Co-authored-by: Christian Heimes <christian@python.org>
2022-05-13 00:00:33 -07:00
Miss Islington (bot) 5a33643dce
bpo-42627: Fix incorrect parsing of Windows registry proxy settings (GH-26307)
(cherry picked from commit b69297ea23)

Co-authored-by: 狂男风 <CrazyBoyFeng@Live.com>
2022-05-11 11:41:53 -07:00
Miss Islington (bot) 20fec2c265
[3.11] gh-91810: ElementTree: Use text file's encoding by default in XML declaration (GH-91903) (GH-92663)
ElementTree method write() and function tostring() now use the text file's
encoding ("UTF-8" if not available) instead of locale encoding in XML
declaration when encoding="unicode" is specified.
(cherry picked from commit 707839b0fe)


Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

Automerge-Triggered-By: GH:serhiy-storchaka
2022-05-11 10:36:52 -07:00
Miss Islington (bot) 5135b6ed73
gh-92550: Fix pathlib.Path.rglob() for empty pattern (GH-92604)
(cherry picked from commit 87f849c775)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-05-10 22:13:11 -07:00
Miss Islington (bot) 951cfc8e54
Fix inconsistent return type for statistics median_grouped() gh-92531 (GH-92533) (#92656) 2022-05-10 23:45:17 -05:00
Serhiy Storchaka 5197134c1c
Revert "gh-92550 - Fix regression in `pathlib.Path.rglob()` (GH-92583)" (GH-92599)
This reverts commit a51baec9ce.
2022-05-11 07:14:40 +03:00
Miss Islington (bot) 6a17cdebe9
gh-92619: Fix bug where the compiler duplicates exit blocks unnecessarily (GH-92620) (GH-92621)
(cherry picked from commit 7c6b7ade8d)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2022-05-10 22:01:17 +01:00
Miss Islington (bot) 7540a432ce
gh-92261: Disallow iteration of Union (and other special forms) (GH-92262) (GH-92582)
(cherry picked from commit 4739997e14)

Co-authored-by: Matthew Rahtz <matthew.rahtz@gmail.com>
2022-05-10 08:39:31 +03:00
Miss Islington (bot) 74c094d804
bpo-13553: Document tkinter.Tk args (GH-4786)
(cherry picked from commit c56e2bb994)

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
2022-05-09 21:17:57 -07:00
Miss Islington (bot) a51baec9ce
gh-92550 - Fix regression in `pathlib.Path.rglob()` (GH-92583)
We could try to remedy this by taking a slice, but we then run into an issue where the empty string will match altsep on POSIX. That rabbit hole could keep getting deeper.

A proper fix for the original issue involves making pathlib's path normalisation more configurable - in this case we want to retain trailing slashes, but in other we might want to preserve `./` prefixes, or elide `../` segments when we're sure we won't encounter symlinks.

This reverts commit ea2f5bcda1.
(cherry picked from commit dcdf250d2d)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2022-05-09 17:39:43 -07:00
Miss Islington (bot) a86229e824
bpo-46907: Update Windows installer to SQLite 3.38.4. (GH-92322)
(cherry picked from commit 22bddc864d)

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-05-09 15:07:29 -07:00
Miss Islington (bot) 2f46cf637f
bpo-38056: overhaul Error Handlers section in codecs documentation (GH-15732)
* Some handlers were wrongly described as text-encoding only, but actually they can also be used in text-decoding.
* Add more description to each handler.
* Add two REPL examples.
* Add indexes for Error Handler's name.

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 5bc2390229)

Co-authored-by: Ma Lin <animalize@users.noreply.github.com>
2022-05-08 20:13:45 -07:00
Miss Islington (bot) 4270b7927d
gh-90622: Do not spawn ProcessPool workers on demand via fork method. (GH-91598) (#92495)
Do not spawn ProcessPool workers on demand when they spawn via fork.

This avoids potential deadlocks in the child processes due to forking from
a multithreaded process.
(cherry picked from commit ebb37fc3fd)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-05-08 10:14:14 -07:00
Miss Islington (bot) c63c8ac238
bpo-45046: Support context managers in unittest (GH-28045)
Add methods enterContext() and enterClassContext() in TestCase.
Add method enterAsyncContext() in IsolatedAsyncioTestCase.
Add function enterModuleContext().
(cherry picked from commit 086c6b1b0f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-05-08 08:12:19 -07:00
Miss Islington (bot) d0d22ca9fb
gh-92448: Update the documentation builder to render the GitHub issue. (GH-92449)
(cherry picked from commit 45e1721d10)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2022-05-08 06:05:01 -07:00
Pablo Galindo 0e5fe7f9e9
Python 3.11.0b1 2022-05-06 23:53:50 +01:00
Brandt Bucher 3f61db4756
gh-90997: Move `CACHE` handling into `_unpack_opargs` (#92409)
* Move CACHE handling into _unpack_opargs

* Remove auto-added import

* blurb add
2022-05-06 18:57:08 +01:00
larryhastings 5021064390
gh-92203: Add closure support to exec(). (#92204)
Add a closure keyword-only parameter to exec(). It can only be specified when exec-ing a code object that uses free variables. When specified, it must be a tuple, with exactly the number of cell variables referenced by the code object. closure has a default value of None, and it must be None if the code object doesn't refer to any free variables.
2022-05-06 10:09:35 -07:00
Brandt Bucher 93a666b5a5
gh-90997: Show cached inline values in `dis` output (#92360) 2022-05-06 15:18:09 +01:00
Serhiy Storchaka 15dbe8570f
gh-91827: Add method info_pathlevel() in tkinter (GH-91829) 2022-05-06 13:50:38 +03:00
Alex Waygood 6f18b86fda
gh-92332: Docs-only deprecation of `typing.Text` (GH-92351)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-05-06 18:15:18 +08:00
Raymond Hettinger ebaf0945f9
GH-89519: Deprecate classmethod descriptor chaining (#92379) 2022-05-06 02:57:53 -05:00
Ethan Furman 93364f9716
gh-78157: [Enum] nested classes will not be members in 3.13 (GH-92366)
- add member() and nonmember() functions
- add deprecation warning for internal classes in enums not
  becoming members in 3.13

Co-authored-by: edwardcwang
2022-05-06 00:16:22 -07:00
Gregory P. Smith fa4f0a134e
gh-90622: Prevent max_tasks_per_child use with a fork mp_context. (#91587)
Prevent `max_tasks_per_child` use with a "fork" mp_context to avoid deadlocks.

Also defaults to "spawn" when no mp_context is supplied for safe convenience.
2022-05-06 00:04:53 -07:00
Inada Naoki 2b563f1ad3
gh-87901: Add encoding to os.popen (GH-92374) 2022-05-06 14:48:36 +09:00
Mariusz Felisiak 926854e858
bpo-46907: Update macOS installer to SQLite 3.38.4. (GH-32148) 2022-05-06 00:59:32 -04:00
Inada Naoki 9b491ae04c
NEWS: Reorder items by section (GH-92373)
They caused duplicated sections.
2022-05-06 13:58:58 +09:00
Alexey Izbyshev 85354ed78c
gh-92112: Fix crash triggered by an evil custom `mro()` (#92113) 2022-05-05 21:01:15 -07:00
Michael Droettboom adcb6a6055
gh-92356: Fix regression in ctypes function call overhead (#92357)
38f331d introduced a delayed initialization routine to set up
ctypes formattable (`_ctypes_init_fielddesc`), but inadvertently
removed setting the `initialization` flag to 1 to avoid initting
each time.
2022-05-05 20:59:45 -07:00
Victor Stinner 299692afd8
gh-88279: Deprecate PySys_SetArgvEx() (#92363)
Deprecate the following C functions:

* PySys_SetArgv()
* PySys_SetArgvEx()
* PySys_SetPath()
2022-05-06 05:24:29 +02:00
Paul Ganssle 1303f8c927
gh-80010: Expand fromisoformat to include most of ISO-8601 (#92177)
This expands `fromisoformat` to cover most of the common uses of ISO 8601. We may expand the scope more in the future.
2022-05-05 18:31:24 -06:00
Victor Stinner ada8b6d1b1
gh-57684: Add -P cmdline option and PYTHONSAFEPATH env var (#31542)
Add the -P command line option and the PYTHONSAFEPATH environment
variable to not prepend a potentially unsafe path to sys.path.

* Add sys.flags.safe_path flag.
* Add PyConfig.safe_path member.
* Programs/_bootstrap_python.c uses config.safe_path=0.
* Update subprocess._optim_args_from_interpreter_flags() to handle
  the -P command line option.
* Modules/getpath.py sets safe_path to 1 if a "._pth" file is
  present.
2022-05-06 01:34:11 +02:00
Gregory P. Smith f6dd14c653
gh-82616: Add process_group support to subprocess.Popen (#23930)
One more thing that can help prevent people from using `preexec_fn`.

Also adds conditional skips to two tests exposing ASAN flakiness on the Ubuntu 20.04 Address Sanitizer Github CI system. When that build is run on more modern systems the "problem" does not show up. It seems ASAN implementation related.

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-05-05 16:22:32 -07:00
cibofo 9a0a7b4868
gh-91996: Add an HTTPMethod StrEnum to http (GH-91997)
* Add HTTPMethod enum to http

Create a StrEnum for the 9 common HTTP methods.

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2022-05-05 15:39:02 -07:00
Christian Heimes 8122e8d501
gh-92345: Import rlcompleter before sys.path is extended (#92346)
``pymain_run_python()`` now imports ``readline`` and ``rlcompleter``
before sys.path is extended to include the current working directory of
an interactive interpreter. Non-interactive interpreters are not
affected.

Also move imports of ``re`` and ``keyword`` module to top level so they
are materialized early, too. The ``keyword`` module is trivial and the
``re`` is already imported via ``inspect`` -> ``linecache``.
2022-05-05 21:24:16 +02:00