Skip to content

Commit eaf68e8

Browse files
authored
Merge pull request github#2443 from tausbn/python-finalise-change-notes
Python: Update change note for 1.23.
2 parents 42b51d4 + b503cdb commit eaf68e8

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

change-notes/1.23/analysis-python.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,19 @@
33

44
## General improvements
55

6+
### Python 3.8 support
67

8+
Python 3.8 syntax is now supported. In particular, the following constructs are parsed correctly:
9+
10+
- Assignment expressions using the "walrus" operator, such as `while chunk := file.read(1024): ...`.
11+
- The positional argument separator `/`, such as in `def foo(a, /, b, *, c): ...`.
12+
- Self-documenting expressions in f-strings, such as `f"{var=}"`.
13+
14+
### General query improvements
15+
16+
Following the replacement of the `Object` API (for example, `ClassObject`) in favor of the
17+
`Value` API (for example, `ClassValue`) in the 1.21 release, many of the standard queries have been updated
18+
to use the `Value` API. This should result in more precise results.
719

820
## New queries
921

@@ -18,10 +30,23 @@
1830

1931
| **Query** | **Expected impact** | **Change** |
2032
|----------------------------|------------------------|------------|
21-
| Unreachable code | Fewer false positives | Analysis now accounts for uses of `contextlib.suppress` to suppress exceptions. |
22-
| `__iter__` method returns a non-iterator | Better alert message | Alert now highlights which class is expected to be an iterator. |
23-
33+
| Explicit export is undefined (`py/undefined-export`) | Fewer false positive results | Instances where an exported value may be defined in a module that lacks points-to information are no longer flagged. |
34+
| Module-level cyclic import (`py/unsafe-cyclic-import`) | Fewer false positive results | Instances where one of the links in an import cycle is never actually executed are no longer flagged. |
35+
| Non-iterable used in for loop (`py/non-iterable-in-for-loop`) | Fewer false positive results | `__aiter__` is now recognized as an iterator method. |
36+
| Unreachable code (`py/unreachable-statement`) | Fewer false positive results | Analysis now accounts for uses of `contextlib.suppress` to suppress exceptions. |
37+
| Unreachable code (`py/unreachable-statement`) | Fewer false positive results | Unreachable `else` branches that do nothing but `assert` their non-reachability are no longer flagged. |
38+
| Unused import (`py/unused-import`) | Fewer false positive results | Instances where a module is used in a forward-referenced type annotation, or only during type checking are no longer flagged. |
39+
| `__iter__` method returns a non-iterator (`py/iter-returns-non-iterator`) | Better alert message | Alert now highlights which class is expected to be an iterator. |
40+
| `__init__` method returns a value (`py/explicit-return-in-init`) | Fewer false positive results | Instances where the `__init__` method returns the value of a call to a procedure are no longer flagged. |
2441

2542
## Changes to QL libraries
2643

2744
* Django library now recognizes positional arguments from a `django.conf.urls.url` regex (Django version 1.x)
45+
* Instances of the `Value` class now support the `isAbsent` method, indicating
46+
whether that `Value` lacks points-to information, but inference
47+
suggests that it exists. For instance, if a file contains `import
48+
django`, but `django` was not extracted properly, there will be a
49+
`ModuleValue` corresponding to this "unknown" module, and the `isAbsent`
50+
method will hold for this `ModuleValue`.
51+
* The `Expr` class now has a nullary method `pointsTo` that returns the possible
52+
instances of `Value` that this expression may have.

0 commit comments

Comments
 (0)