Shantanu
f5d7efa8bf
Use consistent definition of NotImplementedType ( #14971 )
2025-11-03 08:51:14 +01:00
Randolf Scholz
7fde97036f
Move NotImplementedType to types.pyi ( #14966 )
2025-11-02 15:00:52 +01:00
Sebastian Rittau
be34e9201d
Change type.__dict__ to a proper attribute ( #14951 )
2025-11-01 03:00:14 +01:00
Maxime Arthaud
4c4f999717
Add explicit definition for __repr__ and __str__ in BaseException ( #14900 )
2025-10-20 14:17:08 +01:00
Thanos
be7e7c5e2b
Restrict filename parameter of compile() (and other stdlib functions wrapping compile()) to take bytes, not Buffer. ( #14847 )
2025-10-08 16:32:16 +02:00
Sebastian Rittau
bee1e1f551
Add default argument values to builtin types ( #14824 )
...
Mark two exception `name` arguments as being potentially `None`
2025-10-02 14:56:35 +02:00
KotlinIsland
fc1062ca29
fix type.__or__ ( #14813 )
...
Co-authored-by: Alex Waygood <alex.waygood@gmail.com >
2025-10-01 11:02:16 +01:00
Thanos
16c4e13e41
Allow __import__ to take None for the fromlist parameter ( #14790 )
2025-09-30 12:36:53 +02:00
Brian Schubert
b2777f4cbb
Mark stub-only types with runtime aliases as @type_check_only in stdlib ( #14717 )
2025-09-14 19:57:39 +02:00
Jelle Zijlstra
bf484ab320
Add @disjoint_base to builtins.tuple ( #14683 )
2025-09-07 00:36:57 +01:00
Jelle Zijlstra
e8ba06f710
Add @disjoint_base decorator in the stdlib ( #14599 )
...
And fix some other new stubtest finds.
2025-08-24 07:27:14 -07:00
Brian Schubert
953e21bafa
Add __format__ overrides to complex, float, int, and str ( #14523 )
2025-08-05 17:56:36 -04:00
Brian Schubert
622df68c1c
Add @type_check_only to stub-only private classes in stdlib ( #14512 )
2025-08-03 10:13:16 +02:00
Sebastian Rittau
7e16c80989
Remove some pytype workarounds from stdlib ( #14470 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com >
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-07-27 11:56:26 +01:00
Brian Schubert
f88a09d479
Add @type_check_only to various typeshed-only procotols in stdlib ( #14465 )
...
Mark various typeshed-only protocols as `@type_check_only` in stdlib
2025-07-26 20:02:17 +01:00
David Peter
f64707592d
bytes.translate: generalize delete parameter type (#14372 )
...
bytes.translate: generalize 'delete' parameter type
2025-07-07 00:19:23 -07:00
Sebastian Rittau
033c85df99
Remove old cycle-prevention workaround ( #14180 )
...
This was used to prevent an import cycle that exists
anyway nowadays via `_typeshed`.
2025-05-28 11:31:36 +02:00
sobolevn
d574139e6c
Update builtins to 3.14 ( #14161 )
2025-05-26 15:47:09 -07:00
sobolevn
204ec1273f
Correct bool.__invert__ deprecation message ( #14147 )
2025-05-26 11:12:26 +02:00
Max Muoto
9ea05e6289
Add missing builtin dunders (3.14) ( #14120 )
2025-05-21 21:52:35 -07:00
Max Muoto
1c5164f069
Add from_number for float, complex, and Fraction (3.14) ( #14091 )
2025-05-17 22:09:59 -07:00
Jelle Zijlstra
9430260770
builtins: improve builtins.function ( #14094 )
...
Remove two differences from types.FunctionType that should be
safe to clean up.
2025-05-17 19:43:22 +02:00
Max Muoto
7fbf9c7927
Update exception group to match clinic generated arguments ( #14088 )
2025-05-16 20:50:00 -07:00
Sebastian Rittau
b444909873
Copy typechecker-internal symbols to _typeshed._type_checker_internals ( #13816 )
2025-05-11 16:07:53 +02:00
Jelle Zijlstra
5ff32f377c
3.14: add annotationlib, update typing and inspect ( #13985 )
2025-05-10 14:25:06 -07:00
Max Muoto
b64e741a4a
Add strict argument for map (3.14) ( #13987 )
2025-05-10 20:21:41 +02:00
Alex Waygood
d92a6449c2
Remove more Python 3.8 cruft ( #13787 )
2025-04-03 11:56:38 +01:00
David Peter
ad8ecaf217
property.__get__: overload to model class-access behavior (#13769 )
2025-04-02 15:09:56 +02:00
Joren Hammudoglu
5513d3f19b
Drop Python 3.8 support in builtins ( #13762 )
...
* remove py38 branches in `builtins`
* combined `builtins.dict` tests with those exclusive to `>=3.9`
2025-04-02 09:01:36 +02:00
Stephen Morton
846d167f51
Fix default of dict.get ( #13222 )
2025-03-09 13:44:27 +01:00
Avasam
cc206f760d
Drop flake8-noqa and remove workarounds to work with Ruff ( #13571 )
2025-03-03 15:48:59 +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
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
Stephen Morton
17408ee538
fix the __init__ of several C-classes ( #13211 )
2024-12-23 10:55:51 -08:00
bzoracler
9497f8aebf
Remove value attribute from builtins.StopAsyncIteration ( #13275 )
2024-12-21 12:24:36 -08:00
Stephen Morton
4aad825db3
fix the weird special builtins ( #13213 )
2024-12-08 00:18:15 +00:00
Stephen Morton
11ec1a10fd
Improve the SyntaxError constructor; add SyntaxError.print_file_and_line ( #13141 )
2024-11-27 22:21:48 +00:00
Joren Hammudoglu
480b1ac2e6
Only accept type[Self] in the object.__class__ setter ( #13021 )
2024-11-18 12:34:36 +01:00
Rebecca Chen
ea368c7269
Type __call__ on builtins._NotImplementedType as None. ( #12984 )
...
Currently, this is intentionally incorrectly typed in order to produce a
better mypy error message. But pyright (and presumably other type checkers)
end up just treating instances of _NotImplementedType as callable.
With this change, the mypy error message gets a little worse, but other type
checkers can understand that instances of _NotImplementedType aren't
callable, which I think is an improvement.
2024-11-08 13:05:56 -08:00
Brian Schubert
dafd67c2cc
Mark OSError.strerror as sometimes None ( #12974 )
2024-11-07 08:08:28 -08:00
Sam Bull
601ce5a4b0
OSError.errno can be None ( #12910 )
2024-10-27 20:51:23 +00:00
Randolf Scholz
10183237c7
Make all params positional-only in slice.__new__ ( #12900 )
...
positional only __new__
2024-10-24 18:02:33 +01:00
Thanos
65405e9ef2
Make slice generic ( #11637 )
2024-10-24 17:40:29 +02:00
AlbertXingZhang
783171b9f7
correct memoryview __setitem__ method signature ( #12876 )
2024-10-24 12:09:38 +02:00
Stephen Morton
925b3a3713
Remove redundant inheritances from Iterator in builtins ( #12851 )
2024-10-21 14:40:07 +02:00
bersbersbers
b78b3f10ba
slice is hashable starting with Python 3.12 (#12832 )
2024-10-17 09:17:38 +02:00
Jelle Zijlstra
2370b8b9d1
memoryview: re-add inheritance from Sequence, set index and count to None (#12800 )
...
This reverts commit f625e92ae5 .
2024-10-16 07:27:56 -07:00
Max Muoto
5fcd375815
Set default for enumerate's start argument ( #12796 )
2024-10-13 06:01:00 +02:00
Trim21
f625e92ae5
memoryview: remove inheritance from Sequence (#12781 )
...
It doesn't have `index`, `count` or `__reversed__` methods
2024-10-11 17:47:51 +01:00