'Get current line number as an integer (1-based)
Translated from PyFrame_GetLineNumber and PyCode_Addr2Line
See Objects/lnotab_notes.txt'

def current_line_num(self):

    if self.is_optimized_out():
        return None
    f_trace = self.field('f_trace')
    if (long(f_trace) != 0):
        return self.f_lineno
    else:
        return self.co.addr2line(self.f_lasti)
