[issue18276] posixpath.c:_fd_converter() should use PyObject_AsFileDescriptor()

2021-10-21 Thread Christian Heimes
Christian Heimes added the comment: Fine with me! Thanks for your feedback. -- resolution: -> rejected stage: needs patch -> resolved status: open -> closed ___ Python tracker __

[issue18276] posixpath.c:_fd_converter() should use PyObject_AsFileDescriptor()

2021-10-21 Thread STINNER Victor
STINNER Victor added the comment: I like calling .fileno() explicitly. It seems like it's not really needed to call it implicitly, since this issue doesn't get much activity. I suggest to reject it. -- status: pending -> open ___ Python tracker <

[issue18276] posixpath.c:_fd_converter() should use PyObject_AsFileDescriptor()

2021-10-21 Thread Christian Heimes
Christian Heimes added the comment: Victor, do we want to support "with open("somefile") as f: os.chmod(f, 0o644)"? The feature request has been languishing for 8 years. -- status: open -> pending versions: +Python 3.11 -Python 3.4 ___ Python track

[issue18276] posixpath.c:_fd_converter() should use PyObject_AsFileDescriptor()

2013-06-21 Thread STINNER Victor
STINNER Victor added the comment: > OK, let's do that on Windows first :-) For the PEP 433, I did something like that in os.get_cloexec() and os.set_cloexec(): http://hg.python.org/features/pep-433/file/f32c2b09f332/Modules/posixmodule.c#l10198 On Windows, I added two code paths: one for HAND

[issue18276] posixpath.c:_fd_converter() should use PyObject_AsFileDescriptor()

2013-06-21 Thread Christian Heimes
Christian Heimes added the comment: > OK, let's do that on Windows first :-) Gotcha :( Damn you winsock.dll! -- ___ Python tracker ___ __

[issue18276] posixpath.c:_fd_converter() should use PyObject_AsFileDescriptor()

2013-06-21 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: > Let's unify os' and select's behavior! OK, let's do that on Windows first :-) -- ___ Python tracker ___

[issue18276] posixpath.c:_fd_converter() should use PyObject_AsFileDescriptor()

2013-06-21 Thread Christian Heimes
Christian Heimes added the comment: os.write() already works with file and sockets object but you have to call ob.fileno() first. The select module uses PyObject_AsFileDescriptor() all over the module to get the file descriptor number from file and socket objects. Let's unify os' and select's

[issue18276] posixpath.c:_fd_converter() should use PyObject_AsFileDescriptor()

2013-06-21 Thread STINNER Victor
STINNER Victor added the comment: This issue looks to be related to #18269. -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-lis

[issue18276] posixpath.c:_fd_converter() should use PyObject_AsFileDescriptor()

2013-06-21 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Do we want the low-level os.write() to work with file objects, or sockets? -- nosy: +amaury.forgeotdarc ___ Python tracker ___ ___

[issue18276] posixpath.c:_fd_converter() should use PyObject_AsFileDescriptor()

2013-06-21 Thread Christian Heimes
New submission from Christian Heimes: 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