Skip to content

Commit a6bb9eb

Browse files
authored
Python: Re-introduce abstract toString
This seems like the easier solution in the short run.
1 parent a404faa commit a6bb9eb

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

python/ql/src/semmle/python/ApiGraphs.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ module API {
157157
/**
158158
* Gets a textual representation of this element.
159159
*/
160-
string toString() { none() }
160+
abstract string toString();
161161

162162
/**
163163
* Gets a path of the given `length` from the root to this node.

python/ql/src/semmle/python/frameworks/PEP249.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ abstract deprecated class PEP249Module extends DataFlow::Node { }
2020
* An abstract class encompassing API graph nodes that implement PEP 249.
2121
* Extend this class for implementations.
2222
*/
23-
abstract class PEP249ModuleApiNode extends API::Node { }
23+
abstract class PEP249ModuleApiNode extends API::Node {
24+
/** Gets a string representation of this element. */
25+
override string toString() { result = this.(API::Node).toString() }
26+
}
2427

2528
/** Gets a reference to a connect call. */
2629
DataFlow::Node connect() { result = any(PEP249ModuleApiNode a).getMember("connect").getAUse() }

0 commit comments

Comments
 (0)