New GitHub issue #110744 from ryanschostag:<br>

<hr>

<pre>
# Bug report

### Bug description:

```python
def build_xml(self, json_data:dict) -> ET.Element:
    # there are about 180 lines of code that simply 
    # builds xml.etree.ElementTree.Element and xml.etree.ElementTree.SubElement objects
    # from the data found in the input data dictionary 
    root = ET.Element('rss')
    child_data = json_data.get('element_name', {})
    ET.SubElement('child', root, text=child_data.get('child_element', 'defaultvalue'), attrib={'key': child_data.get('child_key', ''))
    return root
```
This pattern repeats throughout the function. I am using Python 3.11.5 on Windows 10. The Python shell cannot replicate the error with a small dictionary. The input data is typically about 800-1000 lines of JSON when converted and saved as JSON file (e.g. json.dump(data, open('file.json', 'w'), indent=3)). 

This function that builds the XML object is called from the "main" function, which is called when the __name__ is '__main__'. 

PYthon 3.11.5 is the only version of Python on the Windows 10 system. It is also in a virtual environment setup by the virtualenv package and is activated at runtime when this bug happens. 

The packages in the virtual environment are:
- requests
- azure-keyvault-secrets
- azure-identity

However, the code for accessing Azure is commented out in this version. 

I'd like to understand why this is occurring. 


### CPython versions tested on:

3.11

### Operating systems tested on:

Windows
</pre>

<hr>

<a href="https://github.com/python/cpython/issues/110744">View on GitHub</a>
<p>Labels: type-bug</p>
<p>Assignee: </p>