Hi. I am trying to evaluate the following integral:

I =

where -1 < p < 1 and 0 < < 2*Pi. One can easily show the following:

When we transfer this over to the complex plane this means we have a branch point at x = 0 and a couple of simple poles at x = and x =

I am attempting to apply the pacman or keyhole contour here where the branch cut is made along the positive real axis.

I end up with the following:

A = = = I = I

But by the residue theorem we have:

A =

which implies:

I = =

but this cannot be right since we are integrating a real valued function over the real line... it shouldnt have any imaginary components. What have I done wrong?