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 christian.heimes
Recipients christian.heimes
Date 2013-06-21.11:12:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1371813162.19.0.902104537883.issue18276@psf.upfronthosting.co.za>
In-reply-to
Content
I suggest that posixpath.c:_fd_converter() should  PyObject_AsFileDescriptor() to convert a Python object to a fd integer. With PyObject_AsFileDescriptor() functions such as os.chmod() can be called with an opened file as first argument:

Now:

  with open("somefile") as f:
     os.chmod(f.fileno(), 0o644)

With PyObject_AsFileDescriptor():

    with open("somefile") as f:
     os.chmod(f, 0o644)

_fd_converter() also has more elaborate overflow checks. These checks should be added to PyObject_AsFileDescriptor(), too.
History
Date User Action Args
2013-06-21 11:12:42christian.heimessetrecipients: + christian.heimes
2013-06-21 11:12:42christian.heimessetmessageid: <1371813162.19.0.902104537883.issue18276@psf.upfronthosting.co.za>
2013-06-21 11:12:42christian.heimeslinkissue18276 messages
2013-06-21 11:12:42christian.heimescreate