Commit Graph

122410 Commits

Author SHA1 Message Date
wookie184 8e6321efd7
gh-119961: Fix test workflow status badge in README (#119962)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-06-03 00:05:57 -06:00
Donghee Na 0594a27e5f
gh-117657: Fix data races report by TSAN unicode-hash (gh-119907) 2024-06-03 12:22:41 +09:00
Solomon Himelbloom 117a8acdab
gh-109975: What's New in Python 3.13: fix broken link for `telnetlib` alternative (#119958) 2024-06-02 17:43:03 -07:00
Barney Gale bd6d4ed645
GH-119054: Add "Reading and writing files" section to pathlib docs (#119524)
Add a dedicated subsection for `open()`, `read_text()`, `read_bytes()`,
`write_text()` and `write_bytes()`.
2024-06-02 19:39:19 +00:00
Jelle Zijlstra aa9fe98e06
Improve documentation for typing.get_type_hints (#119928)
- Explicit list of what it does that is different from
  "just return __annotations__"
- Remove reference to PEP 563; adding the future import doesn't
  do anything to type aliases, and in general it will never make
  get_type_hints() less likely to fail.
- Remove example, as the Annotated docs already have a similar
  example, and it's unbalanced to have one example about this
  one edge case but not about other behaviors of the function.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-06-02 08:13:24 -07:00
Sam Gross f3b89a63cb
gh-117657: Fix TSAN reported race in `_PyEval_IsGILEnabled`. (#119921)
The GIL may be disabled concurrently with this call so we need to use a
relaxed atomic load.
2024-06-02 10:19:02 -04:00
Mark Dickinson f79ffc879b
gh-119740: Remove deprecated trunc delegation (#119743)
Remove the delegation of `int` to the `__trunc__` special method: `int` will now only delegate to `__int__` and `__index__` (in that order). `__trunc__` continues to exist, but its sole purpose is to support `math.trunc`.

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-02 10:16:49 +01:00
Nikita Sobolev 4aed319a8e
gh-119775: Remove ability to create immutable types with mutable bases (#119776) 2024-06-02 07:27:20 +00:00
Alyssa Coghlan fd6cd621e0
gh-118934: Fix PyEval_GetLocals docs (PEP 667) (#119932)
PEP 667's description of the planned changes to PyEval_GetLocals
was internally inconsistent when accepted, so the docs added for
gh-74929 didn't match either the current behaviour or the intended
behaviour once gh-118934 is fixed.

This PR updates the documentation and 3.13 What's New to match the
intended behaviour (once gh-118934 is fixed).

It also tidies up lingering references to `f_locals` always being a
dictionary (this hasn't been true since at least when custom
namespace support for class statement execution was added)
2024-06-02 04:44:29 +00:00
Raymond Hettinger e378dc15b5
Refactor (mostly rearrange) the statistics module (gh-119930) 2024-06-01 22:07:46 -05:00
Nice Zombies c618f7d80e
gh-119016: Remove outdated sentences from the "classes" tutorial (#119130)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-06-01 21:20:00 +00:00
Barney Gale 53b1981fb0
GH-89727: Fix `shutil.rmtree()` recursion error on deep trees (#119808)
Implement `shutil._rmtree_safe_fd()` using a list as a stack to avoid emitting recursion errors on deeply nested trees.

`shutil._rmtree_unsafe()` was fixed in a150679f90.
2024-06-01 19:49:12 +01:00
Raymond Hettinger 63111bfcf0
Add unique() recipe to itertools docs (gh-119911) 2024-06-01 11:30:24 -05:00
Sam Gross 7dc745d1f5
gh-117657: Add TSAN suppression for `set_discard_entry` (#119908)
Seen in CI occasionally when running `test_weakref`.
2024-06-01 12:15:58 -04:00
Kirill Podoprigora cf3bba3f06
gh-113892: Add a extra check to `ProactorEventLoop.sock_connect` to ensure that the given socket is in non-blocking mode (#119519) 2024-06-01 09:05:19 -07:00
Raymond Hettinger ce2ea7d629
Minor speed/accuracy improvement for kde() (gh-119910) 2024-06-01 10:49:14 -05:00
Sam Gross 90ec19fd33
gh-117657: Fix TSAN race in QSBR assertion (#119887)
Due to a limitation in TSAN, all reads from `PyThreadState.state` must be
atomic to avoid reported races.
2024-06-01 10:04:38 -04:00
Sam Gross 60593b2052
gh-117657: Fix TSAN race in free-threaded GC (#119883)
Only call `gc_restore_tid()` from stop-the-world contexts.
`worklist_pop()` can be called while other threads are running, so use a
relaxed atomic to modify `ob_tid`.
2024-06-01 10:04:05 -04:00
dependabot[bot] 5152120ae7
Bump types-psutil from 5.9.5.20240423 to 5.9.5.20240516 in /Tools (#119900) 2024-06-01 10:38:13 +00:00
dependabot[bot] 51191dbfdd
build(deps-dev): bump types-setuptools from 69.5.0.20240423 to 70.0.0.20240524 in /Tools (#119899) 2024-06-01 10:11:53 +00:00
Alyssa Coghlan 2180991ea3
gh-118888: Further PEP 667 docs updates (gh-119893)
* Clarify impact on default behaviour of exec, eval, etc
* Update documentation for changes to PyEval_GetLocals (gh-74929)

Closes gh-11888
2024-06-01 16:21:48 +10:00
Alyssa Coghlan 3859e09e3d
gh-74929: PEP 667 C API documentation (gh-119379)
* Add docs for new APIs
* Add soft-deprecation notices
* Add What's New porting entries
* Update comments referencing `PyFrame_LocalsToFast()` to mention the proxy instead
* Other related cleanups found when looking for refs to the deprecated APIs
2024-06-01 13:59:35 +10:00
Raymond Hettinger cc5cd4d93e
statistics.fmean(): speed-up code path for non-sizeable inputs. (gh-119876) 2024-05-31 17:08:55 -05:00
Jelle Zijlstra d28afd3fa0
gh-119180: Lazily wrap annotations on classmethod and staticmethod (#119864) 2024-05-31 14:05:51 -07:00
Jelle Zijlstra 80a4e38994
gh-119821: Support non-dict globals in LOAD_FROM_DICT_OR_GLOBALS (#119822)
Support non-dict globals in LOAD_FROM_DICT_OR_GLOBALS

The implementation basically copies LOAD_GLOBAL. Possibly it could be deduplicated,
but that seems like it may get hairy since the two operations have different operands.

This is important to fix in 3.14 for PEP 649, but it's a bug in earlier versions too,
and we should backport to 3.13 and 3.12 if possible.
2024-05-31 14:05:24 -07:00
Łukasz Langa 2237946af0
gh-118894: Make asyncio REPL use pyrepl (GH-119433) 2024-05-31 22:26:02 +02:00
Victor Stinner f9d47fed9f
gh-119853: Add Include/refcount.h to projects (#119860) 2024-05-31 21:21:30 +02:00
Sam Gross 879d43b705
gh-119799: Add missing `_Py_IncRefTotal` to `_Py_NewRefWithLock` (#119800)
The free-threaded refleak builds were reporting negative refcount deltas
in some tests because of a missing `_Py_NewRefWithLock`.
2024-05-31 14:18:24 -04:00
Sam Gross 9bc6045842
doc: Add glossary entry for "free threading" (#119865) 2024-05-31 13:23:29 -04:00
Zachary Ware f3fc800d5f
contextlib docs: Clean up redundant 'up' after 'cleanup' (GH-119867)
Reported by Michael Kass on docs@
2024-05-31 17:19:54 +00:00
Irit Katriel 015b1fdd0a
gh-100117: Fix inaccuracy in documentation of the CodeObject's co_positions field. (#119364) 2024-05-31 17:09:48 +00:00
Sam Gross 078b8c8cf2
gh-119369: Fix deadlock during thread exit in free-threaded build (#119528)
Release the GIL before calling `_Py_qsbr_unregister`.

The deadlock could occur when the GIL was enabled at runtime. The
`_Py_qsbr_unregister` call might block while holding the GIL because the
thread state was not active, but the GIL was still held.
2024-05-31 13:04:59 -04:00
Victor Stinner 64ff1e217d
gh-119770: Make termios ioctl() constants positive (#119840) 2024-05-31 17:18:40 +02:00
Sam Gross bcc1be39cb
gh-119585: Fix crash involving `PyGILState_Release()` and `PyThreadState_Clear()` (#119753)
Make sure that `gilstate_counter` is not zero in when calling
`PyThreadState_Clear()`. A destructor called from `PyThreadState_Clear()` may
call back into `PyGILState_Ensure()` and `PyGILState_Release()`. If
`gilstate_counter` is zero, it will try to create a new thread state before
the current active thread state is destroyed, leading to an assertion failure
or crash.
2024-05-31 10:50:52 -04:00
Victor Stinner 891c1e36f4
gh-119853: Add Include/refcount.h file (#119854) 2024-05-31 16:49:26 +02:00
Victor Stinner 91601a5596
gh-111201: Skip pyrepl Windows tests earlier (#119848)
Don't attempt to load pyrepl Windows console if platforms others than
Windows. For example, the import can fail if ctypes is missing.
2024-05-31 14:06:10 +00:00
Łukasz Langa 4c387a76f3
gh-111201: [pyrepl] Ensure optional platform-specific imports are optional (GH-119834) 2024-05-31 14:41:26 +02:00
Steve Dower 0e8d35b931
gh-116145: Updated bundled Tcl/Tk on Windows to 8.6.14 (GH-117030) 2024-05-31 13:07:19 +01:00
Joshua Herman b9965ef282
gh-119189: Fix the power operator for Fraction (GH-119242)
When using the ** operator or pow() with Fraction as the base
and an exponent that is not rational, a float, or a complex, the
fraction is no longer converted to a float.
2024-05-31 10:05:09 +00:00
Arnon Yaari dae0375bd9
gh-111201: Improve pyrepl auto indentation (#119606)
- auto-indent when editing multi-line block
- ignore comments
2024-05-31 11:02:54 +02:00
Christopher Chavez 94e9585e99
gh-103194: Fix Tkinter’s Tcl value type handling for Tcl 8.7/9.0 (GH-103846)
Some of standard Tcl types were renamed, removed, or no longer
registered in Tcl 8.7/9.0. This change fixes automatic conversion of Tcl
values to Python values to avoid returning a Tcl_Obj where the primary
Python types (int, bool, str, bytes) were returned in older Tcl.
2024-05-31 11:23:53 +03:00
Sergey B Kirpichev b278c723d7
gh-119780: Adjust exception messages in Lib/test/test_format.py (GH-119781)
Mismatches were just output to the stdout, without making the test failing.
2024-05-31 11:07:16 +03:00
Katie Bell 010aaa32fb
gh-97747: Improvements to WASM browser REPL. (#97665)
Improvements to WASM browser REPL.

Adds a text box to write and run code outside the REPL, a stop button, and handling of Ctrl-D for EOF.
2024-05-31 09:58:46 +02:00
Dino Viehland 0d07182821
gh-111201: Support pyrepl on Windows (#119559)
Co-authored-by: Anthony Shaw <anthony.p.shaw@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-31 09:49:03 +02:00
Irit Katriel 13a5fdc72f
gh-119744: move a few functions from compile.c to flowgraph.c (#119745) 2024-05-30 21:55:06 +01:00
James De Bias 9732ed5ca9
gh-107262: Update Tkinter tests for Tcl/Tk 8.6.14 (GH-119322)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-30 20:34:59 +00:00
Serhiy Storchaka ef01e95ae3
gh-109218: Deprecate weird cases in the complex() constructor (GH-119620)
* Passing a string as the "real" keyword argument is now an error;
  it should only be passed as a single positional argument.
* Passing a complex number as the "real" or "imag" argument is now deprecated;
  it should only be passed as a single positional argument.
2024-05-30 23:30:57 +03:00
Hugo van Kemenade deda85717b
Docs: `shutil.rmtree`'s `onerror` has no pending removal version (#118947) 2024-05-30 14:26:46 -06:00
Serhiy Storchaka ec1ba26460
gh-109218: Improve documentation for the complex() constructor (GH-119687)
* Remove the equivalence with real+imag*1j which can be incorrect in corner
  cases (non-finite numbers, the sign of zeroes).
* Separately document the three roles of the constructor: parsing a string,
  converting a number, and constructing a complex from components.
* Document positional-only parameters of complex(), float(), int() and bool()
  as positional-only.
* Add examples for complex() and int().
* Specify the grammar of the string for complex().
* Improve the grammar of the string for float().
* Describe more explicitly the behavior when real and/or imag arguments are
  complex numbers. (This will be deprecated in future.)
2024-05-30 20:20:07 +00:00
Sam Gross 1c04c63ced
gh-119729: Use 't' in pkg-config file name for free-threaded build (#119738)
For example, the free-threaded build now generates
`lib/pkgconfig/python-3.13t.pc` and the debug build generates
`lib/pkgconfig/python-3.13d.pc`.
2024-05-30 13:48:28 -04:00