Eric Traut
f72be7b6b4
Added optimization to monomorphize objects used in the code flow engine.
2024-07-13 20:59:39 -07:00
Eric Traut
1e218a2cfe
Fixed inconsistent behavior when evaluating a binary expression with an or
or and
operator when the LHS evaluates to a literal int
, str
, bytes
or bool
type. This addresses #8417 . ( #8418 )
2024-07-13 20:09:56 -07:00
Eric Traut
5192889fb5
Renamed fields in parse nodes to reduce verbosity and increase consistency.
2024-07-13 17:48:02 -07:00
Eric Traut
210bb144d7
Modified parser data structures to make parse nodes monomorphic and improve performance. ( #8416 )
2024-07-13 17:45:13 -07:00
Eric Traut
5ac7f49a3f
Eliminated maxChildDepth field from parse nodes.
2024-07-13 15:55:32 -07:00
Eric Traut
496822d3d0
Modified typing data structures to increase monomorphism for performance reasons. ( #8415 )
2024-07-13 14:43:45 -07:00
Eric Traut
17bd81a7de
Next step in attempting to make typing types monomorphic. ( #8413 )
2024-07-13 12:35:34 -07:00
Eric Traut
d2d0fdcd23
Did a small refactor of the FunctionType interface and eliminated a field. ( #8412 )
2024-07-13 10:50:07 -07:00
Eric Traut
2f1bce7b25
Fixed a bug that results in incorrect import resolution behaviors when a ".py" file and a directory have the same name, and the directory doesn't have a __init__.py
file in it. In this case, the ".py" file should take precedence during imports. This addresses #8408 . ( #8410 )
2024-07-13 09:50:07 -07:00
Eric Traut
897081901e
Did some refactoring and code cleanup in import resolver in preparation for a bug fix. ( #8409 )
2024-07-13 09:27:41 -07:00
Eric Traut
47ea13bc2d
Changed the type of the __doc__
attribute for a module to always be str | None
. Previously, pyright changed its declared type to str
if a docstring was present in the module, but this is incorrect because it's a writable value and can be set to None
. This addresses #8388 . ( #8397 )
2024-07-12 10:58:20 -07:00
Eric Traut
96ee9c6268
Changed union creation logic to retain (rather than elide) redundant literals in some cases. In particular, for type expressions that explicitly include literals along with their non-literal counterpart like Literal[1] | int
. Retaining these redundant subtypes can be useful for language server features like completion suggestions. This addresses #8392 . ( #8396 )
2024-07-12 09:52:22 -07:00
Eric Traut
30e139b5f8
Fixed a bug that results in a false positive reportOverlappingOverload
error in certain cases involving ParamSpec
and Concatenate
. This addresses #8389 . ( #8393 )
2024-07-12 08:51:34 -07:00
Eric Traut
71928e1b00
Changed the way FunctionParam objects are created so they are monomorphic. ( #8387 )
2024-07-12 00:02:29 -07:00
Eric Traut
2f88f837d0
Did some code cleanup in the types module. Eliminated a few unnecessary optional fields in common objects. ( #8386 )
2024-07-11 21:51:36 -07:00
Eric Traut
a740945cd7
Removed the builtinName
field from FunctionType. It can be represented by a flag more economically.
2024-07-11 20:49:26 -07:00
Eric Traut
2dffecb0f2
Added support for class declarations within an enum class body -- both with and without @member
and @nonmember
decorators. This addresses #8366 . ( #8385 )
2024-07-11 20:31:19 -07:00
Eric Traut
827684ac2e
Fixed a bug that results in false positive reportInconsistentConstructor
errors if one or both of __init__
or __new__
are overloaded. This addresses #8372 . ( #8383 )
2024-07-11 19:27:25 -07:00
Eric Traut
39d76a86e7
Fixed a recent regression that results in a false positive when the fully-qualified form of typing.Request
is used in an annotation expression. This addresses #8375 . ( #8381 )
2024-07-11 17:36:23 -07:00
Eric Traut
472d86519d
Improved consistency of parse node interface definitions. No functional change.
2024-07-11 16:56:22 -07:00
Rich Chiodo
d06b5999ca
Current working directory can't override OS so not necessary to remove it ( #8364 )
2024-07-10 10:49:42 -07:00
Eric Traut
109a9d03f8
Fixed bug in type narrowing logic for sequence pattern matching when a "star" entry in the pattern captures a TypeVarTuple. The resulting type should be Unknown
rather than the unpacked TypeVarTuple. ( #8365 )
...
Fixed bug that results in a false positive when assigning type `tuple[Any, ...]` to `tuple[*TS]`. This should be allowed because `tuple[Any, ...]` is a gradual form that is assignable to all tuple types.
This addresses #8357 .
2024-07-10 10:24:01 -07:00
Eric Traut
dded9fb056
Added support for negative type narrowing (in the fall-through case) for a mapping pattern consisting of a single dictionary expand entry. This should match all mapping types, eliminating them in the fall-through case. This addresses #8356 . ( #8363 )
2024-07-10 09:27:47 -07:00
Eric Traut
4c4767ef81
Fixed bug that can result in incorrect evaluation of a traditional (pre-PEP 695) type alias the defines a union which is later used as the second argument to an isinstance
or issubclass
call. This addresses #8358 . ( #8362 )
2024-07-10 08:19:14 -07:00
Eric Traut
8f82d8d3f6
Published 1.1.371
2024-07-09 15:29:04 -07:00
Rich Chiodo
d1b4d65616
Make python interpreter execution more secure ( #8341 )
...
* Make python interpreter execution more secure
* Fix test failure
2024-07-09 09:51:07 -07:00
Eric Traut
1925023629
Fixed bug that causes a false positive error when an __init_subclass__
has overloads. This addresses #8343 .
2024-07-08 22:59:40 -07:00
Eric Traut
f6dd5c5bef
Updated typeshed stubs to the latest version.
2024-07-08 19:36:37 -07:00
Eric Traut
d785aac750
Fixed type evaluation of old-style (pre-PEP 695) type alias that aliases a generic class when it is used as a direct constructor call. This addresses #8337 . ( #8338 )
2024-07-08 13:56:38 -07:00
Eric Traut
fd6081f12d
Did some general code cleanup in type evaluator including shortening names of some variables and functions for readability. ( #8330 )
2024-07-07 16:08:22 -07:00
Eric Traut
ab6fe409a6
Code cleanup for selfSpecializeClass.
2024-07-07 12:29:52 -07:00
Eric Traut
5332daa9cb
Small code cleanup in validateCallForFunction.
2024-07-07 11:59:28 -07:00
Eric Traut
04490f2645
Reformatted test samples using ruff.
2024-07-07 10:34:25 -07:00
Eric Traut
7d410cfbee
Improved handling of tuple expressions used in type expressions that involve specialization, such as dict[()]
. ( #8329 )
2024-07-07 10:06:08 -07:00
Eric Traut
f8bbf78ca5
Added code to TypeVar transform to update the boundToType and strippedFirstParamType. ( #8328 )
2024-07-07 09:55:03 -07:00
Eric Traut
4c001a139c
Improved type narrowing in the fall-through case for sequence patterns when the pattern includes a star pattern and the subject type is a tuple with an indeterminate entry. ( #8323 )
2024-07-06 14:44:46 -07:00
Eric Traut
228bd84c54
Fixed bug that results in false negative when a list
or set
expression includes more than 64 elements and is being evaluated with a bidirectional inference context. This addresses #8314 .
2024-07-06 11:51:09 -07:00
Eric Traut
1c85d650ae
Fixed bug that results in a false positive error when using a TypeVar with an upper bound of type
as a base class in a class
statement. This addresses #8313 . ( #8321 )
2024-07-06 11:47:37 -07:00
Eric Traut
3ddf0ad705
Improved detection of the use of variables used in type annotations. These are illegal according to the typing spec. ( #8318 )
...
This addresses #8316 .
2024-07-06 10:18:21 -07:00
Eric Traut
598119b90f
Fixed bug that results in a false positive error when an unpack operator is used in an unparenthesized tuple expression on the RHS of an augmented assignment operator on Python 3.9 and newer. This addresses #8310 .
2024-07-05 09:27:25 -07:00
Eric Traut
8a23d8f596
Fixed bug that results in --outputjson
command-line option being incompatible with --threads
command-line option.
2024-07-05 09:10:49 -07:00
Eric Traut
057b351efa
Added support for multithreaded type checking in CLI. ( #8309 )
2024-07-04 20:52:37 -07:00
Eric Traut
746749272c
Exposed maxSourceFileSize
from sourceFile module.
2024-07-04 17:54:51 -07:00
Eric Traut
4fd12df54a
Added functions for converting diagnostics to/from a form that is compatible with JSON serialization.
2024-07-04 17:54:15 -07:00
Eric Traut
4df7ba72a0
Revert "Improved the internal name given to a class that is created through the explicit instantiation of a metaclass."
...
This reverts commit 8792e4e493
.
2024-07-03 14:48:48 -07:00
Eric Traut
8792e4e493
Improved the internal name given to a class that is created through the explicit instantiation of a metaclass.
2024-07-03 14:47:04 -07:00
Eric Traut
8ed6c10486
Changed the hard-coded type of the __class__
symbol to be Self@T
rather than T
(where T
is the enclosing class). This addresses #8305 . ( #8307 )
2024-07-03 14:45:58 -07:00
Eric Traut
d7c5d0691a
Fixed regression that results in a false positive when a traditional type alias (not using PEP 695 syntax) defines a union and is then used as a second argument to an isinstance
or issubclass
call. This addresses #8302 . ( #8303 )
2024-07-03 12:27:02 -07:00
Eric Traut
93ac52f0b2
Published 1.1.370
2024-07-02 16:45:35 -07:00
Eric Traut
0591abaae8
Fixed bug that results in a false positive reportUntypedFunctionDecorator error under certain circumstances. This addresses #8298 .
2024-07-02 16:40:34 -07:00