Fix filename handling in IPython tracebacks

* Only replace filename by the value of __file__ if the latter is an
  existing text file (this fixes tracebacks for Cython files).
* When making a relative filename absolute, try to make it absolute
  w.r.t. the sys.path entries instead of the current working directory.
* Still try to display source lines for binary files, you never know
  what linecache got from that file. Skip only the reading of names,
  but display the traceback as usual.

See also downstream Sage ticket
http://trac.sagemath.org/ticket/17382