Python: Add points-to regression for metaclass

This commit is contained in:
Rasmus Wriedt Larsen
2020-06-08 15:03:46 +02:00
parent 7c037cd2ab
commit baa415fec8
3 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1 @@
| test.py:6:5:6:22 | Function Foo.foo | test.py:9:1:9:11 | ControlFlowNode for Attribute() |

View File

@@ -0,0 +1,4 @@
import python
from PythonFunctionValue func
select func, func.getACall()

View File

@@ -0,0 +1,25 @@
# Simple classmethod
class Foo(object):
@classmethod
def foo(cls, arg):
print(cls, arg)
Foo.foo(42)
# classmethod defined by metaclass
class BarMeta(type):
def bar(cls, arg):
print(cls, arg)
class Bar(metaclass=BarMeta):
pass
Bar.bar(42) # TODO: No points-to
# If this is solved, please update python/ql/src/Variables/UndefinedExport.ql which has a
# work-around for this behavior