- """
- recupere la position de l appel
- """
- frame=cur_frame(niveau)
- if frame == None: return 0,"inconnu",0,{}
- try:
- return frame.f_lineno,frame.f_code.co_filename,frame.f_code.co_firstlineno,frame.f_locals
- except:
- return 0,"inconnu",0,{}
+ """
+ recupere la position de l appel
+ """
+ frame = sys._getframe(niveau)
+ if frame == None:
+ return 0, "inconnu", 0, {}
+ try:
+ # Python 2.7 compile function does not accept unicode filename, so we encode it
+ # with the current locale encoding in order to have a correct traceback.
+ # Here, we convert it back to unicode.
+ filename = six.text_type(frame.f_code.co_filename, get_encoding())
+ return frame.f_lineno, filename, frame.f_code.co_firstlineno, frame.f_locals
+ except:
+ return 0, "inconnu", 0, {}