Skip to content

Commit 60f2eb0

Browse files
committed
Python: Port PropertyInOldStyleClass.ql
Only trivial test changes.
1 parent 41daa53 commit 60f2eb0

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

python/ql/src/Classes/PropertyInOldStyleClass.ql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
*/
1212

1313
import python
14-
private import LegacyPointsTo
14+
private import semmle.python.dataflow.new.internal.DataFlowDispatch
1515

16-
from PropertyObject prop, ClassObject cls
17-
where cls.declaredAttribute(_) = prop and not cls.failedInference() and not cls.isNewStyle()
16+
from Function prop, Class cls
17+
where
18+
prop.getScope() = cls and
19+
prop.getADecorator().(Name).getId() = "property" and
20+
not DuckTyping::isNewStyle(cls)
1821
select prop,
1922
"Property " + prop.getName() + " will not work properly, as class " + cls.getName() +
2023
" is an old-style class."
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
| property_old_style.py:8:6:8:13 | Property piosc | Property piosc will not work properly, as class OldStyle is an old-style class. |
1+
| property_old_style.py:9:5:9:20 | Function piosc | Property piosc will not work properly, as class OldStyle is an old-style class. |

0 commit comments

Comments
 (0)