I have encountered a certain generalization of the Lefschetz fixed point theorem as folklore, and I am hoping that someone out there knows its provenance or can otherwise refer me to a source where it is discussed or proved. The statement of the theorem should look vaguely like this:

Let $X$ be a smooth, complete variety over $\mathbb{C}$ and $g$ an automorphism of $X$. Suppose also that the fixed locus of $g$ is smooth and complete (but not necessarily discrete), and let $e(g)$ denote the Euler characteristic of this fixed locus. Then $$ e(g)=\sum _{i=0}^{\dim L} (-1)^i Tr (g | H^i(X)). $$

Any help or advice you can offer is much appreciated!