The momentum operator in one dimension in quantum mechanics is $P=-i\frac{d}{dx}$ (with $\hbar=1$). Consider it as an operator on $L_2(0,2\pi)$, the space of square-integrable functions on $(0,2\pi)$. It isn't continuous in fact if I consider the sequence $$ g_n(x)=\frac{e^{inx}}{\sqrt{2\pi n}} $$ it's a Cauchy sequence but $\{Pg_n\}_n$ does not converge.
I am searching a domain where P is a continuous functional. My professor gave me the example $$D_P=\{\varphi \in L_2(0,2\pi):\varphi(0)=\varphi(2\pi) \}$$ but I'm not convinced because if I consider the function $\psi$
\begin{equation} \begin{cases} -\frac{x}{\sqrt{\pi}}+\sqrt{\pi},\hspace{0.5cm} 0\leq x<\pi\\\sqrt{x-\pi},\hspace{0.5cm} \pi\leq x \leq 2\pi \end{cases} \end{equation} it belongs to $D_P$, but if I apply P on it I obtain
\begin{equation} \begin{cases} \frac{i}{\sqrt{\pi}},\hspace{0.5cm} 0\leq x<\pi\\ -\frac{i}{2\sqrt{x-\pi}},\hspace{0.5cm} \pi\leq x \leq 2\pi \end{cases} \end{equation} that is not square-integrable on $(0,2\pi)$.

Am I wrong? If not, which is a correct continuity domain for P?