Commit Graph

126450 Commits

Author SHA1 Message Date
Kumar Aditya cf59bc3ae7
gh-127945: fix critical sections around ctypes array (#132646) 2025-04-17 18:44:14 +00:00
Tomasz Pytel a23ed8b379
gh-132284: Don't wrap base PyCFunction slots on class creation if not overridden (#132329) 2025-04-17 18:08:59 +01:00
Jelle Zijlstra 5707837049
gh-132493: Avoid eager import of annotationlib in typing (again) (#132596)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-04-17 16:03:53 +00:00
Sergey Miryanov e42bda9441
gh-132042: Do not lookup tp_dict each time to speedup class creation (#132619) 2025-04-17 12:04:42 +02:00
Duprat 15c75d7a8b
gh-132561: Fix the public `multiprocessing.SemLock.locked` method (#132586)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-04-17 11:41:30 +02:00
Sergey B Kirpichev 0c356c865a
gh-101410: Revert loghelper() change in 75f59bb for integer input (GH-132625) 2025-04-17 10:55:00 +03:00
Bartosz Sławecki 954b2cf031
gh-130070: Fix `exec(<string>, closure=<non-None>)` unexpected path (#130071)
Fixed an assertion error (so, it could be reproduced only in builds with assertions enabled)
for `exec` when the `source` argument is a string and the `closure` argument is not `None`.

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-04-17 10:14:55 +03:00
Adam Turner d7df7815f5
Remove duplicate includes: Python/ast_opt.c (#132621) 2025-04-17 10:10:01 +03:00
Jelle Zijlstra 39ee468e09
gh-118761: Add helper to ensure that lazy imports are actually lazy (#132614)
This ensures that if we jump through some hoops to make sure something is imported
lazily, we don't regress on importing it.

I recently already accidentally made typing import warnings and annotationlib eagerly.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-04-17 03:46:36 +00:00
Chris Eibl b530e174a3
GH-131296: Remove unused variable from overlapped.c (GH-131590) 2025-04-16 22:44:57 +01:00
Neil Schemenauer 591c982c6e
gh-128384: Fix for unreliable warnings unit tests. (gh-132611)
When the `showwarning()` function is replaced, make sure to restore
it after the test finishes.  Add a timeout for `Barrier()` so we
don't hang for a long time if something goes wrong.
2025-04-16 13:13:23 -07:00
Neil Schemenauer c6973eea13
Add Doc section in free-threaded extension howto for critical sections (GH-132531) 2025-04-16 12:43:01 -07:00
Tan90909090 f5512a2498
gh-132608: Fix a sample code coloring for ast.While (#132609)
Add missing '>' in prompt.
2025-04-16 19:23:13 +00:00
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) 25717ff4bf
Remove unused headers from _asynciomodule.c file (#132047)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-04-16 18:20:41 +00:00
Yongzi Li a985c9262f
Fix some typos in various doc files (GH-132589) 2025-04-16 18:11:47 +00:00
Tian Gao 62173cc02c
Clean up pdb state after each pdb doctest (#132577) 2025-04-16 13:44:33 -04:00
Jelle Zijlstra 14efcadfd4
typing docs: Clarify Protocol / runtime_checkable docs (#132606)
- Explicitly say that isinstance/issubclass do not work on non-runtime checkable
  protocols.
- Move the sentence "This raises TypeError when applied to a non-protocol class". It
  took me quite some time to decide what "this" was here: it refers to applying the
  decorator, not to an isinstance() call.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-04-16 17:44:17 +00:00
Kumar Aditya 2925462411
gh-127945: change `_ctypes_test.c` static globals to thread local (#132575) 2025-04-16 23:11:27 +05:30
Nadeshiko Manju b9e88ff4cb
gh-131798: Use `sym_new_type` instead of `sym_new_not_null` for `_BUILD_LIST`, `_BUILD_SLICE`, and `_BUILD_MAP` (GH-132434)
---------

Signed-off-by: Manjusaka <me@manjusaka.me>
2025-04-17 01:17:48 +08:00
Serhiy Storchaka 62ff86fa55
gh-130104: Call __rpow__ in ternary pow() if necessary (GH-130251)
Previously it was only called in binary pow() and the binary
power operator.
2025-04-16 18:32:41 +03:00
Jelle Zijlstra 72da4a4458
typing: Add missing test case for Protocol inheritance (#132597) 2025-04-16 08:21:27 -07:00
Felix Scherz 71af090e24
gh-132493: lazy evaluation of annotations in `typing._proto_hook` (#132534)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-04-16 08:20:35 -07:00
Victor Stinner 014c7f9047
gh-130052: Fix search_map_for_section() error handling (#132594)
* Don't call close() if the file descriptor is negative.
* If close() fails, chain the existing exception.
2025-04-16 13:56:58 +00:00
Jelle Zijlstra 7dcaebfb21
annotationlib: Move ForwardRef tests to test_annotationlib (#132571)
I started with just moving ForwardRefTests to test_annotationlib,
but found that it contained a number of tests for no_type_check, which
I moved to a new class in test_typing, as well as a number of tests that
are more appropriately classified as tests for get_type_hints().

One test, test_forward_equality_namespace(), was somewhat accidentally
depending on a global class A in test_typing. I added a class A in the
annotationlib tests instead.

Also add a useful comment in annotationlib.
2025-04-16 13:40:29 +00:00
Hugo van Kemenade 10a77619f9
Use Windows ARM64 hosted runners (#132546)
Co-authored-by: Diego Russo <diego.russo@arm.com>
2025-04-16 16:27:20 +03:00
Jelle Zijlstra a8ca26d250
annotationlib: Remove some unnecessary dict copies (#132495) 2025-04-16 06:16:13 -07:00
sobolevn c35c7353eb
gh-130941: Fix `configparser` parsing values with `allow_no_value` and `interpolation` set (GH-130949) 2025-04-16 12:39:11 +02:00
Serhiy Storchaka 8b7cb947c5
gh-127591: Fix altering environment in test_urllib2 (unsetting no_proxy) (GH-132584) 2025-04-16 13:05:54 +03:00
Serhiy Storchaka 8cb177d09b
gh-132099: Accept an integer as the address for BTPROTO_HCI on Linux (GH-132525)
Previously only an integer packed in a tuple was accepted, while
getsockname() could return a raw integer.
Now the result of getsockname() is always acceptable as an address.
2025-04-16 13:02:51 +03:00
Serhiy Storchaka 82f74eb234
gh-132535: Fix resource warnings in test_timeout (GH-132572)
They were emitted if internet connection was not available.
2025-04-16 10:20:07 +03:00
Kumar Aditya 4b15d105a2
gh-132070: add `PyObject_Realloc` suppression in free-threading (#132468) 2025-04-16 06:10:56 +05:30
Tian Gao d19af00b90
gh-132536: Do not disable PY_THROW event in bdb (#132537) 2025-04-15 18:31:52 -04:00
Adam Turner 4f10b93d1b
Docs: Synchronise ``indexsidebar.html`` with docsbuild-scripts (#132567) 2025-04-15 23:27:01 +01:00
Jelle Zijlstra 11f6603845
gh-132491: Rename annotationlib.value_to_string to type_repr (#132492) 2025-04-15 20:10:53 +00:00
Jelle Zijlstra 5e80fee41a
gh-129463: Remove two attributes from ForwardRef equality (#132283) 2025-04-15 12:58:21 -07:00
Bogdan Romanyuk 884df116d7
gh-114713: Handle case of an empty string passed to `zoneinfo.ZoneInfo` (#114731)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2025-04-15 18:41:52 +00:00
Barney Gale f3192dac66
GH-90812: Add test for `urlopen()` of file URI for UNC path (#132489) 2025-04-15 19:16:34 +01:00
Jelle Zijlstra 666eeda13d
gh-132493: Support deferred annotations in Protocols (#132494) 2025-04-15 10:14:27 -07:00
Raymond Hettinger 818b6a9ead
Fix argument order in multinomial() example (gh-132557) 2025-04-15 11:50:52 -05:00
Chris Eibl e94d168473
GH-131296: fix clang-cl warning on Windows in pegen.h (#131584) 2025-04-15 17:01:42 +01:00
Kumar Aditya 2ff5eb8582
gh-127945: move initialization of field desc to module exec in ctypes (#132552) 2025-04-15 19:30:33 +05:30
sobolevn b6c552f9e6
gh-132176: Fix crash on `type()` when `tuple` subclass passed as `bases` (#132212)
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-04-15 14:13:51 +03:00
Sergey B Kirpichev e10fe81cc6
gh-130664: support '_' (just as ',') in Decimal's formatting (#132155) 2025-04-15 12:38:03 +02:00
T. Wouters c66ffcf8e3
gh-129987: Selectively re-enable SLP autovectorization of _PyEval_EvalFrameDefault (#132530)
Only disable SLP autovectorization of `_PyEval_EvalFrameDefault` on newer
GCCs, as the optimization bug seems to exist only on GCC 12 and later, and
before GCC 9 disabling the optimization has a dramatic performance impact.
2025-04-15 09:39:32 +00:00
Barney Gale 0879ebc953
GH-123599: Match `file:` URL hostname against machine hostname in urllib (#132523)
In `_is_local_authority()`, return early if the authority matches the
machine hostname from `socket.gethostname()`, rather than resolving the
names and matching IP addresses.
2025-04-15 01:05:06 +01:00
Serhiy Storchaka 102f825c51
gh-124476: Fix decoding from the locale encoding in the C.UTF-8 locale (GH-132477) 2025-04-14 21:32:41 +03:00
Serhiy Storchaka 61638418a7
gh-70145: Add support for channels in Bluetooth HCI protocol (GH-132481) 2025-04-14 20:09:16 +03:00
Stan Ulbrych d22604a6d1
gh-85702: Catch IsADirectoryError in zoneinfo (#131333)
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-04-14 17:07:51 +00:00
Semyon Moroz bd47ec954d
gh-131885: Document `/` for `codecs` functions (#131992) 2025-04-14 18:55:29 +02:00
Jeremy Fleischman 939476bbbb
gh-131803: Clarify that you must register signal handlers for set_wakeup_fd (#131859) 2025-04-14 18:46:11 +02:00