Message321649
> For example, os.stat() accepts both a filename (string) or a file descriptor (integer).
Interesting. I never realized that. Other functions involved in file copy are:
os.lchmod
os.chmod
os.listxattr
os.getxattr
I checked and it appears they all support fd args (this is not documented and it should). os.path.* all use os.stat() internally so they can easily be replaced. I wonder whether this can introduce any change in semantic though:
>>> import os
>>> os.stat('foobar')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'foobar'
>>> os.stat(333)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 9] Bad file descriptor: 333
Also wonder it this would play nice on Windows. |
|
Date |
User |
Action |
Args |
2018-07-14 10:58:26 | giampaolo.rodola | set | recipients:
+ giampaolo.rodola, vstinner, zach.ware, Preston Moore |
2018-07-14 10:58:25 | giampaolo.rodola | set | messageid: <1531565905.98.0.56676864532.issue30400@psf.upfronthosting.co.za> |
2018-07-14 10:58:25 | giampaolo.rodola | link | issue30400 messages |
2018-07-14 10:58:25 | giampaolo.rodola | create | |
|