Python: Add `toString` information for all classes without such. · github/codeql@c525ab3 · GitHub
Skip to content

Commit c525ab3

Browse files
committed
Python: Add toString information for all classes without such.
Having `toString()` defined to be `none()` is a major headache when debugging, as `toString`-less results are silently elided. This PR puts dummy `toString`s in place of the `none()`s. (I am mostly creating this to see if it impacts our tests and/or the performance. If not, we may as well merge it.)
1 parent 77c869f commit c525ab3

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎python/ql/src/external/CodeDuplication.qll‎

Lines changed: 1 addition & 1 deletion

‎python/ql/src/semmle/python/Exprs.qll‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ abstract class Num extends Num_, ImmutableLiteral {
419419

420420
/* We want to declare this abstract, but currently we cannot. */
421421
override string toString() {
422-
none()
422+
result = "Num with missing toString"
423423
}
424424

425425
}

‎python/ql/src/semmle/python/Keywords.qll‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ abstract class DictUnpackingOrKeyword extends DictItem {
6060
abstract Expr getValue();
6161

6262
override string toString() {
63-
none()
63+
result = "DictUnpackingOrKeyword with missing toString"
6464
}
6565

6666
}
@@ -70,7 +70,7 @@ abstract class DictDisplayItem extends DictItem {
7070
abstract Expr getValue();
7171

7272
override string toString() {
73-
none()
73+
result = "DictDisplayItem with missing toString"
7474
}
7575

7676
}

‎python/ql/src/semmle/python/pointsto/PointsTo.qll‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ library class CfgOrigin extends @py_object {
1313

1414
string toString() {
1515
/* Not to be displayed */
16-
none()
16+
result = "CfgOrigin"
1717
}
1818

1919
/** Get a `ControlFlowNode` from `this` or `here`.
@@ -68,7 +68,7 @@ module CfgOrigin {
6868
//
6969
// string toString() {
7070
// /* Not to be displayed */
71-
// none()
71+
// result = "CfgOrigin"
7272
// }
7373
//
7474
// /** Get a `ControlFlowNode` from `this` or `here`.

‎python/ql/src/semmle/python/types/Extensions.qll‎

Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)