Get current stack depth, performantly.
(size: int = 2)
| 167 | |
| 168 | |
| 169 | def _get_stack_depth(size: int = 2) -> int: |
| 170 | """Get current stack depth, performantly. |
| 171 | """ |
| 172 | frame = sys._getframe(size) |
| 173 | |
| 174 | for size in count(size): |
| 175 | frame = frame.f_back |
| 176 | if not frame: |
| 177 | return size |
| 178 | |
| 179 | |
| 180 | def nearing_recursion_limit() -> bool: |
no outgoing calls
no test coverage detected