Skip to content
Snippets Groups Projects
Commit 62ad1a863263 authored by ijl's avatar ijl
Browse files

Specify functions' __module__ attribute as a str

parent 9be6b0d382ab
Branches
No related tags found
No related merge requests found
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
PyCFunction_NewEx( PyCFunction_NewEx(
Box::into_raw(Box::new(wrapped_dumps)), Box::into_raw(Box::new(wrapped_dumps)),
std::ptr::null_mut(), std::ptr::null_mut(),
mptr, PyUnicode_InternFromString("orjson\0".as_ptr() as *const c_char),
), ),
) )
}; };
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
PyCFunction_NewEx( PyCFunction_NewEx(
Box::into_raw(Box::new(wrapped_loads)), Box::into_raw(Box::new(wrapped_loads)),
std::ptr::null_mut(), std::ptr::null_mut(),
mptr, PyUnicode_InternFromString("orjson\0".as_ptr() as *const c_char),
), ),
) )
}; };
......
...@@ -178,6 +178,18 @@ ...@@ -178,6 +178,18 @@
self.assertEqual(str(inspect.signature(orjson.loads)), "(obj, /)") self.assertEqual(str(inspect.signature(orjson.loads)), "(obj, /)")
inspect.signature(orjson.loads).bind("[]") 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): def test_bytes_buffer(self):
""" """
dumps() trigger buffer growing where length is greater than growth dumps() trigger buffer growing where length is greater than growth
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment