Commit 7fdffd9
fix: avoid unnecessary env updates to reduce chances of segfault (#956)
* fix: __terminal_color shouldn't modify os.environ unless it has to
See #955 for a
detailed explanation of why this can cause thread safety issues
resulting in a segfault when another thread calls `getenv`
* fix: pytest_assertrepr_compare should be a no-op for other types
If neither operand is a `SnapshotAssertion` then the rest of the
code is not going to do anything, so bail early rather than
unnecessarily setting up `__terminal_color` etc. which can cause
issues c.f. #955
* chore: run linter
---------
Co-authored-by: Noah Ulster <noah.u@roserocket.com>1 parent b7f5a9d commit 7fdffd9
1 file changed
Lines changed: 14 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
108 | | - | |
109 | 109 | | |
110 | | - | |
111 | | - | |
112 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
113 | 117 | | |
114 | 118 | | |
115 | 119 | | |
| |||
119 | 123 | | |
120 | 124 | | |
121 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
122 | 132 | | |
123 | 133 | | |
124 | 134 | | |
| |||
0 commit comments