Giampaolo Rodola' <g.rod...@gmail.com> added the comment:

> 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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue30400>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to