mirror of
https://github.com/github/codeql.git
synced 2026-05-04 21:25:44 +02:00
Python: Fix Builtin.isClass() and use in ClassObject. Also fix a couple of typos.
This commit is contained in:
@@ -40,6 +40,7 @@ class Builtin extends @py_cobject {
|
||||
}
|
||||
|
||||
Builtin getBaseClass() {
|
||||
/* The extractor uses the special name ".super." to indicate the super class of a builtin class */
|
||||
py_cmembers_versioned(this, ".super.", result, major_version().toString())
|
||||
}
|
||||
|
||||
@@ -54,7 +55,9 @@ class Builtin extends @py_cobject {
|
||||
}
|
||||
|
||||
predicate isClass() {
|
||||
py_cobjecttypes(_, this) or this = Builtin::unknownType()
|
||||
py_cobjecttypes(_, this) or
|
||||
this = Builtin::unknownType() or
|
||||
exists(Builtin meta | meta.inheritsFromType() and py_cobjecttypes(this, meta))
|
||||
}
|
||||
|
||||
predicate isFunction() {
|
||||
|
||||
@@ -22,9 +22,7 @@ class ClassObject extends Object {
|
||||
|
||||
ClassObject() {
|
||||
this.getOrigin() instanceof ClassExpr or
|
||||
exists(Builtin o | o.getClass() = this.asBuiltin()) or
|
||||
this.asBuiltin().getClass().inheritsFromType() or
|
||||
this.asBuiltin() = Builtin::special("_semmle_unknown_type")
|
||||
this.asBuiltin().isClass()
|
||||
}
|
||||
|
||||
private predicate isStr() {
|
||||
|
||||
@@ -37,7 +37,7 @@ class Object extends @py_object {
|
||||
ClassObject getAnInferredType() {
|
||||
exists(ControlFlowNode somewhere | somewhere.refersTo(this, result, _))
|
||||
or
|
||||
this.asBuiltin().getClass() = result.asBuiltin()and not this = unknownValue()
|
||||
this.asBuiltin().getClass() = result.asBuiltin() and not this = unknownValue()
|
||||
or
|
||||
this = unknownValue() and result = theUnknownType()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user