equal
deleted
inserted
replaced
1523 can use emptyok=True as an optimization. |
1523 can use emptyok=True as an optimization. |
1524 |
1524 |
1525 Returns the name of the temporary file. |
1525 Returns the name of the temporary file. |
1526 """ |
1526 """ |
1527 d, fn = os.path.split(name) |
1527 d, fn = os.path.split(name) |
1528 fd, temp = tempfile.mkstemp(prefix='.%s-' % fn, dir=d) |
1528 fd, temp = tempfile.mkstemp(prefix='.%s-' % fn, suffix='~', dir=d) |
1529 os.close(fd) |
1529 os.close(fd) |
1530 # Temporary files are created with mode 0600, which is usually not |
1530 # Temporary files are created with mode 0600, which is usually not |
1531 # what we want. If the original file already exists, just copy |
1531 # what we want. If the original file already exists, just copy |
1532 # its mode. Otherwise, manually obey umask. |
1532 # its mode. Otherwise, manually obey umask. |
1533 copymode(name, temp, createmode) |
1533 copymode(name, temp, createmode) |