Skip to content

Commit

Permalink
don't bork on typing_extensions.Literal (#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhils authored Mar 31, 2023
1 parent 1c422df commit bf3fe14
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
([#521](https://github.com/mitmproxy/pdoc/pull/521), @mikkelakromann)
- Fix a crash in pdoc 13.0.0 when `__init__.py` is passed as a file to pdoc.
([#522](https://github.com/mitmproxy/pdoc/pull/522), @mhils)
- Add rudimentary support for `typing_extensions.Literal` on Python 3.7.
([#527](https://github.com/mitmproxy/pdoc/pull/527), @mhils)

## 2023-02-19: pdoc 13.0.0

Expand Down
7 changes: 5 additions & 2 deletions pdoc/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,11 @@ def __get__(self, instance, owner=None):

# There is no Literal on 3.7, so we just make one up. It should not be used anyways!

class Literal:
pass
try:
from typing_extensions import Literal
except ImportError:
class Literal:
pass

# get_origin is adapted from
# https://github.com/python/cpython/blob/863eb7170b3017399fb2b786a1e3feb6457e54c2/Lib/typing.py#L1474-L1515
Expand Down

0 comments on commit bf3fe14

Please sign in to comment.