File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -363,6 +363,8 @@ fortran_getattr(PyFortranObject *fp, char *name)
363
363
{
364
364
int i , j , k , flag ;
365
365
if (fp -> dict != NULL ) {
366
+ // python 3.13 added PyDict_GetItemRef
367
+ #if PY_VERSION_HEX < 0x030D0000
366
368
PyObject * v = _PyDict_GetItemStringWithError (fp -> dict , name );
367
369
if (v == NULL && PyErr_Occurred ()) {
368
370
return NULL ;
@@ -371,6 +373,17 @@ fortran_getattr(PyFortranObject *fp, char *name)
371
373
Py_INCREF (v );
372
374
return v ;
373
375
}
376
+ #else
377
+ PyObject * v ;
378
+ int result = PyDict_GetItemStringRef (fp -> dict , name , & v );
379
+ if (result == -1 ) {
380
+ return NULL ;
381
+ }
382
+ else if (result == 1 ) {
383
+ return v ;
384
+ }
385
+ #endif
386
+
374
387
}
375
388
for (i = 0 , j = 1 ; i < fp -> len && (j = strcmp (name , fp -> defs [i ].name ));
376
389
i ++ )
You can’t perform that action at this time.
0 commit comments