idaholab / MontePy

MontePy is the most user friendly Python library (API) to read, edit, and write MCNP input files.
https://www.montepy.org/
MIT License
30 stars 6 forks source link

Fixed bug double adding materials. #538

Closed MicahGale closed 3 weeks ago

MicahGale commented 3 weeks ago

Description

This fixes a bug where append_renumber can double add a material to data_inputs.

append_renumber does:

  1. tries to append
  2. if failure occurs
  3. change the number
  4. append again.

NumberedDataObjectCollection append was doing:

  1. data_inputs.insert
  2. super().append

This fail and retry method led to data_inputs.insert being called twice. So making sure super().append occurs first fixes this.

Fixes #516

Checklist