Let $G$ be an open connected subset of $\mathbb{C}$ and $p_1,...,p_m$ be points in $G$. (Not necessarily distinct). Let $f:G\setminus\{p_1,...,p_m\} \rightarrow \mathbb{C}$ be a holomorphic function and assume that $p_1,...,p_m$ are the poles of $f$ (counting multiplicities).
Let $z_1,...,z_n$ be the zeros of $f$ (counting multiplicities) and $\gamma$ be a simple close curve in $G$ not passing through zeros and poles of $f$.
Since $p_1,...,p_m$ are the poles of $f$, there exists a holomorphic $g:G\rightarrow \mathbb{C}$ such that $f(z)(z-p_1)\cdots (z-p_m)=g(z)$.
Direct computation yields that :
$\frac{1}{2\pi i} \int_\gamma f'(z)/f(z) dz = \frac{1}{2\pi i} \int_\gamma g'(z)/g(z) dz - \sum_{k=1}^m Wnd(\gamma,p_k)$
However, note that every zero of $f$ is a zero of $g$ and $p_1,...,p_m$ are also zeros of $g$. Hence $\frac{1}{2\pi i} g'(z)/g(z) dz = \sum_{k=1}^n Wnd(\gamma,z_k) + \sum_{k=1}^m Wnd(\gamma,p_k)$. Thus $\frac{1}{2\pi i} \int_\gamma f'(z)/f(z) dz = \sum_{k=1}^n Wmd(\gamma,z_k)$.
This is contrary to Argument principle, hence this must be wrong. Where did I go wrong?
No, $p_1,\dots, p_m$ are not zeros of $g$. Let $f(z)=\frac{1}{z}$ so $m=1$, $p_1=0$ and $g(z)(z-p_1)=1$.