(self, extype, ex, tb)
| 68 | await self.start() |
| 69 | |
| 70 | async def __aexit__(self, extype, ex, tb): |
| 71 | try: |
| 72 | self._check_conn_validity('__aexit__') |
| 73 | except apg_errors.InterfaceError: |
| 74 | if extype is GeneratorExit: |
| 75 | # When a PoolAcquireContext is being exited, and there |
| 76 | # is an open transaction in an async generator that has |
| 77 | # not been iterated fully, there is a possibility that |
| 78 | # Pool.release() would race with this __aexit__(), since |
| 79 | # both would be in concurrent tasks. In such case we |
| 80 | # yield to Pool.release() to do the ROLLBACK for us. |
| 81 | # See https://github.com/MagicStack/asyncpg/issues/232 |
| 82 | # for an example. |
| 83 | return |
| 84 | else: |
| 85 | raise |
| 86 | |
| 87 | try: |
| 88 | if extype is not None: |
| 89 | await self.__rollback() |
| 90 | else: |
| 91 | await self.__commit() |
| 92 | finally: |
| 93 | self._managed = False |
| 94 | |
| 95 | @connresource.guarded |
| 96 | async def start(self): |
nothing calls this directly
no test coverage detected