This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author giampaolo.rodola
Recipients Preston Moore, giampaolo.rodola, vstinner, zach.ware
Date 2018-07-14.10:58:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1531565905.98.0.56676864532.issue30400@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2018-07-14 10:58:26giampaolo.rodolasetrecipients: + giampaolo.rodola, vstinner, zach.ware, Preston Moore
2018-07-14 10:58:25giampaolo.rodolasetmessageid: <1531565905.98.0.56676864532.issue30400@psf.upfronthosting.co.za>
2018-07-14 10:58:25giampaolo.rodolalinkissue30400 messages
2018-07-14 10:58:25giampaolo.rodolacreate