Skip to content

Commit baa415f

Browse files
committed
Python: Add points-to regression for metaclass
1 parent 7c037cd commit baa415f

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| test.py:6:5:6:22 | Function Foo.foo | test.py:9:1:9:11 | ControlFlowNode for Attribute() |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import python
2+
3+
from PythonFunctionValue func
4+
select func, func.getACall()
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Simple classmethod
2+
3+
class Foo(object):
4+
5+
@classmethod
6+
def foo(cls, arg):
7+
print(cls, arg)
8+
9+
Foo.foo(42)
10+
11+
12+
# classmethod defined by metaclass
13+
14+
class BarMeta(type):
15+
16+
def bar(cls, arg):
17+
print(cls, arg)
18+
19+
class Bar(metaclass=BarMeta):
20+
pass
21+
22+
Bar.bar(42) # TODO: No points-to
23+
24+
# If this is solved, please update python/ql/src/Variables/UndefinedExport.ql which has a
25+
# work-around for this behavior

0 commit comments

Comments
 (0)