Commit Graph

5871 Commits

Author SHA1 Message Date
Stephen Morton 175e700656 Push items down from socketserver.BaseServer to TCPServer (#13082)
Cf. https://github.com/python/cpython/issues/127209
2025-03-03 16:38:43 +01:00
Avasam 1e71351016 Allow any sliceable sequence as getopt args (#13116) 2025-03-03 15:52:57 +01:00
Avasam cc206f760d Drop flake8-noqa and remove workarounds to work with Ruff (#13571) 2025-03-03 15:48:59 +01:00
Sebastian Rittau 96c3fe712a Remove SupportsGetItem.__contains__ (#13541) 2025-03-03 15:44:26 +01:00
Avasam 6d6e858e63 Enable Ruff PLC (Pylint Convention) (#13306) 2025-03-03 15:39:40 +01:00
Randolf Scholz be17dc0ac4 builtins.slice: more precise __new__ overloads and defaults for StopT and StepT. (#13008) 2025-02-28 13:33:07 +01:00
Sebastian Rittau f1b121cf29 [configparser] Fix missing fallback argument in SectionProxy.get (#13559)
Closes: #13556
2025-02-28 03:33:10 -08:00
Stephen Morton 1bd2a358c9 test suite characterizing dict.get() (#13225) 2025-02-28 12:18:56 +01:00
Colin Watson 8ebf8af91b Weaken return type of Path.{glob,rglob} in 3.13 (#13223)
Since https://github.com/python/cpython/pull/117589 (at least),
`Path.glob` and `Path.rglob` return an `Iterator` rather than a
`Generator`.
2025-02-28 12:15:07 +01:00
Pierre Chapuis b0c6fffe28 Introduce the _HashObject protocol (#13553)
This protocol corresponds to what is called "hash object" in the hashlib documentation. In particular, it includes the non-OpenSSL BLAKE2 implementations which do not inherit HASH.
2025-02-27 15:31:56 +01:00
Stephen Morton 14605d0c21 Complete importlib.readers (#13356) 2025-02-27 14:44:46 +01:00
Stephen Morton 40dc55c4be Major update for the xml module (#13349) 2025-02-27 12:50:09 +01:00
mtnpke 0647903db3 Support configparser.UNNAMED_SECTION (#13542) (#13544) 2025-02-27 12:19:38 +01:00
Avasam 62feb28c29 Enable Ruff SIM (#13309) 2025-02-26 23:19:36 +01:00
Sebastian Rittau 9da1df60be Update an itertool recipe from Python docs (#13543) 2025-02-26 14:04:04 +01:00
Victor Westerhuis bef43fc46e Relax functools.update_wrapper's parameter types (#13491) 2025-02-26 12:59:39 +01:00
Brian Schubert c27e41c33b Make various email.Policy use sites generic over the message type (#13274) 2025-02-23 20:28:43 +01:00
Sam Bull fd4fc6091d Return BufferedIncrementalReader for some encodings (#13523) 2025-02-22 21:25:01 +01:00
Richard Si 4050dd42ef Update importlib cache,source return types to StrPath (#13509)
This has been true since Python 3.6.
2025-02-17 16:05:15 -08:00
Richard Si 654d8c2457 Update compileall.compile_{dir, file, path} to return bool (#13504) 2025-02-15 15:33:01 -08:00
Michael H cc8ca939c0 Fix type for run_coroutine_threadsafe (#13498) 2025-02-14 13:23:11 +00:00
Alyssa Coghlan 3f41b30535 Revert "Improve [Async]ContextDecorator type hinting (#13416)" (#13436)
This reverts commit 57d7c4334b.

The attempted fix loses all type overload information during type
inferencing, so postpone fixing the issue until we have a solution
which doesn't impose such a dramatic loss in functionality.

Reopens #13403
2025-02-13 20:49:51 -08:00
David Peter 15f98a8ab8 chr: Accept SupportsIndex argument (#13494)
The `chr` function does accept objects that implement the
`SupportsIndex` protocol. The [implementation] of the builtin method
calls `PyLong_AsLongAndOverflow` on the argument, which in turn calls
`__index__()`, if present. The parameter of the `chr` function can
therefore be annotated with `int | SupportsIndex`.

It seems to me like `SupportsIndex` alone would be enough, since `int`
implements `SupportIndex`, but I chose `int | SupportIndex` to make it
consistent with the annotations on `hex`, `oct` and `bin`.

[implementation]: https://github.com/python/cpython/blob/b05fa90b21dd01bb836285cdd41920320b09e681/Python/bltinmodule.c#L725
[PyLong_AsLongAndOverflow]: https://docs.python.org/3.13/c-api/long.html#c.PyLong_AsLongAndOverflow
2025-02-12 07:50:42 +00:00
Avasam 24c78b9e0d http.server.SimpleHTTPRequestHandler's directory param can be PathLike (#13477) 2025-02-09 21:42:41 +00:00
M Bussonnier 8bd178e0c6 Fix: incorrect type for Bdb.format_stack_entry (#13485)
```python
    def format_stack_entry(self, frame_lineno, lprefix=': '):
         ...
        frame, lineno = frame_lineno
```

The type of `frame_lineno` is `tuple[FrameType, int]` not `int`,
understandably, since the type of `frame_lineno` can be interprted as
the line number of the frame. But looking at the implementation of
`Bdb.format_stack_entry`, it is clear that `frame_lineno` is a tuple.

It is also necessary to somehow pass a frame to `format_stack_entry` if
we want it to be formatted...
2025-02-09 21:32:56 +00:00
Avasam dee4ef3171 Still allow passing None to shutil.rmtree's onerror parameter on Python 3.12+ (#13478)
Resolves https://github.com/python/mypy/issues/18239
2025-02-08 17:46:09 -08:00
Alex Waygood 5caaf2e1fb Fix stdlib stubtest for latest Python patch releases (#13464) 2025-02-05 23:33:27 +00:00
/ˈɛvən/ aac4394eb2 tkinter: allow index to be "end" in Treeview.move (#13454) 2025-02-03 14:43:28 +02:00
Ali Hamdan a0db1ba8dc Mark optparse constants as final (#13451) 2025-02-03 09:05:41 +01:00
Ali Hamdan 30a4d10b71 Mark top-level re flags as final (#13452) 2025-02-03 09:04:52 +01:00
Ali Hamdan fd92105daa Mark constants in sre_constants as final (#13453)
Replace one use of Any
2025-02-03 09:04:03 +01:00
Ali Hamdan 89b5afab15 Clean up argparse hacks (#13450) 2025-02-01 13:11:40 -08:00
Alex Waygood c193cd2a36 Upgrade Black and Ruff (#13443) 2025-01-29 22:47:58 +00:00
Alyssa Coghlan 57d7c4334b Improve [Async]ContextDecorator type hinting (#13416)
Updated annotations allow access to `__wrapped__` on
decorated callables without complaints from typecheckers.
2025-01-20 17:58:52 +01:00
Ali Hamdan 31bff4a503 Improve decimal constants and fill missing defaults (#13412) 2025-01-19 15:01:44 +01:00
Tomas R. 85ce495603 Add sys._clear_internal_caches (#13411) 2025-01-19 15:01:08 +01:00
Tom Kuson 7f685ea517 Mark attributes in json.encoder as undocumented (#13408) 2025-01-19 15:00:04 +01:00
Ali Hamdan af00613477 optparse: Fix OptionParser types (#13339) 2025-01-19 14:59:14 +01:00
Ali Hamdan 70cf06799f Mark (c)math constants as final (#13410) 2025-01-19 13:35:09 +00:00
Tom Kuson a9aaf493b3 Add json.scanner.NUMBER_RE (#13405)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-01-18 13:36:10 -08:00
Tomas R. 2a461a2f79 Use a more precise return type for tokenize.untokenize() (#13366) 2025-01-16 20:59:29 +01:00
Stephen Morton 578af27510 add types.GenericAlias.__mro_entries__ (#13284) 2025-01-15 15:36:02 +01:00
Anthony Sottile 101287091c add "w:tar" as a mode for tarfile (#13401) 2025-01-14 17:26:25 +01:00
João Paulo Taylor Ienczak Zanette 1017916da2 xml: Add missing types for DocumentType's publicId and systemId (#13343) 2025-01-13 14:57:16 +01:00
Sebastian Rittau f26ad2059e Remove Python3.8 stubtest allowlists (#13389)
Consolidate remaining allowlists
2025-01-10 15:17:36 +01:00
Sebastian Rittau f2c917ff52 Remove redundant version branch (#13388) 2025-01-10 14:14:55 +01:00
Stephen Morton 2a030be2e9 fix ctypes.GetLastError (#13379) 2025-01-09 19:03:56 -08:00
pinterior 46cbe78e4c fix Telnet#expect (stdlib/telnetlib.pyi) (#13377)
fix type of Telnet#expect
2025-01-09 19:01:27 -08:00
Stephen Morton e55c13a612 update allowlist comment for SupportsAbs and SupportsRound (#13380)
The answer to the question is that mypy infers it just fine, but
stubtest doesn't check for attributes inherited from the metaclass
because that's almost never what we want. In this case,
the runtime implementation doesn't get __type_params__ from
builtins.type either. It's actually defined for the class due to
the use of PEP-695 syntax.
2025-01-09 14:00:54 -08:00
David Peter 614e9499f1 Annotate sys.platform as LiteralString (#13378) 2025-01-09 18:58:44 +01:00