diff --git a/doc/source/whatsnew/v2.1.0.rst b/doc/source/whatsnew/v2.1.0.rst index b7d17d1abbe91..45a5efa574bf9 100644 --- a/doc/source/whatsnew/v2.1.0.rst +++ b/doc/source/whatsnew/v2.1.0.rst @@ -424,7 +424,7 @@ Other - Bug in :meth:`DataFrame.reindex` with a ``fill_value`` that should be inferred with a :class:`ExtensionDtype` incorrectly inferring ``object`` dtype (:issue:`52586`) - Bug in :meth:`Series.map` when giving a callable to an empty series, the returned series had ``object`` dtype. It now keeps the original dtype (:issue:`52384`) - Bug in :meth:`Series.memory_usage` when ``deep=True`` throw an error with Series of objects and the returned value is incorrect, as it does not take into account GC corrections (:issue:`51858`) -- +- Fixed incorrect ``__name__`` attribute of ``pandas._libs.json`` (:issue:`52898`) .. ***DO NOT USE THIS SECTION*** diff --git a/pandas/_libs/src/ujson/python/ujson.c b/pandas/_libs/src/ujson/python/ujson.c index c12f88d2f9354..5c87ee6dd7ddc 100644 --- a/pandas/_libs/src/ujson/python/ujson.c +++ b/pandas/_libs/src/ujson/python/ujson.c @@ -83,7 +83,7 @@ static int module_clear(PyObject *m); static void module_free(void *module); static struct PyModuleDef moduledef = {.m_base = PyModuleDef_HEAD_INIT, - .m_name = "_libjson", + .m_name = "pandas._libs.json", .m_methods = ujsonMethods, .m_size = sizeof(modulestate), .m_traverse = module_traverse, diff --git a/pandas/tests/io/json/test_ujson.py b/pandas/tests/io/json/test_ujson.py index 6b635a4f46972..0df6b1eef72c0 100644 --- a/pandas/tests/io/json/test_ujson.py +++ b/pandas/tests/io/json/test_ujson.py @@ -694,6 +694,10 @@ def e(self): test_object = _TestObject(a=1, b=2, _c=3, d=4) assert ujson.decode(ujson.encode(test_object)) == {"a": 1, "b": 2, "d": 4} + def test_ujson__name__(self): + # GH 52898 + assert ujson.__name__ == "pandas._libs.json" + class TestNumpyJSONTests: @pytest.mark.parametrize("bool_input", [True, False])