@@ -759,7 +759,7 @@ _elementtree_Element___copy___impl(ElementObject *self)
759
759
}
760
760
761
761
/* Helper for a deep copy. */
762
- LOCAL (PyObject * ) deepcopy (PyObject * , PyObject * );
762
+ LOCAL (PyObject * ) deepcopy (elementtreestate * , PyObject * , PyObject * );
763
763
764
764
/*[clinic input]
765
765
_elementtree.Element.__deepcopy__
@@ -781,12 +781,13 @@ _elementtree_Element___deepcopy___impl(ElementObject *self, PyObject *memo)
781
781
PyObject * tail ;
782
782
PyObject * id ;
783
783
784
- tag = deepcopy (self -> tag , memo );
784
+ elementtreestate * st = ET_STATE_GLOBAL ;
785
+ tag = deepcopy (st , self -> tag , memo );
785
786
if (!tag )
786
787
return NULL ;
787
788
788
789
if (self -> extra && self -> extra -> attrib ) {
789
- attrib = deepcopy (self -> extra -> attrib , memo );
790
+ attrib = deepcopy (st , self -> extra -> attrib , memo );
790
791
if (!attrib ) {
791
792
Py_DECREF (tag );
792
793
return NULL ;
@@ -795,7 +796,6 @@ _elementtree_Element___deepcopy___impl(ElementObject *self, PyObject *memo)
795
796
attrib = NULL ;
796
797
}
797
798
798
- elementtreestate * st = ET_STATE_GLOBAL ;
799
799
element = (ElementObject * ) create_new_element (st , tag , attrib );
800
800
801
801
Py_DECREF (tag );
@@ -804,12 +804,12 @@ _elementtree_Element___deepcopy___impl(ElementObject *self, PyObject *memo)
804
804
if (!element )
805
805
return NULL ;
806
806
807
- text = deepcopy (JOIN_OBJ (self -> text ), memo );
807
+ text = deepcopy (st , JOIN_OBJ (self -> text ), memo );
808
808
if (!text )
809
809
goto error ;
810
810
_set_joined_ptr (& element -> text , JOIN_SET (text , JOIN_GET (self -> text )));
811
811
812
- tail = deepcopy (JOIN_OBJ (self -> tail ), memo );
812
+ tail = deepcopy (st , JOIN_OBJ (self -> tail ), memo );
813
813
if (!tail )
814
814
goto error ;
815
815
_set_joined_ptr (& element -> tail , JOIN_SET (tail , JOIN_GET (self -> tail )));
@@ -820,7 +820,7 @@ _elementtree_Element___deepcopy___impl(ElementObject *self, PyObject *memo)
820
820
goto error ;
821
821
822
822
for (i = 0 ; i < self -> extra -> length ; i ++ ) {
823
- PyObject * child = deepcopy (self -> extra -> children [i ], memo );
823
+ PyObject * child = deepcopy (st , self -> extra -> children [i ], memo );
824
824
if (!child || !Element_Check (st , child )) {
825
825
if (child ) {
826
826
raise_type_error (child );
@@ -856,10 +856,9 @@ _elementtree_Element___deepcopy___impl(ElementObject *self, PyObject *memo)
856
856
}
857
857
858
858
LOCAL (PyObject * )
859
- deepcopy (PyObject * object , PyObject * memo )
859
+ deepcopy (elementtreestate * st , PyObject * object , PyObject * memo )
860
860
{
861
861
/* do a deep copy of the given object */
862
- elementtreestate * st = ET_STATE_GLOBAL ;
863
862
PyObject * stack [2 ];
864
863
865
864
/* Fast paths */
0 commit comments