[issue32441] os.dup2 should return the new fd

2018-01-29 Thread Benjamin Peterson
Change by Benjamin Peterson : -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue32441] os.dup2 should return the new fd

2018-01-29 Thread Gregory P. Smith
Gregory P. Smith added the comment: https://github.com/python/cpython/pull/5346 (merged) should fix that warning. -- nosy: +gregory.p.smith ___ Python tracker ___ _

[issue32441] os.dup2 should return the new fd

2018-01-26 Thread STINNER Victor
STINNER Victor added the comment: The change introduced a warning. Can someone please take a look (and maybe fix it)? ./Modules/posixmodule.c: In function 'os_dup2_impl': ./Modules/posixmodule.c:7785:9: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] int

[issue32441] os.dup2 should return the new fd

2018-01-06 Thread Xavier de Gaye
Xavier de Gaye added the comment: Good catch, the code makes much more sense now :-) -- ___ Python tracker ___ ___ Python-bugs-list

[issue32441] os.dup2 should return the new fd

2018-01-06 Thread Benjamin Peterson
Benjamin Peterson added the comment: I suspect the dup3_works variable is supposed to be static. -- ___ Python tracker ___ ___ Pytho

[issue32441] os.dup2 should return the new fd

2018-01-06 Thread Xavier de Gaye
Xavier de Gaye added the comment: Both the change in my previous post or using a definition for 'res' are not needed if 'dup3_works' is removed. That would make the code more clear for both gcc and a human reader. The attached patch removes it. Using a definition for 'res' LGTM also. ---

[issue32441] os.dup2 should return the new fd

2018-01-05 Thread Benjamin Peterson
Benjamin Peterson added the comment: I would just make a declaration a definition with a dummy value (0?) rather than complicating the branches. -- ___ Python tracker ___

[issue32441] os.dup2 should return the new fd

2018-01-05 Thread Xavier de Gaye
Xavier de Gaye added the comment: gcc is a little bit lost and prints now the following (false) warning: gcc -pthread -Wno-unused-result -Wsign-compare -g -Og -Wall -Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implici

[issue32441] os.dup2 should return the new fd

2017-12-29 Thread Benjamin Peterson
Benjamin Peterson added the comment: New changeset bbdb17d19bb1d5443ca4417254e014ad64c04540 by Benjamin Peterson in branch 'master': return the new file descriptor from os.dup2 (closes bpo-32441) (#5041) https://github.com/python/cpython/commit/bbdb17d19bb1d5443ca4417254e014ad64c04540 --

[issue32441] os.dup2 should return the new fd

2017-12-28 Thread Benjamin Peterson
Change by Benjamin Peterson : -- keywords: +patch pull_requests: +4924 stage: needs patch -> patch review ___ Python tracker ___ ___

[issue32441] os.dup2 should return the new fd

2017-12-28 Thread Benjamin Peterson
New submission from Benjamin Peterson : os.dup2 currently always None. However, the underlying standard Unix function returns the new file descriptor (i.e., the second argument) on success. We should follow that convention, too. -- components: Extension Modules keywords: easy messages: