Skip to content

Commit

Permalink
add 'with' support (pyaxengine AXERA-TECH#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
zylo117 committed Dec 9, 2024
1 parent 63573bb commit 38ccf4f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions axclrt/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ def _sub_init(self):
def __del__(self):
self._final()

def __enter__(self):
return self

def __exit__(self, exc_type, exc_value, traceback):
self._final()

def _prepare_io(self, grp_id, io_info, io, io_data, strategy):
self._rt_lib.memset(io_data, 0, self._rt_ffi.sizeof('AXCL_IO_DATA_T'))

Expand Down

0 comments on commit 38ccf4f

Please sign in to comment.