title: python3 re-raising an exception with custom attribute?
body: <p>here's my code from python2 which needs to be ported:</p>
  
  <pre><code>try:
    do_something_with_file(filename)
  
  except:
    exc_type, exc_inst, tb = sys.exc_info()
    exc_inst.filename = filename
    raise exc_type, exc_inst, tb
  </code></pre>
  
  <p>with above code, I can get the whole exception with the problematic input file by checking whether an exception has 'filename' attribute.</p>
  
  <p>however python3's raise has been changed. this is what 2to3 gave me for above code:</p>
  
  <pre><code>except Exception as e:
    et, ei, tb = sys.exc_info()
    e.filename = filename
    raise et(e).with_traceback(tb)
  </code></pre>
  
  <p>which gives me another error and I don't think filename attribute is preserved: </p>
  
  <pre><code>in __call__
      raise et(e).with_traceback(tb)
  TypeError: function takes exactly 5 arguments (1 given)
  </code></pre>
  
  <p>What I just want is passing exceptions transparently with some information to track the input file. I miss python2's <code>raise [exception_type[,exception_instance[,traceback]]]</code> - How can I do this in python3?</p>