get() may fail with an exception and thus not return if the remote
LDAP server is inaccessible and the pool has no idle connections,
but spawn() unconditionally attempts to return the connection
returned by get() to the pool in a finally block. This can result
in an UnboundLocalError for conn, since the local variable is only
created on successful return from get().
Handle this by initializing conn and not attempting to return it to
the pool if it's still None.
get() may fail with an exception and thus not return if the remote LDAP server is inaccessible and the pool has no idle connections, but spawn() unconditionally attempts to return the connection returned by get() to the pool in a finally block. This can result in an UnboundLocalError for conn, since the local variable is only created on successful return from get().
Handle this by initializing conn and not attempting to return it to the pool if it's still None.