Commit Graph

123068 Commits

Author SHA1 Message Date
Barney Gale d6d8707ff2
GH-119054: Add "Expanding and resolving paths" section to pathlib docs. (#120970)
Add dedicated subsection for `home()`, `expanduser()`, `cwd()`,
`absolute()`, `resolve()` and `readlink()`. The position of this section
keeps all the `Path` constructors (`Path()`, `Path.from_uri()`,
`Path.home()` and `Path.cwd()`) near the top. Within the section, closely
related methods are kept adjacent. Specifically:

-.`home()` and `expanduser()` (the former calls the latter)
- `cwd()` and `absolute()` (the former calls the latter)
- `absolute()` and `resolve()` (both make paths absolute)
- `resolve()` and `readlink()` (both read symlink targets)
- Ditto `cwd()` and `absolute()`
- Ditto `absolute()` and `resolve()`

The "Other methods" section is removed.
2024-06-29 16:09:47 +01:00
Sergey B Kirpichev 2cb84b107a
gh-119372: Recover inf's and zeros in _Py_c_quot (GH-119457)
In some cases, previously computed as (nan+nanj), we could
recover meaningful component values in the result, see
e.g. the C11, Annex G.5.2, routine _Cdivd().
2024-06-29 11:00:48 +03:00
Wim Jeantine-Glenn 0a1e8ff9c1
gh-121101: Document -Wall option (an alias for -Walways) (#121102) 2024-06-29 12:10:13 +05:30
blhsing 6d34938dc8
gh-120713: Normalize year with century for datetime.strftime (GH-120820) 2024-06-29 09:32:42 +03:00
Justin Applegate 92893fd8dc
gh-121137: Add missing Py_DECREF calls for ADDITEMS opcode of _pickle.c (#121136)
PyObject_GetAttr returns a new reference, but this reference is never decremented using Py_DECREF, so Py_DECREF calls to this referece are added
2024-06-28 14:43:45 -07:00
Ken Jin e6543daf12
gh-117139: Fix a few wrong steals in bytecodes.c (GH-121127)
Fix a few wrong steals in bytecodes.c
2024-06-29 02:14:48 +08:00
Steve Dower 2894aa14f2
gh-121115: Skip __index__ in PyLong_AsNativeBytes by default (GH-121118) 2024-06-28 16:26:21 +01:00
Serhiy Storchaka 81a654a342
gh-121018: Fix more cases of exiting in argparse when exit_on_error=False (GH-121056)
* parse_intermixed_args() now raises ArgumentError instead of calling
  error() if exit_on_error is false.
* Internal code now always raises ArgumentError instead of calling
  error(). It is then caught at the higher level and error() is called if
  exit_on_error is true.
2024-06-28 17:21:59 +03:00
Victor Stinner 43709d5d54
Check for compiler warnings in test_cext on Windows (#121088)
On Windows, test_cext and test_cppext now pass /WX flag to the MSC
compiler to treat all compiler warnings as errors. In verbose mode,
these tests now log the compiler commands to help debugging.

Change Py_BUILD_ASSERT_EXPR implementation on Windows to avoid a
compiler warning about an unnamed structure.
2024-06-28 14:41:37 +02:00
Kumar Aditya ef3c400434
gh-120804: remove `is_active` method from internal child watchers implementation in asyncio (#121124) 2024-06-28 17:23:56 +05:30
Victor Stinner 6e63d84e43
gh-121096: Ignore dlopen() leaks in Valgrind suppression file (#121097) 2024-06-28 13:10:11 +02:00
Kumar Aditya 58a3580836
gh-107803: add whatsnew for asyncio double linked list implementation (#120995) 2024-06-28 14:33:31 +05:30
Donghee Na 1a2e7a7475
gh-120837: Update _Py_DumpExtensionModules to be async-signal-safe (gh-121051) 2024-06-28 06:46:46 +09:00
Alexander Bessman 237baf4d7a
gh-121035: Update logging flow chart to include the lastResort handler. (GH-121036) 2024-06-27 22:11:40 +01:00
Sam Gross 4a62a331de
gh-121065: Temporarily skip flaky test on free-threaded build (#121100) 2024-06-27 14:03:09 -04:00
Craig Robson e9b4ec614b
gh-105623 Fix performance degradation in logging RotatingFileHandler (GH-105887)
The check for whether the log file is a real file is expensive on NFS
filesystems.  This commit reorders the rollover condition checking to
not do the file type check if the expected file size is less than the
rotation threshold.

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2024-06-27 16:44:40 +00:00
Kerim Kabirov 0890ad7c02
gh-115986 Improve pprint docs formatting (GH-117401)
* Move pprinter parameters description to the table

The change improves readability.
Suggested in the GH#116085 PR discussion.

* Make pprint doc with params markup

* Fix formatting
Indentation of code blocks made them nested
"Version changed" is better placed after the code block

* Fix formatting for tests

* fix code indentation for autotests

* Fix identation for autotests

* Remove duplication of the parameters' description

* Rearrange parameters description in a correct order

---------

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-06-27 16:32:50 +02:00
Serhiy Storchaka db96edd6d1
gh-121027: Add a future warning in functools.partial.__get__ (#121086) 2024-06-27 11:47:20 +00:00
Nadeshiko Manju 223c03a43c
gh-121082: Fix build failure when the developer use `--enable-pystats` arguments in configuration command after #118450 (#121083)
Signed-off-by: Manjusaka <me@manjusaka.me>
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
2024-06-27 19:35:25 +08:00
Victor Stinner b7a95dfee3
gh-120593: Check -Wcast-qual flag in test_cext (#121081)
Check the usage of the 'const' qualifier in the Python C API in
test_cext.
2024-06-27 10:22:48 +00:00
Irit Katriel 6f7acaab50
gh-120686: remove unused internal c api functions (#120687) 2024-06-27 11:09:30 +01:00
Victor Stinner 12af8ec864
gh-121040: Use __attribute__((fallthrough)) (#121044)
Fix warnings when using -Wimplicit-fallthrough compiler flag.

Annotate explicitly "fall through" switch cases with a new
_Py_FALLTHROUGH macro which uses __attribute__((fallthrough)) if
available. Replace "fall through" comments with _Py_FALLTHROUGH.

Add _Py__has_attribute() macro. No longer define __has_attribute()
macro if it's not defined. Move also _Py__has_builtin() at the top
of pyport.h.

Co-Authored-By: Nikita Sobolev <mail@sobolevn.me>
2024-06-27 09:58:44 +00:00
Pradyun Gedam 4999e0bda0
gh-120888: Bump bundled pip to 24.1.1 (#120889)
Co-authored-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: T. Wouters <thomas@python.org>
2024-06-27 09:09:54 +00:00
Petr Viktorin 1167a9a30b
gh-119521: Remove _IncompleteInputError from the docs (GH-120993) 2024-06-27 09:09:22 +02:00
Janek Nouvertné 7d9c68513d
gh-120868: Fix breaking change in `logging.config` when using `QueueHandler` (GH-120872) 2024-06-27 08:09:01 +01:00
Eric Snow 4be1f37b20
gh-113433: Automatically Clean Up Subinterpreters in Py_Finalize() (gh-121060)
This change makes things a little less painful for some users.  It also fixes a failing assert (gh-120765), by making sure all subinterpreters are destroyed before the main interpreter.  As part of that, we make sure Py_Finalize() always runs with the main interpreter active.
2024-06-26 21:17:26 +00:00
chaen 1c13b29d54
gh-120937: Reference weakref from the `__del__` documentation (#120940)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-06-26 23:07:09 +03:00
Ken Jin 22b0de2755
gh-117139: Convert the evaluation stack to stack refs (#118450)
This PR sets up tagged pointers for CPython.

The general idea is to create a separate struct _PyStackRef for everything on the evaluation stack to store the bits. This forces the C compiler to warn us if we try to cast things or pull things out of the struct directly.

Only for free threading: We tag the low bit if something is deferred - that means we skip incref and decref operations on it. This behavior may change in the future if Mark's plans to defer all objects in the interpreter loop pans out.

This implies a strict stack reference discipline is required. ALL incref and decref operations on stackrefs must use the stackref variants. It is unsafe to untag something then do normal incref/decref ops on it.

The new incref and decref variants are called dup and close. They mimic a "handle" API operating on these stackrefs.

Please read Include/internal/pycore_stackref.h for more information!

---------

Co-authored-by: Mark Shannon <9448417+markshannon@users.noreply.github.com>
2024-06-27 03:10:43 +08:00
Łukasz Langa d611c4c8e9
gh-118908: Use __main__ for the default PyREPL namespace (#121054) 2024-06-26 15:01:10 -04:00
Victor Stinner e51e880e75
gh-120593: Fix const qualifier in _PyLong_CompactValue() (#121053)
Remove the const qualifier of the argument of functions:

* _PyLong_IsCompact()
* _PyLong_CompactValue()

Py_TYPE() argument is not const.

Fix the compiler warning:

  Include/cpython/longintrepr.h: In function ‘_PyLong_CompactValue’:
  Include/pyport.h:19:31: error: cast discards ‘const’ qualifier from
  pointer target type [-Werror=cast-qual]
    (...)
  Include/cpython/longintrepr.h:133:30: note: in expansion of macro
  ‘Py_TYPE’
    assert(PyType_HasFeature(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS));
2024-06-26 20:11:21 +02:00
Victor Stinner 9cd2dcbb87
gh-120593: Fix const qualifier in pyatomic.h (#121055) 2024-06-26 20:10:47 +02:00
Victor Stinner 44eafd6688
gh-121008: Fix idlelib.run tests (#121046)
When testing IDLE, don't create a Tk to avoid side effects such as
installing a PyOS_InputHook hook.
2024-06-26 15:41:16 +02:00
Irit Katriel c87876763e
gh-119786: move frames documentation to InternalDocs and add details (#121009) 2024-06-26 13:18:20 +01:00
Victor Stinner 9e4a81f00f
gh-120642: Move private PyCode APIs to the internal C API (#120643)
* Move _Py_CODEUNIT and related functions to pycore_code.h.
* Move _Py_BackoffCounter to pycore_backoff.h.
* Move Include/cpython/optimizer.h content to pycore_optimizer.h.
* Remove Include/cpython/optimizer.h.
* Remove PyUnstable_Replace_Executor().

Rename functions:

* PyUnstable_GetExecutor() => _Py_GetExecutor()
* PyUnstable_GetOptimizer() => _Py_GetOptimizer()
* PyUnstable_SetOptimizer() => _Py_SetTier2Optimizer()
* PyUnstable_Optimizer_NewCounter() => _PyOptimizer_NewCounter()
* PyUnstable_Optimizer_NewUOpOptimizer() => _PyOptimizer_NewUOpOptimizer()
2024-06-26 13:54:03 +02:00
devdanzin 9e45fd9858
gh-121016: Add test for `PYTHON_BASIC_REPL` envioronment variable (#121017) 2024-06-26 10:39:07 +00:00
Nate Ohlson ef28f6df42
gh-121040: Remove fallthrough warnings compiler option (gh-121041)
Remove fallthrough warnings
2024-06-26 10:21:21 +00:00
Petr Viktorin 9056597224
gh-73991: Skip permission test if running as *nix superuser (GH-120994) 2024-06-26 11:36:09 +02:00
Bénédikt Tran d2646e3f45
gh-121025: Improve partialmethod.__repr__ (GH-121033)
It no longer contains redundant commas and spaces.
2024-06-26 12:08:27 +03:00
Nate Ohlson d8f82432a3
gh-121026: Include -Werror with new compiler flag checks to ensure compatibility (gh-121030) 2024-06-26 17:45:55 +09:00
blhsing 0654336dd5
gh-121018: Ensure ArgumentParser.parse_args with exit_on_error=False raises instead of exiting when given unrecognized arguments (GH-121019) 2024-06-26 10:41:51 +03:00
Kumar Aditya 82235449b8
gh-107803: fix thread safety issue in double linked list implementation (#121007) 2024-06-26 05:11:32 +00:00
Nate Ohlson 7fb32e0209
gh-112301: Enable compiler flags with low performance impact and no warnings (gh-120975) 2024-06-26 12:11:05 +09:00
Eric Snow a905721b9c
gh-120838: Add _PyThreadState_WHENCE_FINI (gh-121010)
We also add _PyThreadState_NewBound() and drop _PyThreadState_SetWhence().

This change only affects internal API.
2024-06-25 14:35:12 -06:00
Victor Stinner 769aea3329
gh-120155: Fix Coverity issue in parse_string() (#120997) 2024-06-25 17:53:24 +01:00
Alex Waygood 2d3187bf20
gh-114053: Fix another edge case involving `get_type_hints`, PEP 695 and PEP 563 (#120272) 2024-06-25 16:53:18 +01:00
Mark Shannon 8f5a01707f
GH-120982: Add stack check assertions to generated interpreter code (GH-120992) 2024-06-25 16:42:29 +01:00
Jelle Zijlstra 42b2c9d78d
gh-120108: Fix deepcopying of AST trees with .parent attributes (#120114) 2024-06-25 08:12:11 -07:00
Hugo van Kemenade ead676516d
Doc/README: Document 'make htmllive' (#120692)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2024-06-25 12:08:55 +03:00
Raymond Hettinger 9b32b89074
Add fast path in count_elements (gh-120983) 2024-06-25 03:10:00 -05:00
Bénédikt Tran bb057ea107
gh-120661: improve example for basic type hints (#120934) 2024-06-25 07:59:56 +00:00