title: File I/O in the Python 3 C API
body: <p>The C API in Python 3.0 has changed (deprecated) many of the functions for File Objects.</p>
  
  <p>Before, in 2.X, you could use</p>
  
  <pre><code>PyObject* PyFile_FromString(char *filename, char *mode)
  </code></pre>
  
  <p>to create a Python file object, e.g:</p>
  
  <pre><code>PyObject *myFile = PyFile_FromString("test.txt", "r");
  </code></pre>
  
  <p>...but such function no longer exists in Python 3.0.
  What would be the Python 3.0 equivalent to such call?</p>