I found an solution which is using typing.Union.
But it makes inconsistency due to difference from the whole application of 
PEP 604.

Regards,
Junho

2023년 1월 26일 목요일 오후 3시 30분 35초 UTC+9에 Junho Lee님이 작성:

> Hello Sphinx community,
>
> I have gotten a TypeError when I build sphinx with autodoc.
>
> "*Union*" type hint replaced operator "*|*" in Python 3.10. And, I add 
> into autodoc_mock_imports  for *dbus* package which has external 
> dependencies.
>
> So, in my case, there is an method`s arguments:
> *foo_arg: dbus.UInt16 | dbus.Array*
> The Sphinx make TypeError when I build sphinx with autodoc:
> *TypeError: unsupported operand type(s) for |: 'UInt16' and 'Array'*
> How can I resolve this problem?
>
> *My environment:*
> Python: 3.10.6
> Sphinx: 5.0.2 (but there is still problem when I upgraded 6.1.3)
>      conf.py:
>          extensions = ["sphinx.ext.autodoc"]
>          autodoc_mock_imports = ["gi", "dbus"]
>
>
> Let me know what you think or if anything is missing.
>
> Regards,
> Junho
>

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/69737619-c6db-4322-87d0-911b6474c517n%40googlegroups.com.

Reply via email to