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 larry
Recipients Arfrever, Mark.Shannon, do1, georg.brandl, larry, loewis, mark.dickinson, ned.deily, pitrou, python-dev, serhiy.storchaka, skrah, vstinner
Date 2013-04-15.10:01:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1366020107.12.0.809857125019.issue15301@psf.upfronthosting.co.za>
In-reply-to
Content
Okay, I got inspired and (in the words of Barry Warsaw) JFDI.  Attached is my revised patch.  I took Serhiy's patch and reworked it quite a bit:

* I think it's now easier to follow.  In particular:
* The most common case (no overflow) is now first.  In Serhiy's patch
  the most common case is buried in the middle of the second "if".
* I removed some extraneous tests.
* I changed the error messages to call the values "uid" and "gid", to match the names of the parameters.
* I noticed that _fd_converter had the same bad-idea PyFloat_Check, so I changed it to use PyNumber_Index instead.

In the process I also noticed that Serhiy's approach had a resource leak: it never decref'd the result of PyNumber_Index() when successful.

To make sure I duplicated Serhiy's semantics, I had a test harness that ran both his and mine and ensured they returned the same thing (or both threw an error).  Obviously I removed all that before cutting the patch.
History
Date User Action Args
2013-04-15 10:01:47larrysetrecipients: + larry, loewis, georg.brandl, mark.dickinson, pitrou, vstinner, ned.deily, Arfrever, skrah, Mark.Shannon, python-dev, serhiy.storchaka, do1
2013-04-15 10:01:47larrysetmessageid: <1366020107.12.0.809857125019.issue15301@psf.upfronthosting.co.za>
2013-04-15 10:01:47larrylinkissue15301 messages
2013-04-15 10:01:46larrycreate