jsonschema: {relative,absolute}_path can hold ints#7980
jsonschema: {relative,absolute}_path can hold ints#7980AlexWaygood merged 3 commits intopython:masterfrom
Conversation
Not used to the `x|y` syntax
15ea157 to
83a515b
Compare
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
|
@sirosen, does this change make sense to you? :) |
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
|
Yes, this change is definitely an improvement -- the OP's comment/example on the earlier PR is accurate, and I'm sorry I didn't catch this earlier. I'm looking now to see if there are other |
I'll merge for now; further fixes can be made in further PRs if necessary. |
AlexWaygood
left a comment
There was a problem hiding this comment.
Thanks for the fix, and thanks @sirosen for confirming!
Fixes #12901 by incoprating python/typeshed#7980 (The olddeps will automatically be fixed now, but let's pull in the more complete stubs for day-to-day use while we're at it.)
In matrix-org/synapse#12901 I noticed an problem with the changes to the jsonschema stubs in #7950.
This change remedies that by teaching mypy that paths, relative paths and absolute paths on Error objects can hold strings, ints, or a mixture of the two. For evidence that this is the case, see e.g. https://github.com/python-jsonschema/jsonschema/blob/2e2832463e8de7977217d377ca0553c10f6fb48c/jsonschema/tests/test_exceptions.py#L246-L247 or the test case I provided in #7950 (comment).