pyomo icon indicating copy to clipboard operation
pyomo copied to clipboard

Disallow calling `del_component` with ComponentData arguments

Open emma58 opened this issue 1 year ago • 2 comments

Fixes #3435

Summary/Motivation:

I think silently deleting the containing component when we call del_component on a ComponentData is rude, and the post-processing in Fourier-Motzkin elimination was falling victim to this mistake. This PR adds a ValueError to del_component if it is given a ComponentData and revises the FME transformation post-processing routine.

Changes proposed in this PR:

  • Sneaks in a documentation fix for ComponentData
  • Adds error to del_component if the arguments is a ComponentData
  • Revises FME post-processing routine to not misuse del_component and, in fact, to not add and delete as many components in general.

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

emma58 avatar Dec 02 '24 23:12 emma58

I agree with @michaelbynum that this is a bug and shouldn't have a deprecation path. Especially after I saw where it got hit in the codebase already... Assuming tests pass (I think they finally will?), this is ready for review again.

emma58 avatar Mar 25 '25 16:03 emma58

We are probably not going to aim to merge this before the patch release next week (because it's fairly intricate / could break some folks). We don't want to sneak this in without sufficient planning/warning.

mrmundt avatar Apr 08 '25 18:04 mrmundt

This is ready to merge when tests pass.

emma58 avatar Jun 24 '25 20:06 emma58