I have the following integral $$ I = \int_{-\infty}^{+\infty}\frac{\sin x}{(x-\pi)^2(x+\pi/2)}dx\text{,} $$ that I am supposed to solve with the theorem of residues.
I see that there are two simple poles in $\pi$ (given that $\pi$ is a simple zero of the numerator and a double zero of the denominator) and in $-\pi/2$.
Having only simple poles, this should mean that the integral exists in the sense of Cauchy principal value.
When I take the usual step of considering the analytic function $$ f(z)=\frac{e^{iz}}{(z-\pi)^2(z+\pi/2)}\text{.} $$ I see that the simple pole $\pi$ becomes a double pole, because it is not anymore a zero of the numerator.
Can I still proceed with $$ I = \operatorname{Im}\big[\pi i\big(R[\pi]+R[-\pi/2]\big)\big] \text{,} $$ where $R[z_0]$ is the residue of $f$ in $z_0$, or there is some other consideration to take into account?

If we decompose in simple fractions the rational part of the function under the integral sign $$ \frac{1}{(x-\pi)^2(x+\pi/2)}=\frac{4}{9\pi^2}\cdot\frac{1}{x+\pi/2}-\frac{4}{9\pi^2}\cdot\frac{1}{x-\pi}+\frac{2}{3\pi}\cdot\frac{1}{(x-\pi)^2} $$ and taking into account that we have $$ \text{p.v.}\int_{-\infty}^{+\infty}\frac{\sin x}{(x-\pi)^2}dx= {}-\text{p.v.}\int_{-\infty}^{+\infty}\frac{\sin t}{t^2}dt=0 $$ we see that we can only consider the first two terms of the decomposition $$ \frac{4}{9\pi^2}\cdot\frac{1}{x+\pi/2}-\frac{4}{9\pi^2}\cdot\frac{1}{x-\pi}= -\frac{2}{3\pi}\cdot\frac{1}{(x-\pi)(x+\pi/2)} $$ so the integral becomes $$ -\frac{2}{3\pi}\int_{-\infty}^{+\infty}\frac{\sin x}{(x-\pi)(x+\pi/2)}dx $$ that can be evaluated with standard methods.