mirror of
https://github.com/github/codeql.git
synced 2026-05-15 03:39:32 +02:00
25 lines
726 B
Plaintext
25 lines
726 B
Plaintext
/**
|
|
* @name Property in old-style class
|
|
* @description Using property descriptors in old-style classes does not work from Python 2.1 onward.
|
|
* @kind problem
|
|
* @tags portability
|
|
* correctness
|
|
* @problem.severity error
|
|
* @sub-severity low
|
|
* @precision very-high
|
|
* @id py/property-in-old-style-class
|
|
*/
|
|
|
|
import python
|
|
private import semmle.python.dataflow.new.internal.DataFlowDispatch
|
|
|
|
from Function prop, Class cls, Name decorator
|
|
where
|
|
prop.getScope() = cls and
|
|
decorator = prop.getADecorator() and
|
|
decorator.getId() = "property" and
|
|
not DuckTyping::isNewStyle(cls)
|
|
select decorator,
|
|
"Property " + prop.getName() + " will not work properly, as class " + cls.getName() +
|
|
" is an old-style class."
|