File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
Original file line number Diff line number Diff line change @@ -2250,12 +2250,6 @@ cache_struct_converter(PyObject *module, PyObject *fmt, PyStructObject **ptr)
2250
2250
return 1 ;
2251
2251
}
2252
2252
2253
- if (state -> cache == NULL ) {
2254
- state -> cache = PyDict_New ();
2255
- if (state -> cache == NULL )
2256
- return 0 ;
2257
- }
2258
-
2259
2253
s_object = PyDict_GetItemWithError (state -> cache , fmt );
2260
2254
if (s_object != NULL ) {
2261
2255
* ptr = (PyStructObject * )Py_NewRef (s_object );
@@ -2288,7 +2282,7 @@ static PyObject *
2288
2282
_clearcache_impl (PyObject * module )
2289
2283
/*[clinic end generated code: output=ce4fb8a7bf7cb523 input=463eaae04bab3211]*/
2290
2284
{
2291
- Py_CLEAR (get_struct_state (module )-> cache );
2285
+ PyDict_Clear (get_struct_state (module )-> cache );
2292
2286
Py_RETURN_NONE ;
2293
2287
}
2294
2288
@@ -2512,6 +2506,11 @@ _structmodule_exec(PyObject *m)
2512
2506
{
2513
2507
_structmodulestate * state = get_struct_state (m );
2514
2508
2509
+ state -> cache = PyDict_New ();
2510
+ if (state -> cache == NULL ) {
2511
+ return -1 ;
2512
+ }
2513
+
2515
2514
state -> PyStructType = PyType_FromModuleAndSpec (
2516
2515
m , & PyStructType_spec , NULL );
2517
2516
if (state -> PyStructType == NULL ) {
You can’t perform that action at this time.
0 commit comments