Skip to content

Commit 7e3dbb0

Browse files
committed
Python: Add Unit helper library
Like Java did in #4184
1 parent f70072a commit 7e3dbb0

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

python/ql/src/python.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import semmle.python.pointsto.Base
3535
import semmle.python.pointsto.Context
3636
import semmle.python.pointsto.CallGraph
3737
import semmle.python.objects.ObjectAPI
38+
import semmle.python.Unit
3839
import site
3940
// Removing this import perturbs the compilation process enough that the points-to analysis gets
4041
// compiled -- and cached -- differently depending on whether the data flow library is imported. By
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/** Provides the `Unit` class. */
2+
3+
/** The unit type. */
4+
private newtype TUnit = TMkUnit()
5+
6+
/** The trivial type with a single element. */
7+
class Unit extends TUnit {
8+
/** Gets a textual representation of this element. */
9+
string toString() { result = "unit" }
10+
}

python/ql/src/semmle/python/dataflow/new/internal/TaintTrackingPublic.qll

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,6 @@ predicate localTaintStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
3535
localAdditionalTaintStep(nodeFrom, nodeTo)
3636
}
3737

38-
// AdditionalTaintStep for global taint flow
39-
private newtype TUnit = TMkUnit()
40-
41-
/** A singleton class containing a single dummy "unit" value. */
42-
private class Unit extends TUnit {
43-
/** Gets a textual representation of this element. */
44-
string toString() { result = "unit" }
45-
}
46-
4738
/**
4839
* A unit class for adding additional taint steps.
4940
*

0 commit comments

Comments
 (0)