Skip to content

TypeError: 'type' object is not subscriptable in google.auth.credentials.py on Python 3.8 #1804

@nbayati

Description

@nbayati

Problem:
Users running google-auth on Python 3.8 (and potentially older versions like 3.7) encounter a TypeError: 'type' object is not subscriptable during module import. This error occurs specifically on line 30 of google/auth/credentials.py:

NO_OP_TRUST_BOUNDARY_LOCATIONS: list[str] = []

Root Cause:
The syntax list[str] for type hinting was introduced in Python 3.9. Python 3.8 and earlier versions do not natively support this syntax, leading to the TypeError at module load time. Although google-auth's setup.py and classifiers indicate compatibility with Python 3.8 (and 3.7), this specific line of code uses a newer type hinting syntax, causing a compatibility break.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions