Skip to content

Commit 32c8dd0

Browse files
committed
Python: Fix (upcoming) deprecation compiler-warnings
In a near-future release overriding a deprecated predicate without making as deprecated would give a compiler warning. Not fixing the XML one. [I can see that this shouldn't be reported anymore](github#3520 (comment)), and it's not safe to remove since it was only marked as deprecated in e6425bb.
1 parent b9ecf1a commit 32c8dd0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

python/ql/src/semmle/python/Exprs.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ class StrConst extends Str_, ImmutableLiteral {
597597
this.getEnclosingModule().hasFromFuture("unicode_literals")
598598
}
599599

600-
override string strValue() { result = this.getS() }
600+
deprecated override string strValue() { result = this.getS() }
601601

602602
override Expr getASubExpression() { none() }
603603

python/ql/src/semmle/python/types/ModuleObject.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class BuiltinModuleObject extends ModuleObject {
118118

119119
override predicate hasAttribute(string name) { exists(this.asBuiltin().getMember(name)) }
120120

121-
override predicate exportsComplete() { any() }
121+
deprecated override predicate exportsComplete() { any() }
122122
}
123123

124124
class PythonModuleObject extends ModuleObject {
@@ -132,7 +132,7 @@ class PythonModuleObject extends ModuleObject {
132132

133133
override Container getPath() { result = this.getModule().getFile() }
134134

135-
override predicate exportsComplete() {
135+
deprecated override predicate exportsComplete() {
136136
exists(Module m | m = this.getModule() |
137137
not exists(Call modify, Attribute attr, GlobalVariable all |
138138
modify.getScope() = m and
@@ -196,7 +196,7 @@ class PackageObject extends ModuleObject {
196196
)
197197
}
198198

199-
override predicate exportsComplete() {
199+
deprecated override predicate exportsComplete() {
200200
not exists(this.getInitModule())
201201
or
202202
this.getInitModule().exportsComplete()

0 commit comments

Comments
 (0)