BUG: Fix metadata not roundtripping when pickling datetime (#29555) by charris · Pull Request #29563 · numpy/numpy

@MaanasArora @charris

* BUG: fix metadata not roundtripping for datetime pickles

* STYLE: Remove unnecessary newline

* REF: Simplify metadata handling in arraydescr_setstate function

* TST: add test to ensure datetime dtype metadata round-trips on pickling

* REF: clearer operation order

* TST: add new regression test (numpygh-29555)

* BUG: don't steal reference to Py_None

* REF: move metadata variable declarations below for clarity