Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5ad731a

Browse files
committed
Python points-to. Fix handling of six.add_metaclass.
1 parent f51a2d9 commit 5ad731a

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

python/ql/src/semmle/python/pointsto/PointsTo.qll

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,19 +1643,17 @@ cached module Types {
16431643

16441644
/** INTERNAL -- Do not use */
16451645
cached predicate six_add_metaclass(CallNode decorator_call, ClassObjectInternal decorated, ControlFlowNode metaclass) {
1646-
//TO DO...
1647-
none()
1648-
//exists(CallNode decorator |
1649-
// decorator_call.getArg(0) = decorated and
1650-
// decorator = decorator_call.getFunction() and
1651-
// decorator.getArg(0) = metaclass |
1652-
// PointsToInternal::pointsTo(decorator.getFunction(), _, six_add_metaclass_function(), _)
1653-
// or
1654-
// exists(ModuleObjectInternal six |
1655-
// six.getName() = "six" and
1656-
// PointsToInternal::pointsTo(decorator.getFunction().(AttrNode).getObject("add_metaclass"), _, six, _)
1657-
// )
1658-
//)
1646+
exists(CallNode decorator |
1647+
PointsToInternal::pointsTo(decorator_call.getArg(0), _, decorated, _) and
1648+
decorator = decorator_call.getFunction() and
1649+
decorator.getArg(0) = metaclass |
1650+
PointsToInternal::pointsTo(decorator.getFunction(), _, six_add_metaclass_function(), _)
1651+
or
1652+
exists(ModuleObjectInternal six |
1653+
six.getName() = "six" and
1654+
PointsToInternal::pointsTo(decorator.getFunction().(AttrNode).getObject("add_metaclass"), _, six, _)
1655+
)
1656+
)
16591657
}
16601658

16611659
private ObjectInternal six_add_metaclass_function() {

0 commit comments

Comments
 (0)