# HG changeset patch
# User ijl <ijl@mailbox.org>
# Date 1602020717 0
#      Tue Oct 06 21:45:17 2020 +0000
# Node ID 62ad1a8632638578664e5cd3e4809f211ec9e58e
# Parent  9be6b0d382ab6b4c1182d66a90fe1b59db891c5f
Specify functions' __module__ attribute as a str

diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -84,7 +84,7 @@
             PyCFunction_NewEx(
                 Box::into_raw(Box::new(wrapped_dumps)),
                 std::ptr::null_mut(),
-                mptr,
+                PyUnicode_InternFromString("orjson\0".as_ptr() as *const c_char),
             ),
         )
     };
@@ -103,7 +103,7 @@
             PyCFunction_NewEx(
                 Box::into_raw(Box::new(wrapped_loads)),
                 std::ptr::null_mut(),
-                mptr,
+                PyUnicode_InternFromString("orjson\0".as_ptr() as *const c_char),
             ),
         )
     };
diff --git a/test/test_api.py b/test/test_api.py
--- a/test/test_api.py
+++ b/test/test_api.py
@@ -178,6 +178,18 @@
         self.assertEqual(str(inspect.signature(orjson.loads)), "(obj, /)")
         inspect.signature(orjson.loads).bind("[]")
 
+    def test_dumps_module_str(self):
+        """
+        orjson.dumps.__module__ is a str
+        """
+        self.assertEqual(orjson.dumps.__module__, "orjson")
+
+    def test_loads_module_str(self):
+        """
+        orjson.loads.__module__ is a str
+        """
+        self.assertEqual(orjson.loads.__module__, "orjson")
+
     def test_bytes_buffer(self):
         """
         dumps() trigger buffer growing where length is greater than growth