(self)
Break reference cycles to allow instance to be garbage-collected.
        Raises if called on a submitted transfer.
Break reference cycles to allow instance to be garbage-collected.
        Raises if called on a submitted transfer.
Break reference cycles to allow instance to be garbage - collected . Raises if called on a submitted transfer .
def close(self):
        """
        Break reference cycles to allow instance to be garbage-collected.
        Raises if called on a submitted transfer.
        """
        if self.__submitted:
            raise ValueError('Cannot close a submitted transfer')
        self.doom()
        self.__initialized = False
        # Break possible external reference cycle
        self.__callback = None
        # Break libusb_transfer reference cycles
        self.__ctypesCallbackWrapper = None
        # For some reason, overwriting callback is not enough to remove this
        # reference cycle - though sometimes it works:
        #   self -> self.__dict__ -> libusb_transfer -> dict[x] -> dict[x] ->
        #   CThunkObject -> __callbackWrapper -> self
        # So free transfer altogether.
        if self.__transfer is not None:
            self.__libusb_free_transfer(self.__transfer)
            self.__transfer = None
        # Break USBDeviceHandle reference cycle
        self.__before_submit = None
        self.__after_completion = None
def close ( self ) : if self . __submitted : raise ValueError ( 'Cannot close a submitted transfer' ) self . doom ( ) self . __initialized = False # Break possible external reference cycle self . __callback = None # Break libusb_transfer reference cycles self . __ctypesCallbackWrapper = None # For some reason, overwriting callback is not enough to remove this # reference cycle - though sometimes it works: #   self -> self.__dict__ -> libusb_transfer -> dict[x] -> dict[x] -> #   CThunkObject -> __callbackWrapper -> self # So free transfer altogether. if self . __transfer is not None : self . __libusb_free_transfer ( self . __transfer ) self . __transfer = None # Break USBDeviceHandle reference cycle self . __before_submit = None self . __after_completion = None