You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The column format is currently cached in a global dictionary keyed with the format and id() of the column. The problem is that when the table/column get garbage collected, a totally different column can be later placed in the same memory location and thus have the same id(). That may seem unlikely, but I've been encountering this seemingly random bug in real code (and in photutils CI testing).
Later, a regular non-mixin Column cannot be printed because it's trying to use the Quantity formatter. This is because the initial column has been garbage collected and the later Column has the same id() -- thus it uses the cached formatter.
This was frustrating to debug in actual code because it was hard to reliably reproduce, but here's a contrived example showing the bug:
My suggestion would be to cache the formatter in the column info object, as suggested in #5804. I don't understand the concern about the case when the column does not yet have data. Perhaps I missed something, but it appears that the caching occurs only when the first item of the column is printed, so the column must have data in order for the format to be cached. Also, how does one even set the column format without having defined the column object?
@larrybradley - yikes, sorry to have had you debug that - I can see that that would have been far from trivial to find! I agree with your conclusion, that we should implement #5804. I should add that I'm not sure I'll have time soon to actually do that... I will add a comment to #5804 about how (inspired by what you write above).
Is it related to the random bug that was happening before v2.0 release ? #6291 (which looks similar), which lead to #6346 and other issues / PRs. I remember when looking at this, I was stuck with columns using a wrong format function.
Activity
mhvk commentedon Oct 10, 2017
@larrybradley - yikes, sorry to have had you debug that - I can see that that would have been far from trivial to find! I agree with your conclusion, that we should implement #5804. I should add that I'm not sure I'll have time soon to actually do that... I will add a comment to #5804 about how (inspired by what you write above).
taldcroft commentedon Oct 10, 2017
I took a look at this during a plane flight and I might be able to tackle this in the next week or two.
saimn commentedon Oct 10, 2017
Is it related to the random bug that was happening before v2.0 release ? #6291 (which looks similar), which lead to #6346 and other issues / PRs. I remember when looking at this, I was stuck with columns using a wrong format function.
Add test of problem in astropy#6703