Package dbus :: Module types :: Class UnixFd
[hide private]
[frames] | no frames]

Class UnixFd

source code

object --+
         |
        types.UnixFd

An Unix Fd.

Constructor:

dbus.UnixFd(value: int or file object[, variant_level: int]) -> UnixFd

value must be the integer value of a file descriptor, or an object that implements the fileno() method. Otherwise, ValueError will be raised.

UnixFd keeps a dup() (duplicate) of the supplied file descriptor. The caller remains responsible for closing the original fd.

variant_level must be non-negative; the default is 0.

Instance Methods [hide private]
a new object with type S, a subtype of T
__new__(T, S, ...) source code
int
take()
This method returns the file descriptor owned by UnixFd object.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
int variant_level
Indicates how many nested Variant containers this object is contained in: if a message's wire format has a variant containing a variant containing an Unix Fd, this is represented in Python by an Unix Fd with variant_level==2.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__new__(T, S, ...)

source code 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

take()

source code 

This method returns the file descriptor owned by UnixFd object. Note that, once this method is called, closing the file descriptor is the caller's responsibility.

This method may be called at most once; UnixFd 'forgets' the file descriptor after it is taken.

Returns: int
Raises:
  • ValueError - if this method has already been called