mirror of
https://github.com/github/codeql.git
synced 2026-04-25 00:35:20 +02:00
Python: Make isNewType more precise
For module-level metaclass declarations, we now also check that the right hand side in a `__metaclass__ = type` assignment is in fact the built-in `type`.
This commit is contained in:
@@ -2108,7 +2108,8 @@ module DuckTyping {
|
||||
// Module-level __metaclass__ = type makes all classes in the module new-style
|
||||
exists(Assign a |
|
||||
a.getScope() = cls.getEnclosingModule() and
|
||||
a.getATarget().(Name).getId() = "__metaclass__"
|
||||
a.getATarget().(Name).getId() = "__metaclass__" and
|
||||
a.getValue() = API::builtin("type").getAValueReachableFromSource().asExpr()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user