BUG: stats._distribution_infrastructure._Domain.symbols
class attribute is shared by instances
#22137
Labels
defect
A clear bug or issue that prevents SciPy from being installed or used as expected
scipy.stats
Milestone
Describe your issue.
The following class attribute is defined in
scipy.stats._distribution_infrastructure._Domain
:scipy/scipy/stats/_distribution_infrastructure.py
Line 216 in e7dfd40
Its subclass,
_SimpleDomain
, mutates it in an instance method:scipy/scipy/stats/_distribution_infrastructure.py
Line 297 in e7dfd40
... even though
_Domain.__init___
doesn't shadow it (i.e.self.symbols = ...
):scipy/scipy/stats/_distribution_infrastructure.py
Lines 269 to 274 in e7dfd40
So as far as I can tell, it's directly updated on the class state, and therefore shared between all instances. I don't see why this would be intended behaviour, so I thought I'd let you know.
This is relevant to the current
main
branch, and I spotted this in the1.15.0rc1
release.Reproducing Code Example
Error message
SciPy/NumPy/Python version and system information
The text was updated successfully, but these errors were encountered: