I am reading Gathmann notes on Algebraic Geometry. He defines the local ring of an affine variety $X \subset \mathbb{A}^n$ (affine variety means an irreducible algebraic set here) as follows $$ \mathcal{O}_{X, P} = \left\{ \frac{f}{g} :f, g \in A(X) \text{ and } g(P) \neq 0 \right\}. $$ ($A(X)$ is the coordinate ring here).
Confusion: I think it can happen that one of the representative of an element/rational function in $\mathcal{O}_{X, P}$ has a denominator that vanishes at $P$, that is, if $f/g \in \mathcal{O}_{X, P}$ then we can write $f/g$ as $(x_1 - p_1)f/(x_1 - p_1)g$ where $p_1$ is the first coordinate of the point $P$. Although $g$ does not vanish at $P$ but $(x_1 - p_1)g$ does. So I thought what is required is that at least one representative has a denominator that does not vanish at $P$ but later he says that $O_{X, P}$ is the localization of $A(X)$ at the maximal ideal $m_{X, P} = \{f \in A(X) : f(p) = 0\}$ but in the localization $A(X)_{m_{X, P}}$ we have that no denominator polynomial can vanish at $P$ so it is not consistent with the definition of $O_{X, P}$. What am I missing here?