Commit graph

119751 commits

Author SHA1 Message Date
Mark Shannon 4bbb367ba6
GH-111848: Set the IP when de-optimizing (GH-112065)
* Replace jumps with deopts in tier 2

* Fewer special cases of uop names

* Add target field to uop IR

* Remove more redundant SET_IP and _CHECK_VALIDITY micro-ops

* Extend whitelist of non-escaping API functions.
2023-11-15 15:48:58 +00:00
Ryuji Tsutsui 0cfdd6e3d1
Fix typo in perf profiling docs (#112112) 2023-11-15 15:40:19 +00:00
Nikita Sobolev 422c0f0301
gh-108303: Delete imp_dummy test file (#112110) 2023-11-15 13:26:49 +01:00
Serhiy Storchaka d4f83e1e3a
gh-111789: Use PyDict_GetItemRef() in Modules/_asynciomodule.c (GH-112072) 2023-11-15 04:28:30 +00:00
Adam Turner 6c214dea7c
Docs: Add the time to the HTML last updated format (#110091) 2023-11-15 04:04:28 +00:00
Radislav Chugunov 4744f59a5e
gh-112062: Make _struct module thread-safe in --disable-gil builds (#112094)
* gh-112062: Make `_struct` module thread-safe in --disable-gil builds
2023-11-15 09:30:34 +05:30
Victor Stinner 55f3cce821
gh-111545: Test PyHash_GetFuncDef() function (#112098)
Add Modules/_testcapi/hash.c and Lib/test/test_capi/test_hash.py.
2023-11-15 03:41:29 +01:00
DPR e0f5127975
gh-109538: Avoid RuntimeError when StreamWriter is deleted with closed loop (#111983)
Issue a ResourceWarning instead.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-11-15 01:17:51 +00:00
adder32 fe9db901b2
gh-111995: Add getnameinfo extension flag (#111994)
Add getnameinfo extension NI_IDN flag.
2023-11-15 01:00:24 +00:00
Victor Stinner 62802b6228
gh-111545: Add Include/cpython/pyhash.h header file (#112063)
Move non-limited C API to a new Include/cpython/pyhash.h header file.
2023-11-15 01:19:20 +01:00
Serhiy Storchaka 9302f05f9a
gh-111942: Fix SystemError in the TextIOWrapper constructor (#112061)
In non-debug more the check for the "errors" argument is skipped,
and then PyUnicode_AsUTF8() can fail, but its result was not checked.

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-11-14 20:02:28 +00:00
Furkan Onder 0ff6368519
gh-111906: Fix warnings during mimalloc build on FreeBSD (#111907)
Fix `unused function` warnings during mimalloc build on FreeBSD.
2023-11-14 17:07:46 +01:00
Serhiy Storchaka ee06fffd38
gh-111942: Fix crashes in TextIOWrapper.reconfigure() (GH-111976)
* Fix crash when encoding is not string or None.
* Fix crash when both line_buffering and write_through raise exception
  when converted ti int.
* Add a number of tests for constructor and reconfigure() method
  with invalid arguments.
2023-11-14 17:37:56 +02:00
Mark Shannon a519b87958
GH-111848: Convert remaining jumps to deopts into tier 2 code. (GH-112045) 2023-11-14 15:30:33 +00:00
Serhiy Storchaka b11c443bb2
gh-111789: Simplify bytecodes.c by using PyDict_GetItemRef() (GH-111978) 2023-11-14 15:38:49 +02:00
Victor Stinner 4f04172c92
gh-111262: Add PyDict_Pop() function (#112028)
_PyDict_Pop_KnownHash(): remove the default value and the return type
becomes an int.

Co-authored-by: Stefan Behnel <stefan_ml@behnel.de>
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
2023-11-14 12:51:00 +00:00
Tian Gao f44d6ff6e0
gh-110944: Make pdb completion work for alias and convenience vars (GH-110945) 2023-11-14 13:22:25 +01:00
Sam Gross 324531df90
gh-111903: Add @critical_section directive to Argument Clinic. (#111904)
The `@critical_section` directive instructs Argument Clinic to generate calls
to `Py_BEGIN_CRITICAL_SECTION()` and `Py_END_CRITICAL_SECTION()` around the
bound function. In `--disable-gil` builds, these calls will lock and unlock
the `self` object. They are no-ops in the default build.

This is used in one place (`_io._Buffered.close`) as a demonstration.
Subsequent PRs will use it more widely in the `_io.Buffered` bindings.
2023-11-14 10:47:46 +00:00
Serhiy Storchaka 16055c1604
gh-111789: Simplify ceval.c by using PyDict_GetItemRef() (GH-111980) 2023-11-14 11:29:49 +02:00
Serhiy Storchaka 95365625f4
gh-111789: Simplify import.c by using PyDict_GetItemRef() (GH-111979) 2023-11-14 11:29:20 +02:00
Serhiy Storchaka c98600bed4
gh-111789: Use PyDict_GetItemRef() in _ctypes (GH-111828) 2023-11-14 11:28:34 +02:00
Serhiy Storchaka 18203a6bc9
gh-111789: Use PyDict_GetItemRef() in Objects/ (GH-111827) 2023-11-14 11:25:39 +02:00
Terry Jan Reedy e31d65e0b7
gh-111622: Fix doc for items views (#112051)
They are set-like even when some values are not hashable,
but work even better when all are.
2023-11-14 07:41:20 +00:00
Brandt Bucher 31ad7e061e
GH-111520: Add back the operand local (GH-111813) 2023-11-13 17:27:19 -08:00
Irit Katriel 36aab34fab
gh-107149: make new opcode util functions private rather than public and unstable (#112042) 2023-11-14 00:31:02 +00:00
Terry Jan Reedy b28bb130bb
gh-112007: Re-organize help utility intro message (#112017)
Most important: move how-to-quit sentence to the end and mention 'q'.
Re-group the other sentences and improve some wording.
---------
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-11-13 14:24:03 -05:00
Barney Gale d5491a6eff
GH-110417: Fix glob docs ordering (#110418)
Fix incorrect placement of `translate()` docs from cf67ebf.

Move "see also: pathlib" admonition to the bottom of the page, alongside one for fnmatch. This helps the module introduction flow more naturally into the function descriptions.

Add an "Examples" subheading just before the examples. This makes it more obvious that examples aren't specifically related to the preceding documentation of `escape()` and `translate()`.
2023-11-13 17:48:16 +00:00
Barney Gale cf67ebfb31
GH-72904: Add glob.translate() function (#106703)
Add `glob.translate()` function that converts a pathname with shell wildcards to a regular expression. The regular expression is used by pathlib to implement `match()` and `glob()`.

This function differs from `fnmatch.translate()` in that wildcards do not match path separators by default, and that a `*` pattern segment matches precisely one path segment. When *recursive* is set to true, `**` pattern segments match any number of path segments, and `**` cannot appear outside its own segment.

In pathlib, this change speeds up directory walking (because `_make_child_relpath()` does less work), makes path objects smaller (they don't need a `_lines` slot), and removes the need for some gnarly code.

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-11-13 17:15:56 +00:00
Victor Stinner babb787047
gh-111138: Add PyList_Extend() and PyList_Clear() functions (#111862)
* Split list_extend() into two sub-functions: list_extend_fast() and
  list_extend_iter().
* list_inplace_concat() no longer has to call Py_DECREF() on the
  list_extend() result, since list_extend() now returns an int.
2023-11-13 16:14:56 +00:00
AN Long 29af7369db
gh-111856: Fix os.fstat on windows with FAT32 and exFAT filesystem (GH-112038) 2023-11-13 16:10:06 +00:00
Davide Rizzo d2f305dfd1
gh-111460: Restore ncurses widechar support on macOS (#111878) 2023-11-13 22:36:50 +09:00
Markus Mohrhard 1447af7970
gh-106905: avoid incorrect SystemError about recursion depth mismatch (#106906)
* gh-106905: avoid incorrect SystemError about recursion depth mismatch

* Update Misc/NEWS.d/next/Core and Builtins/2023-07-20-11-41-16.gh-issue-106905.AyZpuB.rst

---------

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-11-13 13:05:17 +00:00
Tian Gao 1c7ed7e9eb
gh-110944: Move pty helper to test.support and add basic pdb completion test (GH-111826) 2023-11-13 11:23:06 +01:00
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