diff --git a/can/__init__.py b/can/__init__.py index 46a461b38..7c6266f79 100644 --- a/can/__init__.py +++ b/can/__init__.py @@ -8,7 +8,7 @@ import logging from typing import Any, Dict -__version__ = "4.2.2" +__version__ = "4.2.2.99" __all__ = [ "ASCReader", "ASCWriter", diff --git a/can/bus.py b/can/bus.py index 555389b0f..b077308f1 100644 --- a/can/bus.py +++ b/can/bus.py @@ -95,6 +95,8 @@ def __init__( :raises ~can.exceptions.CanInitializationError: If the bus cannot be initialized """ + LOG.setLevel(logging.DEBUG) + self._periodic_tasks: List[_SelfRemovingCyclicTask] = [] self.set_filters(can_filters) @@ -460,9 +462,12 @@ def shutdown(self) -> None: if self._is_shutdown: LOG.debug("%s is already shut down", self.__class__) return + else: + LOG.warning("%s shutdown needed", self.__class__) self._is_shutdown = True self.stop_all_periodic_tasks() + LOG.warning("Is shutdown = %s", self._is_shutdown) def __enter__(self) -> Self: return self @@ -476,8 +481,9 @@ def __exit__( self.shutdown() def __del__(self) -> None: + LOG.warning("Is shutdown = %s", self._is_shutdown) if not self._is_shutdown: - LOG.warning("%s was not properly shut down", self.__class__.__name__) + LOG.info("%s was not properly shut down", self.__class__.__name__) # We do some best-effort cleanup if the user # forgot to properly close the bus instance with contextlib.suppress(AttributeError): diff --git a/can/interfaces/socketcan/socketcan.py b/can/interfaces/socketcan/socketcan.py index 377fe6478..aff04b43c 100644 --- a/can/interfaces/socketcan/socketcan.py +++ b/can/interfaces/socketcan/socketcan.py @@ -723,7 +723,7 @@ def shutdown(self) -> None: for channel, bcm_socket in self._bcm_sockets.items(): log.debug("Closing bcm socket for channel %s", channel) bcm_socket.close() - log.debug("Closing raw can socket") + log.warning("Closing raw can socket") self.socket.close() def _recv_internal( @@ -916,7 +916,7 @@ def receiver(event: threading.Event) -> None: bind_socket(receiver_socket, "vcan0") print("Receiver is waiting for a message...") event.set() - print(f"Receiver got: {capture_message(receiver_socket)}") + # print(f"Receiver got: {capture_message(receiver_socket)}") def sender(event: threading.Event) -> None: event.wait()