Get current line number as an integer (1-based) Translated from PyFrame_GetLineNumber and PyCode_Addr2Line See Objects/lnotab_notes.txt
(self)
| 1201 | return self.co_filename.proxyval(set()) |
| 1202 | |
| 1203 | def current_line_num(self): |
| 1204 | '''Get current line number as an integer (1-based) |
| 1205 | |
| 1206 | Translated from PyFrame_GetLineNumber and PyCode_Addr2Line |
| 1207 | |
| 1208 | See Objects/lnotab_notes.txt |
| 1209 | ''' |
| 1210 | if self.is_optimized_out(): |
| 1211 | return None |
| 1212 | try: |
| 1213 | return self.co.addr2line(self.f_lasti) |
| 1214 | except Exception as ex: |
| 1215 | # bpo-34989: addr2line() is a complex function, it can fail in many |
| 1216 | # ways. For example, it fails with a TypeError on "FakeRepr" if |
| 1217 | # gdb fails to load debug symbols. Use a catch-all "except |
| 1218 | # Exception" to make the whole function safe. The caller has to |
| 1219 | # handle None anyway for optimized Python. |
| 1220 | return None |
| 1221 | |
| 1222 | def current_line(self): |
| 1223 | '''Get the text of the current source line as a string, with a trailing |
no test coverage detected