Commit Graph

123069 Commits

Author SHA1 Message Date
Terry Jan Reedy 58753f33e4
gh-78889: Stop IDLE Shell freezes from sys.stdout.shell.xyz (#121876)
Problem occurred when attribute xyz could not be pickled.
Since this is not trivial to selectively fix, block all
attributes (other than 'width').  IDLE does not access them
and they are private implementation details.
2024-07-17 09:33:33 -04:00
Bénédikt Tran 6682d91678
gh-119698: fix a special case in `symtable.Class.get_methods` (#121802) 2024-07-17 06:27:35 -07:00
Petr Viktorin cffad5c6ef
gh-121863: Immortalize names in code objects to avoid crash (GH-121903) 2024-07-17 11:31:28 +02:00
Victor Stinner bfdbeac355
gh-121849: Fix PyUnicodeWriter_WriteSubstring() crash if len=0 (#121896)
Do nothing if start=end.
2024-07-17 10:26:05 +02:00
Rafael Fontenelle 5d98a4d266
Remove duplicate "it" in whatsnew 3.13 (#121580) 2024-07-17 00:31:21 -07:00
Michael dc9cc91f76
Fix Several Typos in Readme & Tests (#121559) 2024-07-17 00:24:35 -07:00
sobolevn 72dccd6073
gh-121834: Improve `complex` C-API docs (#121835)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-07-17 10:01:28 +03:00
sobolevn f6c7d8d79c
gh-121842: Improve coverage of `PyBytes_FromStringAndSize` (#121843) 2024-07-17 10:00:07 +03:00
Wulian233 37611171af
gh-121453: Update the `Doc/templates/download.html` download files size estimates and support download `.texi` format. (#121454)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-07-17 00:20:55 -06:00
Bernhard M. Wiedemann 941b3b7f44
gh-121871: Allow overriding docs build date with SOURCE_DATE_EPOCH (#121872) 2024-07-16 23:34:00 -06:00
Michael Droettboom f036a463db
GH-121583: Remove dependency from pystats.h to internal header file (GH-121587)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-07-16 15:38:29 -07:00
Zachary Ware 4e35dd607b
gh-83648: Use versionadded in 'deprecated' description (GH-121877) 2024-07-16 21:26:17 +00:00
Brett Cannon f589f263bc
GH-120371: Add WASI SDK 22 support (GH-121870)
Required disabling stub functions now provided by wasi-libc.
2024-07-16 20:00:39 +00:00
Tian Gao e65cb4c6f0
gh-118934: Make PyEval_GetLocals return borrowed reference (#119769)
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-07-16 12:17:47 -07:00
Sam Gross 162b41f577
gh-121860: Fix crash when materializing managed dict (#121866)
The object's inline values may be marked invalid if the materialized
dict was already initialized and then deleted.
2024-07-16 14:58:36 -04:00
Pablo Galindo Salgado c46d64e0ef
gh-121130: Fix f-string format specifiers with debug expressions (#121150) 2024-07-16 19:57:22 +01:00
Ken Jin 69c68de43a
gh-121621: Move asyncio running loop to thread state (GH-121695) 2024-07-17 01:09:58 +08:00
Andreas Stocker 8f2532168b
gh-59022: Added tests for `pkgutil.extend_path` (#59022) (GH-121673)
This adds tests for the documented behaviour of `pkgutil.extend_path`
regarding different argument types as well as for `*.pkg` files.
2024-07-16 17:14:26 +02:00
Petr Viktorin 263c7e611b
gh-121160: Add some tests for readline.set_history_length (GH-121326) 2024-07-16 16:09:08 +02:00
Petr Viktorin b4aedb23ae
gh-113993: Don't immortalize in PyUnicode_InternInPlace; keep immortalizing in other API (#121364)
* Switch PyUnicode_InternInPlace to _PyUnicode_InternMortal, clarify docs

* Document immortality in some functions that take `const char *`

This is PyUnicode_InternFromString;
PyDict_SetItemString, PyObject_SetAttrString;
PyObject_DelAttrString; PyUnicode_InternFromString;
and the PyModule_Add convenience functions.

Always point out a non-immortalizing alternative.

* Don't immortalize user-provided attr names in _ctypes
2024-07-16 15:36:21 +02:00
Alyssa Coghlan d7a099d7ae
GH-105879: Note exec/eval keyword change in What's New (GH-121831) 2024-07-16 13:24:45 +00:00
Petr Viktorin 956270d08d
gh-113993: For string interning, do not rely on (or assert) _Py_IsImmortal (GH-121358)
Older stable ABI extensions are allowed to make immortal objects mortal.
Instead, use `_PyUnicode_STATE` (`interned` and `statically_allocated`).
2024-07-16 15:17:29 +02:00
Sviatoslav Sydorenko (Святослав Сидоренко) a0b205bba5
🧪🚑 Fix using `check_source` flags as bool (#121848) 2024-07-16 12:50:30 +00:00
Ned Deily f27593a87c
gh-120522: Revert "Add a `--with-app-store-compliance` configure option to patch out problematic code" (gh-120984) (#121844)
This reverts commit 48cd104b0c prior
to the release of 3.13.0b4 to allow for additional review time.
2024-07-16 06:49:36 -04:00
Lysandros Nikolaou 8549559f38
gh-120317: Lock around global state in the tokenize module (#120318)
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2024-07-16 11:35:57 +02:00
sobolevn 8b6d475581
gh-121791: Check for `NULL` in `MethodDescriptor2_new` in `_testcapi` (#121792) 2024-07-16 11:29:33 +03:00
edson duarte 1755df7b3b
gh-85453: Fix 'timezone' vs. 'time zone' spelling issues in datetime.rst (#118449) 2024-07-16 10:17:00 +02:00
Russell Keith-Magee 7e91e0dcfe
gh-120831: Increase the default minimum supported iOS version to 13.0 (#121250)
Increases the default minimum iOS version to 13.0.

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-07-16 12:23:35 +08:00
Donghee Na 2bac2b86b1
gh-121403: Add notes for PyList_GetXXX APIs about the need for init (gh-121626) 2024-07-16 10:16:41 +09:00
Marta Gómez Macías 498a94c198
gh-121295: Fix blocked console after interrupting a long paste (GH-121815) 2024-07-16 01:38:54 +02:00
saucoide 7d111dac16
gh-121610: pyrepl - handle extending blocks when multi-statement blocks are pasted (GH-121757)
console.compile with the "single" param throws an exception when
there are multiple statements, never allowing to adding newlines
to a pasted code block (gh-121610)

This add a few extra checks to allow extending when in an indented
block, and tests for a few examples

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-16 01:33:57 +02:00
Tian Gao 2b1b68939b
gh-121814: Only check f_trace_opcodes if Python frame exists (#121818)
Co-authored-by: Matt Wozniski <godlygeek@gmail.com>
2024-07-15 16:11:02 -07:00
Sam Gross 4134261ab8
gh-121605: Fix test hang when pyrepl is not available (GH-121820)
The fallback repl does not support "exit" without parentheses, so the
test would hang until the timeout expired.
2024-07-16 00:50:16 +02:00
Milan Oberkirch e5c7216f37
gh-121790: Fix interactive console initialization (#121793)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-16 00:24:18 +02:00
Sam Gross d23be3947c
gh-121794: Don't set `ob_tid` to zero in fast-path dealloc (#121799)
We should maintain the invariant that a zero `ob_tid` implies the
refcount fields are merged.

* Move the assignment in `_Py_MergeZeroLocalRefcount` to immediately
  before the refcount merge.
* Update `_PyTrash_thread_destroy_chain` to set `ob_ref_shared` to
  `_Py_REF_MERGED` when setting `ob_tid` to zero.

Also check this invariant with assertions in the GC in debug builds.
That uncovered a bug when running out of memory during GC.
2024-07-15 17:50:10 -04:00
Sam Gross 82a4dac9f6
gh-117657: Skip tests that fork with threads under TSan (#121599)
This avoids messages like:

  ThreadSanitizer: starting new threads after multi-threaded fork is not
  supported. Dying (set die_after_fork=0 to override)
2024-07-15 16:43:51 -04:00
Sergey B Kirpichev 05d413764c
gh-121245: Refactor site.register_readline() (GH-121659)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-15 22:12:41 +02:00
Eric Snow 8b209fd4f8
gh-76785: Expand How Interpreter Channels Handle Interpreter Finalization (gh-121805)
See 6b98b274b6 for an explanation of the problem and solution.  Here I've applied the solution to channels.
2024-07-15 19:43:59 +00:00
Sergey B Kirpichev fd085a411e
gh-121359: make clean environment (no PYTHON* vars) for test_pyrepl.TestMain (GH-121672)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-15 21:21:49 +02:00
Ken Jin e904300882
gh-121546: Disable contextvar caching on free-threading build (GH-121740) 2024-07-16 02:57:58 +08:00
Eric Snow 6b98b274b6
gh-76785: Expand How Interpreter Queues Handle Interpreter Finalization (gh-116431)
Any cross-interpreter mechanism for passing objects between interpreters must be very careful to respect isolation, even when the object is effectively immutable (e.g. int, str).  Here this especially relates to when an interpreter sends one of its objects, and then is destroyed while the inter-interpreter machinery (e.g. queue) still holds a reference to the object.

When I added interpreters.Queue, I dealt with that case (using an atexit hook) by silently removing all items from the queue that were added by the finalizing interpreter.

Later, while working on concurrent.futures.InterpreterPoolExecutor (gh-116430), I noticed it was somewhat surprising when items were silently removed from the queue when the originating interpreter was destroyed.  (See my comment on that PR.) 
 It took me a little while to realize what was going on.  I expect that users, which much less context than I have, would experience the same pain.

My approach, here, to improving the situation is to give users three options:

1. return a singleton (interpreters.queues.UNBOUND) from Queue.get() in place of each removed item
2. raise an exception (interpreters.queues.ItemInterpreterDestroyed) from Queue.get() in place of each removed item
3. existing behavior: silently remove each item (i.e. Queue.get() skips each one)

The default will now be (1), but users can still explicitly opt in any of them, including to the silent removal behavior.

The behavior for each item may be set with the corresponding Queue.put() call. and a queue-wide default may be set when the queue is created.  (This is the same as I did for "synconly".)
2024-07-15 12:49:23 -06:00
Eric Snow 985dd8e17b
gh-118297: Make Sure All Pending Calls Run in _Py_FinishPendingCalls() (gh-118298) 2024-07-15 12:44:20 -06:00
Rodrigo Girão Serrão 6522f0e438
gh-121746: Bind Alt+Enter to "accept" in the REPL (GH-121754) 2024-07-15 19:47:56 +02:00
Sebastian Rittau 74fbdcd74a
gh-121785: Remove unused code from codecs.py (GH-121787)
It was only needed for non-Unicode Python builds,
which aren't supported anymore.
2024-07-15 17:18:37 +00:00
Serhiy Storchaka 94bee45dee
gh-84978: Add float.from_number() and complex.from_number() (GH-26827)
They are alternate constructors which only accept numbers
(including objects with special methods __float__, __complex__
and __index__), but not strings.
2024-07-15 16:07:00 +00:00
Dominic H 8303d32ff5
gh-117765: Improve documentation for `mocker.patch.dict` (#121755) 2024-07-15 07:14:17 +00:00
Kumar Aditya 48042c52a6
fix outdated comments in asyncio (#121783) 2024-07-15 05:59:19 +00:00
Jelle Zijlstra 50eec501fe
gh-57141: Make shallow argument to filecmp.dircmp keyword-only (#121767)
It is our general practice to make new optional parameters keyword-only,
even if the existing parameters are all positional-or-keyword. Passing
this parameter as positional would look confusing and could be error-prone
if additional parameters are added in the future.
2024-07-14 15:53:32 -07:00
Sviatoslav Sydorenko (Святослав Сидоренко) 7982363b47
Generalize reusable Windows CI jobs (#121766) 2024-07-14 15:22:35 -06:00
Samuel Thibault d005f2c186
gh-121731: Fix mimalloc compile error on GNU/Hurd (#121732) 2024-07-14 12:50:25 -04:00