
"what's this file called?"
C: okay so the basename() function maybe modifies its arguments but maybe not so you've gotta make a copy of the string and then call basename() on the copy and the return may be statically allocated so you can't free() it but you do have to free() the copy you made
Python: filepath.name