6
6
*/
7
7
8
8
#define PY_SSIZE_T_CLEAN
9
- #define NEEDS_PY_IDENTIFIER
10
9
11
10
#include "Python.h"
12
11
#include "structmember.h" // PyMemberDef
@@ -431,17 +430,19 @@ parse_filter_chain_spec(_lzma_state *state, lzma_filter filters[], PyObject *fil
431
430
Python-level filter specifiers (represented as dicts). */
432
431
433
432
static int
434
- spec_add_field (PyObject * spec , _Py_Identifier * key , unsigned long long value )
433
+ spec_add_field (PyObject * spec , const char * key , unsigned long long value )
435
434
{
436
- int status ;
437
- PyObject * value_object ;
438
-
439
- value_object = PyLong_FromUnsignedLongLong (value );
435
+ PyObject * value_object = PyLong_FromUnsignedLongLong (value );
440
436
if (value_object == NULL ) {
441
437
return -1 ;
442
438
}
443
-
444
- status = _PyDict_SetItemId (spec , key , value_object );
439
+ PyObject * key_object = PyUnicode_InternFromString (key );
440
+ if (key_object == NULL ) {
441
+ Py_DECREF (value_object );
442
+ return -1 ;
443
+ }
444
+ int status = PyDict_SetItem (spec , key_object , value_object );
445
+ Py_DECREF (key_object );
445
446
Py_DECREF (value_object );
446
447
return status ;
447
448
}
@@ -458,8 +459,7 @@ build_filter_spec(const lzma_filter *f)
458
459
459
460
#define ADD_FIELD (SOURCE , FIELD ) \
460
461
do { \
461
- _Py_IDENTIFIER(FIELD); \
462
- if (spec_add_field(spec, &PyId_##FIELD, SOURCE->FIELD) == -1) \
462
+ if (spec_add_field(spec, #FIELD, SOURCE->FIELD) == -1) \
463
463
goto error;\
464
464
} while (0)
465
465
0 commit comments