Commit fe78efe
committed
python: support 'with' statement for objects
The python 'with' statement allows for correct resource tracking,
where the allocated resource will be freed at the end of the statement.
This is helpful for 'host', 'subsystem', and 'controller' objects
which we might want to clean up (and clear out the internal tree).
The nice thing here is that we can do an automatic controller
disconnect, and don't have to worry about leaving stale connections
or objects around.
Signed-off-by: Hannes Reinecke <[email protected]>1 parent 2c90d97 commit fe78efe
1 file changed
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
499 | 505 | | |
500 | 506 | | |
501 | 507 | | |
| |||
559 | 565 | | |
560 | 566 | | |
561 | 567 | | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
562 | 574 | | |
563 | 575 | | |
564 | 576 | | |
| |||
599 | 611 | | |
600 | 612 | | |
601 | 613 | | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
602 | 620 | | |
603 | 621 | | |
604 | 622 | | |
| |||
664 | 682 | | |
665 | 683 | | |
666 | 684 | | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
667 | 693 | | |
668 | 694 | | |
669 | 695 | | |
| |||
962 | 988 | | |
963 | 989 | | |
964 | 990 | | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
965 | 997 | | |
966 | 998 | | |
967 | 999 | | |
| |||
0 commit comments