@@ -619,11 +619,17 @@ int CPyStatics_Initialize(PyObject **statics,
619619 PyObject * * result = statics ;
620620 // Start with some hard-coded values
621621 * result ++ = Py_None ;
622+ #if !CPY_3_14_FEATURES
622623 Py_INCREF (Py_None );
624+ #endif
623625 * result ++ = Py_False ;
626+ #if !CPY_3_14_FEATURES
624627 Py_INCREF (Py_False );
628+ #endif
625629 * result ++ = Py_True ;
630+ #if !CPY_3_14_FEATURES
626631 Py_INCREF (Py_True );
632+ #endif
627633 if (strings ) {
628634 for (; * * strings != '\0' ; strings ++ ) {
629635 size_t num ;
@@ -636,8 +642,11 @@ int CPyStatics_Initialize(PyObject **statics,
636642 if (obj == NULL ) {
637643 return -1 ;
638644 }
639- PyUnicode_InternInPlace (& obj );
645+ PyUnicode_InternInPlace (& obj );
640646 * result ++ = obj ;
647+ #if CPY_3_14_FEATURES
648+ CPy_SetImmortal (obj );
649+ #endif
641650 data += len ;
642651 }
643652 }
@@ -655,6 +664,9 @@ int CPyStatics_Initialize(PyObject **statics,
655664 return -1 ;
656665 }
657666 * result ++ = obj ;
667+ #if CPY_3_14_FEATURES
668+ CPy_SetImmortal (obj );
669+ #endif
658670 data += len ;
659671 }
660672 }
@@ -670,6 +682,9 @@ int CPyStatics_Initialize(PyObject **statics,
670682 if (obj == NULL ) {
671683 return -1 ;
672684 }
685+ #if CPY_3_14_FEATURES
686+ CPy_SetImmortal (obj );
687+ #endif
673688 data = end ;
674689 data ++ ;
675690 * result ++ = obj ;
@@ -683,6 +698,9 @@ int CPyStatics_Initialize(PyObject **statics,
683698 if (obj == NULL ) {
684699 return -1 ;
685700 }
701+ #if CPY_3_14_FEATURES
702+ CPy_SetImmortal (obj );
703+ #endif
686704 * result ++ = obj ;
687705 }
688706 }
@@ -695,6 +713,9 @@ int CPyStatics_Initialize(PyObject **statics,
695713 if (obj == NULL ) {
696714 return -1 ;
697715 }
716+ #if CPY_3_14_FEATURES
717+ CPy_SetImmortal (obj );
718+ #endif
698719 * result ++ = obj ;
699720 }
700721 }
@@ -706,10 +727,17 @@ int CPyStatics_Initialize(PyObject **statics,
706727 if (obj == NULL ) {
707728 return -1 ;
708729 }
730+ #if CPY_3_14_FEATURES
731+ CPy_SetImmortal (obj );
732+ #endif
709733 int i ;
710734 for (i = 0 ; i < num_items ; i ++ ) {
711735 PyObject * item = statics [* tuples ++ ];
736+ #if CPY_3_14_FEATURES
737+ CPy_SetImmortal (item );
738+ #else
712739 Py_INCREF (item );
740+ #endif
713741 PyTuple_SET_ITEM (obj , i , item );
714742 }
715743 * result ++ = obj ;
@@ -723,9 +751,16 @@ int CPyStatics_Initialize(PyObject **statics,
723751 if (obj == NULL ) {
724752 return -1 ;
725753 }
754+ #if CPY_3_14_FEATURES
755+ CPy_SetImmortal (obj );
756+ #endif
726757 for (int i = 0 ; i < num_items ; i ++ ) {
727758 PyObject * item = statics [* frozensets ++ ];
759+ #if CPY_3_14_FEATURES
760+ CPy_SetImmortal (item );
761+ #else
728762 Py_INCREF (item );
763+ #endif
729764 if (PySet_Add (obj , item ) == -1 ) {
730765 return -1 ;
731766 }
0 commit comments