Commit Graph
7150 Commits
Author SHA1 Message Date
Mikhail Golubevandintellij-monorepo-bot 0bdf5b4c7d fixup! PY-86002 Disable "python.typing.strict.unions" and revert the tests updated for PY-24834 in 253
Revert the revert of test changes that are not directly related to strict unions.


(cherry picked from commit 8a76bd91e040ad97e8ed680161f28370c84920f8)

IJ-MR-184619

GitOrigin-RevId: 4c293de3ecc3c8cb16869532fccc639e8c5a17ae
2025-12-03 20:58:50 +00:00
Mikhail Golubevandintellij-monorepo-bot 060b900cf9 PY-86002 Revert also PY-25989 PY-84544 to fix new test failures after the revert to weak unions
Namely, `generics_basic.py` in the conformance test suite and
Py3TypeCheckerInspectionTest.testTypeVarWidening.

Revert 07803c6243370d55df0d870e2e32b38170c1fb49


(cherry picked from commit 9c334ef32597be1d1e8fbc3251ac267be46555c8)

IJ-MR-184619

GitOrigin-RevId: 4b2440c973d9c7a7a42590665bd473c4e7a4c9cf
2025-12-03 20:58:50 +00:00
Mikhail Golubevandintellij-monorepo-bot 7c1fa29f39 PY-86002 Adjust PyUnnecessaryCastInspectionTest.test okay expected result
`UnsafeUnion[int | str]` is considered a subtype of `str`, so the cast is redundant.


(cherry picked from commit 550a9d55715564492169175c5e20cfbf1ade4b20)

IJ-MR-184619

GitOrigin-RevId: 854131d04308bd97b12ef06cc10a4aa89238c9ef
2025-12-03 20:58:50 +00:00
Mikhail Golubevandintellij-monorepo-bot 3a75cb758c PY-86002 Update some tests introduced after PY-24834 to expect legacy unions
(cherry picked from commit 04d02eb3f87e8c38f50e89510c79c2a1c99e3936)

IJ-MR-184619

GitOrigin-RevId: 272214615275714ca0defcb24f6cf3f66d74382d
2025-12-03 20:58:50 +00:00
Mikhail Golubevandintellij-monorepo-bot fd524cbe67 PY-86002 Disable "python.typing.strict.unions" and revert the tests updated for PY-24834 in 253
(cherry picked from commit 3df7847e2f94e8368e15e331f16a2254154e63fa)

IJ-MR-184619

GitOrigin-RevId: 213aedec5242143c1456450c214deb6f6e0fd60e
2025-12-03 20:58:50 +00:00
Pavel Karateevandintellij-monorepo-bot 9285fded89 [python] PY-83029 fix compatibility inspection tests
`testBreakInFinallyBlock` and `testReturnInFinallyBlock`
were testing vs. latest language level, so apart from
the compatibility warning (for which these tests are
intended) - a corresponding syntax error was captured

I made these tests to use a specific language level
so they only verify the correctness of the compatibility
inspection and introduced four tests in `PythonHighlightingTest`
to capture the syntax error


(cherry picked from commit 254570dc4d5022176590377eaf8ea6a08917937a)

IJ-MR-182362

GitOrigin-RevId: fb9c92923820b370672451c5753ee24bdd5a4570
2025-12-02 11:21:12 +00:00
Pavel Karateevandintellij-monorepo-bot b257c225d2 [python] PY-83029 fix tests
(cherry picked from commit 64d9931ee762c8ac801114e22952f3086235467a)

IJ-MR-182362

GitOrigin-RevId: bcf515ae4f73cd3d44dc81a54c1acd1fbfb33c18
2025-12-02 11:21:12 +00:00
Morgan Bartholomewandintellij-monorepo-bot 723fb8c8d6 fixup! [PY-6591] use PyCodeInsightSettings.PREFER_FROM_IMPORT when moving module reference
(cherry picked from commit e194ea47c00647d67067377a63ff257609399c38)

IJ-MR-183300

GitOrigin-RevId: afc726fa9f2e556833f09d41e5d5f77469ca7fa6
2025-11-27 11:52:20 +00:00
Morgan Bartholomewandintellij-monorepo-bot 6d2db28b86 [PY-6591] use PyCodeInsightSettings.PREFER_FROM_IMPORT when moving module reference
(cherry picked from commit 2458902032ff1078689a2a641dfaa29e522148a5)

IJ-MR-183300

GitOrigin-RevId: f101d8aac2ad92af83ad6716a15865238856abb7
2025-11-27 11:52:20 +00:00
Mikhail Golubevandintellij-monorepo-bot c298afb0e5 [python] PY-83347 Support mapping positional-only parameters to unpacked arguments
(cherry picked from commit 410737d5b913010933a0a2e0a2c350ff81925ee6)

IJ-MR-180323

GitOrigin-RevId: 1e0aa756a385dc498f04865e2ee99d7c7a0418e0
2025-11-26 19:08:59 +00:00
Petrandintellij-monorepo-bot 241ba26253 PY-25989 PY-84544 Widen types during type parameters substitution
(cherry picked from commit 627673fc7ed27621df839a5c1d4d31e677ce7f8c)

GitOrigin-RevId: 07803c6243370d55df0d870e2e32b38170c1fb49
2025-11-26 18:52:04 +00:00
Alexey Katsmanandintellij-monorepo-bot 10e67083be PY-85634 Move PyInterpreterInspection to a separate package
Follow-up to IJ-MR-178613

GitOrigin-RevId: e2508fd5a34b9684ae464611f1434ccff874ddbc
2025-11-25 18:47:50 +00:00
chbndrhnnsandintellij-monorepo-bot 861247150d [PY-84659] Moving a symbol respects PyCodeInsightSettings.PREFER_FROM_IMPORT for qualified usages
(cherry picked from commit 00c7867db4fa463c6a2eabb32bfa181bb25311d6)

GitOrigin-RevId: 83c0b47a97bbbd8f74279766eecefc05b3381784
2025-11-24 04:18:16 +00:00
Morgan Bartholomewandintellij-monorepo-bot 470e4f879a [python] PY-28130 infer lambda parameter type from expected type
GitOrigin-RevId: e98338828b8fb9b2b3e33c57995345731f53dccb
2025-11-21 06:57:57 +00:00
evgeny.bovykinandintellij-monorepo-bot 1dc2650b56 Fix infinite recursion in PyReferenceImpl#changePropertyMethodToSameNameGetter
Avoid converting function to property getter when the reference we are resolving sits inside a property(...) call (e.g., property(__getX))

In such context we actually need the bare function, not the property


(cherry picked from commit a0409fde44955dd5407e3dcdb4fde339d6ba779b)

IJ-MR-172702

GitOrigin-RevId: 537436bef686f3f49c940231b815922c5a0a133a
2025-11-19 13:10:40 +00:00
evgeny.bovykinandintellij-monorepo-bot ccacedc456 Fix an infinite recursion in PyNamedParameterImpl#getTypeFromUsages
Use `context.assumeType` to avoid an infinite recursion while processing local variables and getting the type from usages

See tests `PyTypeTest#testAnyIsNone` and `PyTypeTest.testParameterFromUsages` for an example


(cherry picked from commit c68125b556e264d99a0bd5217827e11a666ca2e4)

IJ-MR-172702

GitOrigin-RevId: b0ee153f1164033aa97195f9a2f015c771ce7c44
2025-11-19 13:10:40 +00:00
evgeny.bovykinandintellij-monorepo-bot 59df203089 PY-84469 Consider ClassVar when matching protocol and a concrete class
(cherry picked from commit 76af969cfe9318049f02dc7f6bdd03fe20a9504f)

IJ-MR-174248

GitOrigin-RevId: b34de32baf939e812169976761acd41eaa8aba38
2025-11-19 13:05:44 +00:00
evgeny.bovykinandintellij-monorepo-bot 1331c92868 PY-84464 Support @property decorator when matching a protocol and its implementation
(cherry picked from commit fcbeeb57323336c7d921edad373ea595ef687d6b)

IJ-MR-174248

GitOrigin-RevId: 6c44a1a7af026faaf4a5e9c1242ed29f3fb94e0e
2025-11-19 13:05:44 +00:00
evgeny.bovykinandintellij-monorepo-bot 59d7739bd6 PY-84461 Don't consider attributes assigned in protocol functions for protocol matching
(cherry picked from commit 5e540caf9f11b78036785cb94d189c91d1899c97)

IJ-MR-174248

GitOrigin-RevId: 53c1179c86cda95a72e57cbf08075c6e1b20aa2c
2025-11-19 13:05:44 +00:00
evgeny.bovykinandintellij-monorepo-bot 93b61ddfac PY-63802 Implement PyChangeLocalityDetector to fix disappearing highlighting when changing whitespace at the top level
By default, when only changing whitespace at the top level, DefaultChangeLocalityDetector would trigger and say that only the changed whitespace should be rehighlighted. However, highlighting for a whole file would still be dropped. After that, PyUnusedLocalInspection would not be triggered for any function in that file, meaning it would not re-highlight them, leading to an inspection warning disappearing.

Now, PyChangeLocalityDetector triggers when changing a whitespace on a top level and triggers re-highlighting of the whole file

Performance consideration: re-highlighting the whole file might be expensive (that's why ChangeLocalityDetector was introduced in the first place). However, no other ChangeLocalityDetector is implemented for Python, so most of the time the whole file is re-highlighted anyways. Re-highlighting the whole file in a new niche case of changing whitespace at the end of the file shouldn't lead to any significant performance impact.


(cherry picked from commit 8f26c59da8501f8eac78d1280888dd49ffef28d4)

IJ-MR-179295

GitOrigin-RevId: c7adf278a888fc0246351ea399e47784e6788de5
2025-11-19 09:13:13 +00:00
Petrandintellij-monorepo-bot c1c6c8c945 PY-83529 Make type name reasonable (PyModuleType, PyImportedModuleType)
(cherry picked from commit a5f8641bcae3cd01eb7ff174e289cbf3ca5e3b2b)

GitOrigin-RevId: 41050e03a015e79c74ff54a390090e5e5f70d783
2025-11-12 17:28:36 +00:00
Petrandintellij-monorepo-bot 3a58a09cbe PY-83529 Do not resolve to empty skeleton package modules
(cherry picked from commit 699b50ea5e2be24852fc1c07acb4d372e760a251)

GitOrigin-RevId: 7270c13b1973eb00d88c4f7f6c71ac1a54291428
2025-11-12 17:28:36 +00:00
Petrandintellij-monorepo-bot c6222fa129 PY-83529 Add tests for binary skeletons resolution
(cherry picked from commit 419975ed4ccbc4690cabe4f57307b0d6ad4fbc1e)

GitOrigin-RevId: cff0c0137a2f0b51ded1da567baf6fa9ed7c5e6f
2025-11-12 17:28:35 +00:00
Petrandintellij-monorepo-bot dc664f0c32 PY-83529 Rename test for clarity
(cherry picked from commit c6191d6c7d9863686731b2f9d9841e732a69c7d1)

GitOrigin-RevId: f1b71cb5edcab323458c2beb5e4eacd885cbcd8d
2025-11-12 17:28:35 +00:00
Petrandintellij-monorepo-bot 36a9350c68 PY-83529 Don't copy SDK files to the project directory (PyMultiFileResolveTest.testImportOfNestedBinarySubModule)
(cherry picked from commit 3e4d34471b4a0d2f62942848a4bca8f35ddf7b4b)

GitOrigin-RevId: 32bf037e15593bbc124eaaab8fc207e321349888
2025-11-12 17:28:35 +00:00
Morgan Bartholomewandintellij-monorepo-bot a453fede94 [python] PY-35730 use NonAsciiCharactersInspection to report non-ascii characters in python regular expressions
(cherry picked from commit d80469c6b698863b8986a7c9486fb7e69c418fcf)

GitOrigin-RevId: 2400ea51b7b3b3d72011195ca336e4cf69d17931
2025-11-12 10:47:17 +00:00
Marcus Mewsandintellij-monorepo-bot 8ccd3203c2 PY-84484 Pycharm hangs when trying to call specific constructor
(cherry picked from commit b15a3bab218f72c1e9c717facfbff3e91eeea13f)

IJ-MR-180106

GitOrigin-RevId: 88614fddf666e170b71ef38fa4adffa9fa75da0a
2025-11-11 08:44:56 +00:00
Morgan Bartholomewandintellij-monorepo-bot b28a735dfc [python] PY-61777 support python 3.11 regex features
(cherry picked from commit 91f2efe47546d0189840d3f3d21da39483de440f)

GitOrigin-RevId: 35c7b142f27130205916522c1bd8c66577be9395
2025-11-08 09:40:03 +00:00
Morgan Bartholomewandintellij-monorepo-bot 714f57764d [python] PY-21499 support regex injection for regex module
(cherry picked from commit 3f5a4db6967534e746650b8ea10ad4d6a29a0363)

GitOrigin-RevId: 4db040ead1a80f49b78378267aeb35b350818069
2025-11-07 00:46:02 +00:00
chbndrhnnsandintellij-monorepo-bot 50fa4b90d2 [python] PY-63483, PY-83912, PY-70815 False positive warning Fixture '...' is not requested by test functions for attributes
Merge-request: IJ-MR-181099
Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com>

(cherry picked from commit 7299d76d38ae5a823a3b0cae7ba5e2a0cc693d13)

IJ-MR-181099

GitOrigin-RevId: 82be14096cccf01de85fcf7f7abb4af2fd838193
2025-11-05 16:53:26 +00:00
Morgan Bartholomewandintellij-monorepo-bot bd2c7616a2 [python] PY-85012 fix PyGotoDeclarationHandler for multi assigned local variables
(cherry picked from commit 27ae2bddd6c2b0b17a8bd2ace3c8da0229afc710)

IJ-MR-180935

GitOrigin-RevId: 02d9e5f80813fb326d0fa0c9aec38e0caec32bb5
2025-11-05 09:16:01 +00:00
chbndrhnnsandintellij-monorepo-bot 5579292ff3 [python] PY-59260 False positive assigining IntFlag enum value to an annotated variable
(cherry picked from commit 1b231b0917c41032255e90b3f524fc3d6201e80e)

IJ-CR-181224

GitOrigin-RevId: e2969be0fd18d29a1c2ba00a7ac3ad1a87edf79e
2025-11-03 22:58:33 +00:00
Alexey Katsmanandintellij-monorepo-bot 27838bc2da PY-84953: Unify tool detection approach
Our tool detection approach varies a lot. We have different logic for
uv, poetry and other tools. Also, uv detection is not suspendable and
doesn't have any explicit thread requirements, even though it performs
I/O operations.

This change makes such detection unified and suspendable (where
possible) and moves it to BGT.

GitOrigin-RevId: 18e9c4cc085c8d373c82ad2874033b53711f09c6
2025-11-03 16:25:22 +00:00
evgeny.bovykinandintellij-monorepo-bot 96a0d7da31 PY-84538 Report protocol instantiation as an error
(cherry picked from commit ad941a5d9a5fb852b0c28cbf259fdcc5ce3f3efb)

IJ-MR-173617

GitOrigin-RevId: 97c2b967b5a2c42d0f1c6c5f09a65beb64bd634c
2025-11-03 16:01:01 +00:00
Daniil Kalininandintellij-monorepo-bot 489b9b90aa [inspections] PY-85120 Do not consider expressions like a: list[int] | None = None a type alias
Target expression should have either explicit `TypeAlias` annotation or valid type expression in assignment without type annotation (to be considered implicit type alias)

(cherry picked from commit 1059a8df2d221bd068eee706139be20c256df549)

GitOrigin-RevId: 8c952138fbc4124f02f717ce8a1784c1f0dc86b2
2025-11-03 10:33:56 +00:00
Daniil Kalininandintellij-monorepo-bot 1b197eb884 PY-85080 Add quick-fix to remove unused Type Parameters
(cherry picked from commit cbb9b8136d07350075a9af8b4bc5aaa8891edd73)

GitOrigin-RevId: 81c1ddc810da8ce9619fdb679a26938bdecdb38e
2025-11-03 10:33:56 +00:00
Daniil Kalininandintellij-monorepo-bot 7d46075b5f PY-84107 Fix Type Parameters mistakenly reported as unused in PyUnusedLocalInspection
(cherry picked from commit 0593c2290aa1c84dde96673297374efef2b27fc3)

GitOrigin-RevId: 56de9b7a6b305eb9e88dc2bf8281c93f788eae80
2025-11-03 10:33:56 +00:00
Daniil Kalininandintellij-monorepo-bot fcf1abdbb7 PY-84570 Do not consider bare list literal as a valid type alias
(cherry picked from commit f0bcd2445735caa7917944351140a2877d0b4ffe)

GitOrigin-RevId: 5f0a0bff41ee01b4e8b4f7e73c1062d523854c2c
2025-11-03 10:33:56 +00:00
Aleksandr.Govenkoandintellij-monorepo-bot 8c745a5c22 PY-83339 Narrow X | None type to X after assert x
(cherry picked from commit a49863065bf26f615100b21f423a650cbebbcab3)

IJ-MR-178978

GitOrigin-RevId: 4bf02cab1e94a2ab1aaa70cb0b4578688cea88b9
2025-10-31 06:18:26 +00:00
Alexey Katsmanandintellij-monorepo-bot fd7ad7fcd7 [python] PY-82518 Support GraalPy python version
(cherry picked from commit 3311ca83f0875a77c0fd370d5d66afc66f7393ca)

IJ-MR-178647

GitOrigin-RevId: 1d3583e8524ccee70a90918dfa57e11bd51c9641
2025-10-16 15:53:59 +00:00
Vitaly Legchilkinandintellij-monorepo-bot 5e2028d129 [python] (PY-78749) single dialog for all types of Python SDKs
+ old dialogs were removed

GitOrigin-RevId: 00ed85ba578c6419373d8605ed50954e7aa58f0a
2025-10-13 22:54:32 +00:00
Vitaly Legchilkinandintellij-monorepo-bot 84934e9e9e [python] (IJPL-205889) (BAZEL-2462) don't call getOrCreateAdditionalData for non-python sdks
+ add requirePythonSdk() verification for the Sdk extension functions, these methods are not designed to be called for non-python sdks and now will throw IllegalArgumentException.

also corrects dependency tree:
+ move PythonSdkUtil to the python.sdk module, remove dependency on psi.impl
+ create PySkeletonUtil for skeleton utils and leave it in the psi.impl

[python] (IJPL-205889) (BAZEL-2462) don't call getOrCreateAdditionalData for non-python sdks

+ add requirePythonSdk() verification for the Sdk extension functions, these methods are not designed to be called for non-python sdks and now will throw IllegalArgumentException

also corrects dependency tree:
+ move PythonSdkUtil to the python.sdk module, remove dependency on psi.impl
+ create PySkeletonUtil for skeleton utils and leave it in the psi.impl

GitOrigin-RevId: 20d958c5e15cc4e05545b2e61b126b5e015696ed
2025-10-10 18:17:28 +00:00
Ilya.Kazakevichandintellij-monorepo-bot 2888d207d9 PY-82580: pyproject.toml refactoring to combine all pyproject.toml EPs to single API
The main idea is to decouple tool implementation from low-level platform APIs: Open project processor, workspace model e.t.c.
Implementing `spi.Tool` should be enough to introduce new tool.

GitOrigin-RevId: 1177b57fc0eee1ca2c88cac5b20618a6170bf521
2025-10-01 02:21:16 +00:00
Morgan Bartholomewandintellij-monorepo-bot eafca8d96d [python] fix builtins.callable
Merge-request: IJ-MR-177060
Merged-by: Morgan Bartholomew <morgan.bartholomew@jetbrains.com>

GitOrigin-RevId: 2ec5c5ea1cc4183d757351f051b914a456ff15d8
2025-09-30 14:29:43 +00:00
Aleksandr.Govenkoandintellij-monorepo-bot 663b57857e PY-83597 False positive type narrowing in expressions with "and"
GitOrigin-RevId: e39cae3490ef0f0f151842f428a45d14d2c4d9ed
2025-09-30 10:30:37 +00:00
Aleksandr.Govenkoandintellij-monorepo-bot acba8a231a PY-83348 Narrow X | None object to X after object or x
GitOrigin-RevId: d835132ade43a3f12b78f4029f584cad97180dc2
2025-09-30 10:30:37 +00:00
Aleksandr.Govenkoandintellij-monorepo-bot 9bbd8452a0 PY-83047 False positive "This code is unreachable" after attribute assignment to None under an if
Merge-request: IJ-MR-173356
Merged-by: Aleksandr Govenko <aleksandr.govenko@jetbrains.com>

GitOrigin-RevId: 08669d49a831548c354096fbb5cbec1a155da4e2
2025-09-30 07:37:59 +00:00
evgeny.bovykinandintellij-monorepo-bot 61b55f5a71 PY-84289 Compute getStringBasedType with doPreventingRecursion to avoid repeating calculations
GitOrigin-RevId: a548f05bea971f6b3e3acdb1f1bc7898d3411d5e
2025-09-29 13:38:19 +00:00
Aleksandr.Govenkoandintellij-monorepo-bot 039326217e PY-82818 PyCharm infers None for dict.get(..., None) if dict key/value types are unknown
GitOrigin-RevId: d12ed4598d91f1ab4824f6e5953e275672027064
2025-09-26 19:05:33 +00:00
Marcus Mewsandintellij-monorepo-bot eb3eeb0fca PY-57582 dataclasses: field with default value preceding KW_ONLY shows false-positive warning
- support marker field typed with KW_ONLY
- adjust other inspection message

GitOrigin-RevId: 28f30ffcc3400bc719c63eacd76e432a547a1a9c
2025-09-26 07:22:47 +00:00