Commit Graph

119568 Commits

Author SHA1 Message Date
Sergey B Kirpichev c61de456db
gh-102837: more tests for the math module (GH-111930)
Add tests to improve coverage:

* fsum: L1369, L1379, L1383, L1412
* trunc: L2081
* log: L2267
* dist: L2577, L2579
* hypot: L2632
* sumprod: L2744, L2754, L2774, L2778, L2781, L2785, L2831, L2835, L2838
* pow: L2982
* prod: L3294, L3308, L3318-3330

// line numbers wrt to 9dc4fb8204
2023-11-13 10:57:57 +01:00
Hugo van Kemenade a430b4ffdd
Docs: Add `make htmllive` to rebuild and reload HTML files in your browser (#111900) 2023-11-13 10:06:49 +02:00
Serhiy Storchaka 1d75ef6b61
gh-111999: Add signatures and improve docstrings for builtins (GH-112000) 2023-11-13 09:13:49 +02:00
AN Long d0058cbd1c
gh-111928: make "memo" dict local to scan_once call (gh-112005)
Co-authored-by: Sam Gross <colesbury@gmail.com>
2023-11-13 04:58:34 +00:00
Terry Jan Reedy 9a2f25d374
gh-111944: Add assignment expression parentheses requirements (#111977)
gh-111944: Clarify where assignment expressions require ()s

Augment the list of places where parentheses are
required around assignnment statements.  In particular,
'a := 0' and 'a = b := 1' are syntax errors.
2023-11-12 19:06:50 -05:00
Barney Gale d7cef7bc7e
GH-111429: Speed up `pathlib.PurePath.[is_]relative_to()` (#111431) 2023-11-12 22:59:17 +00:00
Irit Katriel b2af50cb02
gh-111969: refactor to make it easier to construct a dis.Instruction object (#111970) 2023-11-12 14:06:02 +00:00
Serhiy Storchaka 40752c1c1e
gh-112001: Fix test_builtins_have_signatures in test_inspect (GH-112002) 2023-11-12 13:35:31 +02:00
Sergey B Kirpichev 12a30bc1aa
gh-111933: fix broken link to A.Neumaier article (gh-111937) 2023-11-11 18:53:41 -06:00
T. Wouters ce6a533c4b
gh-111777: Fix assertion errors on incorrectly still-tracked GC object destruction (#111778)
In PyObject_GC_Del, in Py_DEBUG mode, when warning about GC objects that
were not properly untracked before starting destruction, take care to
untrack the object _before_ warning, to avoid triggering a GC run and
causing the problem the code tries to warn about. Also make sure to save and
restore any pending exceptions, which the warning would otherwise clobber or
trigger an assertion error on.
2023-11-12 01:03:34 +01:00
T. Wouters 21615f77b5
Fix undefined behaviour in datetime.time.fromisoformat() (#111982)
Fix undefined behaviour in datetime.time.fromisoformat() when parsing a string without a timezone. 'tzoffset' is not assigned to by parse_isoformat_time if it returns 0, but time_fromisoformat then passes tzoffset to another function, which is undefined behaviour (even if the function in question does not use the value).
2023-11-12 00:56:27 +01:00
Stephen Gildea 38035fed9b
gh-90890: New methods to access mailbox.Maildir message info and flags (#103905)
New methods to access mailbox.Maildir message info and flags:
get_info, set_info, get_flags, set_flags, add_flag, remove_flag.

These methods speed up accessing a message's info and/or flags and are
useful when it is not necessary to access the message's contents,
as when iterating over a Maildir to find messages with specific flags.

---------

* Add more str type checking
* modernize to f-strings instead of %

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-11-11 17:41:33 +00:00
Sam Gross fa84e5fe0a
gh-110481: fix 'unused function' warning for `is_shared_refcnt_dead`. (gh-111974)
Fix 'unused function' warning for `is_shared_refcnt_dead`.

The `is_shared_refcnt_dead` function is only used if `Py_REF_DEBUG` is set.
2023-11-11 08:54:35 +09:00
Nikita Sobolev ae8116cfa9
gh-107431: Make `multiprocessing.managers.{DictProxy,ListProxy}` generic (#107433)
Make `multiprocessing.managers.{DictProxy,ListProxy}` generic for type annotation use.  `ListProxy[str]` for example.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-11-10 23:23:27 +00:00
Serhiy Storchaka 06c47a305d
Remove dead code left after gh-110721 (#111905) 2023-11-10 22:30:01 +00:00
Tian Gao 148af38cd0
gh-80731: Avoid executing code in except block in cmd (GH-111740) 2023-11-10 21:13:29 +00:00
Serhiy Storchaka afac3c9b7e
gh-111789: Simplify the sqlite code (GH-111829)
Use new C API functions PyDict_GetItemRef() and
PyMapping_GetOptionalItemString().
2023-11-10 20:49:24 +00:00
Serhiy Storchaka 771bd3c94a
Add private _PyUnicode_AsUTF8NoNUL() function (GH-111957)
Like PyUnicode_AsUTF8(), but check for embedded null characters.
2023-11-10 21:31:36 +02:00
Łukasz Langa 3932b0f7b1
gh-110722: Make `-m test -T -j` use sys.monitoring (GH-111710)
Now all results from worker processes are aggregated and
displayed together as a summary at the end of a regrtest run.

The traditional trace is left in place for use with sequential
in-process test runs but now raises a warning that those
numbers are not precise.

`-T -j` requires `--with-pydebug` as it relies on `-Xpresite=`.
2023-11-10 18:17:45 +01:00
Serhiy Storchaka 0b06d2482d
gh-111841: Fix os.putenv() and os.unsetenv() with embedded NUL on Windows (GH-111842) 2023-11-10 18:42:14 +02:00
Alex Waygood 2e7f070080
Bump mypy to 1.7.0 (#111961) 2023-11-10 16:00:50 +00:00
Zac Hatfield-Dodds d61313bdb1
gh-103791: handle `BaseExceptionGroup` in `contextlib.suppress()` (#111910) 2023-11-10 13:32:36 +00:00
Serhiy Storchaka 64fea3211d
gh-111912: Run test_posix on Windows (GH-111913) 2023-11-10 13:29:15 +00:00
Nikita Sobolev 65d6dc2715
gh-108303: Install `Lib/test/configdata` (#111899) 2023-11-10 13:00:50 +01:00
Nicolas Tessore baeb7718f8
gh-111356: io: Add missing documented objects to io.__all__ (#111370)
Add DEFAULT_BUFFER_SIZE, text_encoding, and IncrementalNewlineDecoder.
2023-11-10 16:18:52 +09:00
Sam Gross 289af86122
gh-111569: Fix critical sections test on WebAssembly (GH-111897)
This adds a macro `Py_CAN_START_THREADS` that corresponds to the Python
function `test.support.threading_helper.can_start_thread()`. WASI and
some Emscripten builds do not have a working pthread implementation.

This macro is used to guard the critical sections C API tests that
require a working threads implementation.
2023-11-09 15:37:11 -08:00
Victor Stinner b9f814ce6f
gh-111881: Import _sha2 lazily in random (#111889)
The random module now imports the _sha2 module lazily in the
Random.seed() method for str, bytes and bytearray seeds. It also
imports lazily the warnings module in the _randbelow() method for
classes without getrandbits(). Lazy import makes Python startup
faster and reduces the number of imported modules at startup.
2023-11-09 23:10:21 +01:00
Samuel Thibault 0802fd6c8e
gh-81925: Implement native thread ids for kFreeBSD (#111761)
---------

Co-authored-by: Antoine Pitrou <antoine@python.org>
2023-11-09 21:02:30 +01:00
Pavel Ovchinnikov 0c61d028be
Improve error message for "float modulo by zero" (#111685) 2023-11-09 11:43:58 -08:00
Vinay Sajip a5f29c9faf
gh-110875: Handle '.' properties in logging formatter configuration c… (GH-110943) 2023-11-09 18:55:22 +00:00
Hugo van Kemenade 7d21e3d5ee
gh-111895: Convert definition list to bullet list for readability on mobile (#111898)
Convert definition list to bullet list for readability on mobile
2023-11-09 20:50:27 +02:00
Michael Droettboom bc12f79112
gh-111786: Optimize for space for _PyEval_EvalFrameDefault on MSVC for PGO (#111794)
In PGO mode, this function caused a compiler error in MSVC.
It turns out that optimizing for space only save the day, and is even faster.
However, without PGO, this is neither necessary nor slower.
2023-11-09 18:41:40 +00:00
Victor Stinner 6f09f69b7f
gh-111881: Import doctest lazily in libregrtest (#111884)
In most cases, doctest is not needed. So don't always import it at
startup. The change reduces the number of modules already
imported when a test is run.
2023-11-09 15:00:10 +00:00
zipperer 2f2a0a3a6c
Add detail to comment on range of random.random() (gh-111868)
---------

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2023-11-09 08:58:04 -06:00
Nikita Sobolev 0c42f7304a
gh-108303: Move more files to `Lib/test/test_module` (#111880) 2023-11-09 15:42:34 +01:00
Victor Stinner 0372e3b02a
gh-111881: Use lazy import in test.support (#111885)
* Import lazily getpass in test.support
* Only import ctypes on Windows in test.support.os_helper.
2023-11-09 15:38:13 +01:00
Nikita Sobolev cc18b886a5
gh-108303: Move config parser data to `Lib/test/configparserdata/` (gh-111879) 2023-11-09 14:52:32 +01:00
Mark Shannon 34a03e951b
GH-111843: Tier 2 exponential backoff (GH-111850) 2023-11-09 13:49:51 +00:00
Mark Shannon 25c4956488
GH-109369: Exit tier 2 if executor is invalid (GH-111657) 2023-11-09 11:19:51 +00:00
Donghee Na 6046aec377
gh-111835: Add seekable method to mmap.mmap (gh-111852) 2023-11-09 20:13:35 +09:00
Irit Katriel 30ec968bef
gh-111354: remove comparisons with enum values, variable reuse, unused imports in genobject.c (#111708) 2023-11-09 10:27:20 +00:00
Brett Cannon 97c4c06d0d
GH-111804: Drop posix.fallocate() under WASI (GH-111869)
Drop posix.fallocate() under WASI.

The underlying POSIX function, posix_fallocate(), was found to vary too
much between implementations to remain in WASI. As such, while it was
available in WASI preview1, it's been dropped in preview2.
2023-11-08 17:20:35 -08:00
Sam Gross 31c90d5838
gh-111569: Implement Python critical section API (gh-111571)
Critical sections are helpers to replace the global interpreter lock
with finer grained locking.  They provide similar guarantees to the GIL
and avoid the deadlock risk that plain locking involves.  Critical
sections are implicitly ended whenever the GIL would be released.  They
are resumed when the GIL would be acquired.  Nested critical sections
behave as if the sections were interleaved.
2023-11-08 15:39:29 -07:00
Jelle Zijlstra 0b718e6407
gh-110543: Fix CodeType.replace in presence of comprehensions (#110586) 2023-11-08 13:11:59 -07:00
Serhiy Storchaka 804575b5c0
Remove redundant check in dbm.open() (GH-111844)
PyUnicode_FSConverter() already checks for embedded null characters.
2023-11-08 19:42:41 +02:00
Kalyan a3903c8ec8
gh-111495: Add tests for PyList C API (#111562)
Signed-off-by: kalyanr <kalyan.ben10@live.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-11-08 18:10:53 +01:00
Serhiy Storchaka 005d1e8fc8
gh-68166: Tkinter: Add tests and examples for element_create() (GH-111453)
* Remove mention of "vsapi" element type from the documentation.
* Add tests for element_create() and other ttk.Style methods.
* Add examples for element_create() in the documentation.
2023-11-08 18:25:58 +02:00
Pierre Ossman (ThinLinc team) 74b868f636
gh-111246: Remove listening Unix socket on close (#111483)
Try to clean up the socket file we create so we don't add unused noise to the file system.
2023-11-08 08:10:10 -08:00
Stefan f88caab467
gh-111768: Add `wsgiref.util.is_hop_by_hop` to `__all__` (#111770) 2023-11-08 15:29:47 +00:00
Jelle Zijlstra fe3fd2c333
socket: Update generated AC code (#111853) 2023-11-08 15:03:29 +00:00