BaseFilePathHandler has different working logic in Python 3.7 and Python 3.8, causing error reading files.
envgap__p1c2u__jsonschema-path-14
01 / FAILURE SIGNATURE
As reported upstream
This causes code in `file.py` to continue to `parsed_url = urlparse(uri)`. Which will give the following error: `AttributeError: '_io.BufferedReader' object has no attribute 'decode'`. This in turn causes `openapi-spec` to break when running `Spec.from_file_path` in Python 3.7 when it works in Python 3.8.
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
ad4ed320a7adad5c885954f3a8b568286dede318- Manifest
pyproject.toml- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
p1c2u/jsonschema-path #14 · read the original issue
Seems like the difference between `typing` and `typing_extensions` is causing a problem later on in Python 3.7 vs. Python 3.8. https://github.com/p1c2u/jsonschema-spec/blob/da5e04c7b3481e62555d9c3820496030b188d1de/jsonschema_spec/handlers/protocols.py#L5-L10
Here's a quick code snippet to test, for some reason the fh object in Python 3.8 is an instance of SupportsRead, and Python 3.7 it is not.
```
from urllib.request import urlopen
from jsonschema_spec.handlers.protocols import SupportsRead
with urlopen('file:///testing.yml') as fh: # ref#1
if isinstance(fh, SupportsRead): # ref#2
print("supports read!")
# simplifies to the following for testing, above is just more readable
with urlopen('file:///testing.yml') as fh: isinstance(fh, SupportsRead)
```
This causes code in `file.py` to continue to `parsed_url = urlparse(uri)`. Which will give the following error: `AttributeError: '_io.BufferedReader' object has no attribute 'decode'`. This in turn causes `openapi-spec` to break when running `Spec.from_file_path` in Python 3.7 when it works in Python 3.8.
I need to go eat, but you might understand what's happening more. And I imagine you'll want it fixed as it breaks < Python 3.7 versions. I'll figure out why the diff occurs later.
## references
ref#1: https://github.com/p1c2u/jsonschema-spec/blob/da5e04c7b3481e62555d9c3820496030b188d1de/jsonschema_spec/handlers/urllib.py#L17-L18
ref#2: https://github.com/p1c2u/jsonschema-spec/blob/da5e04c7b3481e62555d9c3820496030b188d1de/jsonschema_spec/handlers/file.py#L38-L3904 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]