mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Python points-to: More comment clarifications and typo fixes.
This commit is contained in:
@@ -29,7 +29,7 @@ abstract class ClassObjectInternal extends ObjectInternal {
|
||||
* @classmethod
|
||||
* def f(cls): pass
|
||||
* ```
|
||||
* `this.lookup("f")` is equivent to `C.__dict__['f']`, which is the class-method
|
||||
* `this.lookup("f")` is equivalent to `C.__dict__['f']`, which is the class-method
|
||||
* whereas
|
||||
* `this.attr("f") is equivalent to `C.f`, which is a bound-method.
|
||||
*/
|
||||
|
||||
@@ -155,6 +155,11 @@ class ClassMethodObjectInternal extends ObjectInternal, TClassMethod {
|
||||
origin = CfgOrigin::unknown()
|
||||
}
|
||||
|
||||
/** Holds if attribute lookup on this object may "bind" `cls` to `descriptor`.
|
||||
* `cls` will always be a class as this is a classmethod.
|
||||
* Here "bind" means that `instance` is passed to the `classmethod.__get__()` method
|
||||
* at runtime. The term "bind" is used as this most likely results in a bound-method.
|
||||
*/
|
||||
pragma [noinline] override predicate binds(ObjectInternal cls, string name, ObjectInternal descriptor) {
|
||||
descriptor = this.getFunction() and
|
||||
exists(ObjectInternal instance |
|
||||
|
||||
@@ -176,8 +176,10 @@ class PackageObjectInternal extends ModuleObjectInternal, TPackageObject {
|
||||
exists(Module init |
|
||||
init = this.getSourceModule() and
|
||||
(
|
||||
/* There is no variable shadowing the name of the child module */
|
||||
not exists(EssaVariable var | var.getAUse() = init.getANormalExit() and var.getSourceVariable().getName() = name)
|
||||
or
|
||||
/* The variable shadowing the name of the child module is undefined at exit */
|
||||
ModuleAttributes::pointsToAtExit(init, name, ObjectInternal::undefined(), _)
|
||||
) and
|
||||
not name = "__init__" and
|
||||
|
||||
@@ -47,12 +47,7 @@ class Value extends TObject {
|
||||
|
||||
/** Gets a call to this object */
|
||||
CallNode getACall() {
|
||||
PointsToInternal::pointsTo(result.getFunction(), _, this, _)
|
||||
or
|
||||
exists(BoundMethodObjectInternal bm |
|
||||
PointsToInternal::pointsTo(result.getFunction(), _, bm, _) and
|
||||
bm.getFunction() = this
|
||||
)
|
||||
result = this.getACall(_)
|
||||
}
|
||||
|
||||
/** Gets a call to this object with the given `caller` context. */
|
||||
@@ -249,7 +244,7 @@ class ClassValue extends Value {
|
||||
* @classmethod
|
||||
* def f(cls): pass
|
||||
* ```
|
||||
* `this.lookup("f")` is equivent to `C.__dict__['f']`, which is the class-method
|
||||
* `this.lookup("f")` is equivalent to `C.__dict__['f']`, which is the class-method
|
||||
* whereas
|
||||
* `this.attr("f") is equivalent to `C.f`, which is a bound-method.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user