Commit Graph
5900 Commits
Author SHA1 Message Date
Alyssa CoghlanandGitHub 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 PeterandGitHub 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
AvasamandGitHub 24c78b9e0d http.server.SimpleHTTPRequestHandler's directory param can be PathLike (#13477) 2025-02-09 21:42:41 +00:00
M BussonnierandGitHub 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
AvasamandGitHub 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 WaygoodandGitHub 5caaf2e1fb Fix stdlib stubtest for latest Python patch releases (#13464) 2025-02-05 23:33:27 +00:00
/ˈɛvən/andGitHub aac4394eb2 tkinter: allow index to be "end" in Treeview.move (#13454) 2025-02-03 14:43:28 +02:00
Ali HamdanandGitHub a0db1ba8dc Mark optparse constants as final (#13451) 2025-02-03 09:05:41 +01:00
Ali HamdanandGitHub 30a4d10b71 Mark top-level re flags as final (#13452) 2025-02-03 09:04:52 +01:00
Ali HamdanandGitHub fd92105daa Mark constants in sre_constants as final (#13453)
Replace one use of Any
2025-02-03 09:04:03 +01:00
Ali HamdanandGitHub 89b5afab15 Clean up argparse hacks (#13450) 2025-02-01 13:11:40 -08:00
Alex WaygoodandGitHub c193cd2a36 Upgrade Black and Ruff (#13443) 2025-01-29 22:47:58 +00:00
Alyssa CoghlanandGitHub 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 HamdanandGitHub 31bff4a503 Improve decimal constants and fill missing defaults (#13412) 2025-01-19 15:01:44 +01:00
Tomas R.andGitHub 85ce495603 Add sys._clear_internal_caches (#13411) 2025-01-19 15:01:08 +01:00
Tom KusonandGitHub 7f685ea517 Mark attributes in json.encoder as undocumented (#13408) 2025-01-19 15:00:04 +01:00
Ali HamdanandGitHub af00613477 optparse: Fix OptionParser types (#13339) 2025-01-19 14:59:14 +01:00
Ali HamdanandGitHub 70cf06799f Mark (c)math constants as final (#13410) 2025-01-19 13:35:09 +00:00
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.andGitHub 2a461a2f79 Use a more precise return type for tokenize.untokenize() (#13366) 2025-01-16 20:59:29 +01:00
Stephen MortonandGitHub 578af27510 add types.GenericAlias.__mro_entries__ (#13284) 2025-01-15 15:36:02 +01:00
Anthony SottileandGitHub 101287091c add "w:tar" as a mode for tarfile (#13401) 2025-01-14 17:26:25 +01:00
João Paulo Taylor Ienczak ZanetteandGitHub 1017916da2 xml: Add missing types for DocumentType's publicId and systemId (#13343) 2025-01-13 14:57:16 +01:00
Sebastian RittauandGitHub f26ad2059e Remove Python3.8 stubtest allowlists (#13389)
Consolidate remaining allowlists
2025-01-10 15:17:36 +01:00
Sebastian RittauandGitHub f2c917ff52 Remove redundant version branch (#13388) 2025-01-10 14:14:55 +01:00
Stephen MortonandGitHub 2a030be2e9 fix ctypes.GetLastError (#13379) 2025-01-09 19:03:56 -08:00
pinteriorandGitHub 46cbe78e4c fix Telnet#expect (stdlib/telnetlib.pyi) (#13377)
fix type of Telnet#expect
2025-01-09 19:01:27 -08:00
Stephen MortonandGitHub 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 PeterandGitHub 614e9499f1 Annotate sys.platform as LiteralString (#13378) 2025-01-09 18:58:44 +01:00
Maico TimmermanandGitHub 3de624f980 Improve return type for socket.getaddrinfo for missing ipv6 support (#13372) 2025-01-06 14:40:07 +01:00
Max MuotoandGitHub 88e917a87b Fix types in _interpqueues and _interpreters (#13355) 2025-01-02 13:04:23 -08:00
Peter BiermaandGitHub 1244636a01 Add stub for sys._is_gil_enabled() (#13358) 2025-01-02 12:28:32 -08:00
Konstantin BaikovandGitHub 4ce9f24f39 Add some defaults to tkinter.filedialog (#13345)
Partially fixes: https://github.com/python/typeshed/issues/11482

Source of fixes based on the @akuli comment: https://github.com/python/typeshed/issues/11482#issuecomment-1981710718
2025-01-01 22:00:22 +02:00
Ali HamdanandGitHub 03167c8cad optparse: Improve Values types (#13338) 2024-12-29 18:16:18 -08:00
Ali HamdanandGitHub 7d925307cf optparse: Improve Option and OptionContainer types (#13337)
optparse: Improve Option and OptionContainer types

Also add comments for use of `Any`
2024-12-29 18:14:22 -08:00
Bartosz SławeckiandGitHub 7febf03741 Make signal global enum constants annotated as literals (#13336) 2024-12-29 18:11:42 -08:00
Refael AckermannandGitHub ca6251ad64 stdlib: new signature for CDLL in 3.12 (#13313) 2024-12-29 17:24:12 -08:00
Konstantin BaikovandGitHub d69a864a88 Use SupportsWrite in curses instead of IO Any (#13325)
The source used to deduce  this: https://github.com/python/cpython/blob/aea2e03b276c79f8934d17056a68899e69763fae/Modules/_cursesmodule.c#L2158
2024-12-29 17:12:42 -08:00
Ali HamdanandGitHub ce36fd4b8c argparse: Use SupportsWrite instead of IO (#13324) 2024-12-29 17:12:13 -08:00
Stephen MortonandGitHub 801c5c9495 improve identity of threading module's Lock and RLock (#12966) 2024-12-28 08:00:04 -08:00
ab75b691c2 Make collections.abcs more consistent with runtime implementation (#10816)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-12-27 21:31:59 -08:00
Stephen MortonandGitHub a4b7c36366 add missing things in multiprocessing (#13153) 2024-12-27 21:13:30 -08:00
Max MuotoandGitHub 92231a5728 Update tkinter.Misc for 3.13 (#12367) 2024-12-27 20:59:32 -08:00
Stephen MortonandGitHub 87267342d5 add asyncio.__all__ (#13038) 2024-12-27 20:58:40 -08:00
Stephen MortonandGitHub abed9a8b55 Protocol inheritance for typing_extensions.SupportsX classes (#13010)
At runtime, depending on the version of python,
these inherit from typing_extenstions.Protocol
instead of typing.Protocol.
2024-12-27 20:53:44 -08:00
Stephen MortonandGitHub 4c5f85be88 fixes for unittest.runner (#13205) 2024-12-27 20:09:30 -08:00
Stephen MortonandGitHub 43f637b5e2 add _GeneratorContextManagerBase.__init__ (#13246)
I think that #6676 showed that Paramspec didn't work, but that
wasn't actually the fault of _GeneratorContextManagerBase.
2024-12-27 20:04:57 -08:00
Stephen MortonandGitHub b29e26a628 select.poll is not available on windows (#13243) 2024-12-27 20:04:24 -08:00
Stephen MortonandGitHub 897b350729 fix deprecated ast classes (#13285) 2024-12-27 20:01:53 -08:00
Jacob WallsandGitHub cc65d01b44 Add csv.Dialect to second arg of register_dialect() (#13294) 2024-12-27 20:01:09 -08:00