  For the purposes of this paper, Dehn surgery along a curve K in a 3-manifold
M with slope r is `exceptional' if the resulting 3-manifold M_K(r) is reducible
or a solid torus, or the core of the surgery solid torus has finite order in
the fundamental group of M_K(r). We show that, providing the exterior of K is
irreducible and atoroidal, and the distance between r and the meridian slope is
more than one, and a homology condition is satisfied, then there is (up to
ambient isotopy) only a finite number of such exceptional surgery curves in a
given compact orientable 3-manifold M, with the boundary of M a (possibly
empty) union of tori. Moreover, there is a simple algorithm to find all these
surgery curves, which involves inserting tangles into the 3-simplices of any
given triangulation of M. As a consequence, we deduce some results about the
finiteness of certain unknotting operations on knots in the 3-sphere.
