Merge ~mateus-morais/lazr.restfulclient:fix-python-3.12 into lazr.restfulclient:main
Proposed by
Mateus Rodrigues de Morais
Status: | Merged |
---|---|
Merged at revision: | 285acf59c7a9d9c843627b8724a94be90f3fed3f |
Proposed branch: | ~mateus-morais/lazr.restfulclient:fix-python-3.12 |
Merge into: | lazr.restfulclient:main |
Diff against target: |
16 lines (+4/-1) 1 file modified
src/lazr/restfulclient/authorize/oauth.py (+4/-1) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Simone Pelosi | Approve | ||
Review via email: mp+456978@code.launchpad.net |
Description of the change
Test for read_file before falling back to readfp using hasattr.
Since the fallback parameter in getattr() isn't lazily loaded, we get an AttributeError when readfp() isn't available (e.g. Python 3.12).
With hasattr(), we are able to check for the presence of read_file(). If not there, we safely fallback to readfp() instead.
To post a comment you must log in.
Thanks for the merge request. A colleague will look into this shortly.