2. $\mathrm{B}$ The original expression can be simplified to $y=\tan x$. Do not assume that the smallest positive period is $\pi$. Since when $x=0$, the function is defined, but when $x=\pi$, the function is undefined. Therefore, the answer is B.
2. The smallest positive period of the function $y=\sin x\left(1+\tan x \tan \frac{x}{2}\right)$ is
A. $\pi$
B. $2 \pi$
C. $\frac{\pi}{2}$
D. $\frac{3 \pi}{2}$