Closed jakul closed 4 years ago
Hey @jakul! Thanks for the report. We made a lot of changes to exceptions in this latest release. Am I understanding correctly that you were relying on PathAccessError.path
to be a instance of the Path
type in order to use the Path.values()
method?
If so, the direct workaround is to pass ex.path
into Path
and use the resulting object's .values()
method.
...: import glom
...: try:
...: glom.glom({}, 'a')
...: except glom.PathAccessError as ex:
...: print(glom.Path(ex.path).values())
That'll give you ('a',)
like in v20.5.0, and it's harmless to call Path
on a path instance (like calling int(int(1))
), so depending on where we land on this, it'll keep working.
PathAccessError.path to be a instance of the Path type in order to use the Path.values() method?
Yup, exactly that.
Thanks for the workaround. Are you planning to restore the previous behaviour - where path
is always a Path
instance - or leave .path
as a TType
permanently?
Discussed with @kurtbrose today and I think it makes sense to switch it back to a Path. Leaves more options open for API in the future. I'll be adding some tests to prevent this regression and cut another release tonight or tomorrow. Stay tuned!
Thanks @mahmoud, I appreciate it!
v20.7 has introduced a regression which can cause
ex.path.values()
to hang.Trying to call
values()
on aTType
hangs indefinitely.