File tree 2 files changed +7
-32
lines changed
2 files changed +7
-32
lines changed Original file line number Diff line number Diff line change @@ -65,35 +65,15 @@ static PyMethodDef ujsonMethods[] = {
65
65
{NULL , NULL , 0 , NULL } /* Sentinel */
66
66
};
67
67
68
- static struct PyModuleDef moduledef = {
69
- PyModuleDef_HEAD_INIT ,
70
- "_libjson" ,
71
- 0 , /* m_doc */
72
- -1 , /* m_size */
73
- ujsonMethods , /* m_methods */
74
- NULL , /* m_reload */
75
- NULL , /* m_traverse */
76
- NULL , /* m_clear */
77
- NULL /* m_free */
68
+ static PyModuleDef moduledef = {
69
+ .m_base = PyModuleDef_HEAD_INIT ,
70
+ .m_name = "_libjson" ,
71
+ .m_methods = ujsonMethods
78
72
};
79
73
80
- #define PYMODINITFUNC PyMODINIT_FUNC PyInit_json(void)
81
- #define PYMODULE_CREATE () PyModule_Create(&moduledef)
82
- #define MODINITERROR return NULL
83
74
84
- PYMODINITFUNC {
85
- PyObject * module ;
86
- PyObject * version_string ;
75
+ PyMODINIT_FUNC PyInit_json ( void ) {
76
+ initObjToJSON (); // TODO: clean up, maybe via tp_free?
77
+ return PyModuleDef_Init ( & moduledef ) ;
87
78
88
- initObjToJSON ();
89
- module = PYMODULE_CREATE ();
90
-
91
- if (module == NULL ) {
92
- MODINITERROR ;
93
- }
94
-
95
- version_string = PyUnicode_FromString (UJSON_VERSION );
96
- PyModule_AddObject (module , "__version__" , version_string );
97
-
98
- return module ;
99
79
}
Original file line number Diff line number Diff line change @@ -559,11 +559,6 @@ def test_loads_non_str_bytes_raises(self):
559
559
with pytest .raises (TypeError , match = msg ):
560
560
ujson .loads (None )
561
561
562
- def test_version (self ):
563
- assert re .match (
564
- r"^\d+\.\d+(\.\d+)?$" , ujson .__version__
565
- ), "ujson.__version__ must be a string like '1.4.0'"
566
-
567
562
def test_encode_numeric_overflow (self ):
568
563
with pytest .raises (OverflowError ):
569
564
ujson .encode (12839128391289382193812939 )
You can’t perform that action at this time.
0 commit comments