[Patches] [ python-Patches-569139 ] Implementation of st_rdev_pair
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 14 Jun 2002 14:47:54 -0700
Patches item #569139, was opened at 2002-06-14 18:53
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=569139&group_id=5470
Category: Modules
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Gustavo Niemeyer (niemeyer)
Assigned to: Nobody/Anonymous (nobody)
Summary: Implementation of st_rdev_pair
Initial Comment:
As discussed in python-dev, st_rdev provides an integer, which
usually needs to be translated in a (major, minor) pair before it's
useful. There are no implementations of major() and minor() in the
current library, and maybe there shouldn't be, since their functionality
is not portable.
This patch provides a portable way to access this information, by
providing a new attribute to the os.stat() return tuple named
st_rdev_pair.
----------------------------------------------------------------------
>Comment By: Gustavo Niemeyer (niemeyer)
Date: 2002-06-14 21:47
Message:
Logged In: YES
user_id=7887
I don't think a test is needed. If st_rdev is available, this information must
be decodable by the system, and this is done by the major/minor pair,
AFAIK.
About the DECREF, I don't think it's needed. w's reference is stolen by v
when PyStructSequence_SET_ITEM is run, and will be destroyed with v
once it's DECREF'd. If that's not true, the whole logic is wrong in that
function.
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2002-06-14 21:36
Message:
Logged In: YES
user_id=33168
Are major/minor guaranteed to exist?
Should a check be added to configure?
There is a missing DECREF.
In the last line of the patch to posixmodule.c,
there is if (PyErr_Occurred()) {
In that block, w needs to be DECREFed.
You can initialize w = NULL in the declaration,
then do an XDECREF in the error block.
That way you don't need to handle the error
creating w, if w != NULL, set the items in the tuple.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=569139&group_id=5470