We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents e11406c + 8fadb64 commit 703fbc6Copy full SHA for 703fbc6
2 files changed
python/ql/src/analysis/Sanity.ql
@@ -212,6 +212,15 @@ predicate file_sanity(string clsname, string problem, string what) {
212
)
213
}
214
215
+predicate class_value_sanity(string clsname, string problem, string what) {
216
+ exists(ClassValue value |
217
+ exists(value.getASuperType().lookup(what)) and
218
+ not exists(value.lookup(what)) and
219
+ clsname = value.getAQlClass() and
220
+ problem = "is missing attribute that superclass has"
221
+ )
222
+}
223
+
224
from string clsname, string problem, string what
225
where
226
ast_sanity(clsname, problem, what) or
@@ -224,5 +233,6 @@ source_object_sanity(clsname, problem, what) or
233
function_object_sanity(clsname, problem, what) or
234
points_to_sanity(clsname, problem, what) or
235
jump_to_definition_sanity(clsname, problem, what) or
227
-file_sanity(clsname, problem, what)
236
+file_sanity(clsname, problem, what) or
237
+class_value_sanity(clsname, problem, what)
228
238
select clsname + " " + what + " has " + problem
python/ql/src/semmle/python/objects/Classes.qll
@@ -191,8 +191,7 @@ class BuiltinClassObjectInternal extends ClassObjectInternal, TBuiltinClassObjec
191
192
193
override predicate lookup(string name, ObjectInternal value, CfgOrigin origin) {
194
- value = ObjectInternal::fromBuiltin(this.getBuiltin().getMember(name)) and
195
- origin = CfgOrigin::unknown()
+ Types::getMro(this).lookup(name, value, origin)
196
197
198
pragma [noinline] override predicate attributesUnknown() { none() }
@@ -301,8 +300,7 @@ class TypeInternal extends ClassObjectInternal, TType {
301
300
302
303
304
- value = ObjectInternal::fromBuiltin(Builtin::special("type").getMember(name)) and
305
306
307
308
pragma [noinline] override predicate attributesUnknown() { any() }
0 commit comments