Skip to content

Commit 84b6d0c

Browse files
committed
Python: Port SlotsInOldStyleClass.ql
Only trivial test changes.
1 parent 1b9b84c commit 84b6d0c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

python/ql/src/Classes/SlotsInOldStyleClass.ql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
*/
1313

1414
import python
15-
private import LegacyPointsTo
15+
private import semmle.python.dataflow.new.internal.DataFlowDispatch
1616

17-
from ClassObject c
18-
where not c.isNewStyle() and c.declaresAttribute("__slots__") and not c.failedInference()
17+
from Class c
18+
where
19+
not DuckTyping::isNewStyle(c) and
20+
DuckTyping::declaresAttribute(c, "__slots__")
1921
select c,
2022
"Using '__slots__' in an old style class just creates a class attribute called '__slots__'."
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
| newstyle_test.py:4:1:4:16 | class OldStyle1 | Using '__slots__' in an old style class just creates a class attribute called '__slots__'. |
1+
| newstyle_test.py:4:1:4:16 | Class OldStyle1 | Using '__slots__' in an old style class just creates a class attribute called '__slots__'. |

0 commit comments

Comments
 (0)