MCPcopy
hub / github.com/psycopg/psycopg / _pipeline_nolock

Method _pipeline_nolock

psycopg/psycopg/connection.py:456–474  ·  view source on GitHub ↗

like pipeline() but don't acquire a lock. Assume that the caller is holding the lock.

(self)

Source from the content-addressed store, hash-verified

454
455 @contextmanager
456 def _pipeline_nolock(self) -> Iterator[Pipeline]:
457 """like pipeline() but don't acquire a lock.
458
459 Assume that the caller is holding the lock.
460 """
461
462 # Currently only used internally by Cursor.executemany() in a branch
463 # in which we already established that the connection has no pipeline.
464 # If this changes we may relax the asserts.
465 assert not self._pipeline
466 # WARNING: reference loop, broken ahead.
467 pipeline = self._pipeline = Pipeline(self, _no_lock=True)
468 try:
469 with pipeline:
470 yield pipeline
471 finally:
472 assert pipeline.level == 0
473 assert pipeline is self._pipeline
474 self._pipeline = None
475
476 def wait(self, gen: PQGen[RV], interval: float = _WAIT_INTERVAL) -> RV:
477 """

Callers 2

executemanyMethod · 0.45
executemanyMethod · 0.45

Calls 1

PipelineClass · 0.85

Tested by

no test coverage detected