github / github/codeql

General issue Python:Unable to recognize calling a method through an instance member of a class

未关闭
#14,899 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
acknowledged Python question
主要语言
CodeQL
星标
10.1k
派生
2.1k
平均合并
2 天 15 小时
30 天内合并 PR
141

描述

when evaluate """private API::Node connection()""", the query result should find """self.orm.connection()""".But the query result is none
```
private API::Node dbClient() {
result = API::moduleImport("dbutils").getMember("pooled_db").getMember("PooledDB").getReturn()
}

private API::Node connection() {
result = dbClient().getMember("connection").getReturn()
}
```

python demo here
```
import flask
import pymysql
from flask import request
from dbutils.pooled_db import PooledDB

app = flask.Flask(__name__)

class Database:
def __init__(self):
self.orm = self.dbpool()

def dbpool(self):
pool = PooledDB(
creator=pymysql
)
return pool

def conn(self):
self.orm.connection()

@app.route('/search')
def search():
query = request.args.get('query')
database = Database()
database.conn()
database.orm.connection()
return f"Search query: {query}"

if __name__ == '__main__':
app.run()
```

贡献指南

打开贡献指南

调研方向

Start with the provided Python demo and the query for `private API::Node connection()`; reproduce why `self.orm.connection()` is not found while the direct call is present. Trace the CodeQL Python member and return-value resolution involved, then confirm the query result includes the instance-member call.

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
devtools
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。