REF: de-duplicate precision_from_unit
- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

Thanks @jbrockmendel  Opened a pr to revert if there is no quick fix. Is there a way to raise exceptions from a Cython function which returns a tuple? I think the issue is that
```
cpdef inline (int64_t, int) precision_from_unit(
    str unit,
    NPY_DATETIMEUNIT out_reso=NPY_DATETIMEUNIT.NPY_FR_ns,
):
```
may raise because it calls `get_conversion_factor`. Problem is, how to propagate it? Wrapping the get_conversion_factor call in a try/except that just passed on failure (which will then raise on the next line bc `m` is not assigned) fixes the failing tests, but is pretty ugly.  For now could check for M/Y before calling get_conversion_factor.

> Problem is, how to propagate it?

This is weird.  Seems like a cython bug.