Skip to content

4.1.2 test suite regressions with Python 3.10.0b4: TypeError: isinstance() arg 2 must be a type, a tuple of types or a union #9505

Description

@mgorny

Describe the bug

Sphinx 4.1.2's test suite has 367 test failures and 13 errors with Python 3.10.0b4. They all seem to have a common cause in:

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

obj = <class 'autodoc_target.Class'>

    def isNewType(obj: Any) -> bool:
        """Check the if object is a kind of NewType."""
        if sys.version_info >= (3, 10):
>           return isinstance(obj, typing.NewType)
E           TypeError: isinstance() arg 2 must be a type, a tuple of types or a union

obj        = <class 'autodoc_target.Class'>

sphinx/util/inspect.py:215: TypeError

How to Reproduce

$ git clone https://github.com/sphinx-doc/sphinx
$ cd sphinx
$ tox -e py310

Expected behavior

No response

Your project

n/a

Screenshots

No response

OS

Gentoo Linux

Python version

3.10.0b4

Sphinx version

4.1.2 (+ git master)

Sphinx extensions

No response

Extra tools

No response

Additional context

Full superverbose build log (17M): dev-python:sphinx-4.1.2:20210727-064745.log

Activity

  1. mgorny commented on Jul 27, 2021

    @mgorny
    ContributorAuthor

    This is how a similar problem was fixed in hypothesis: https://github.com/HypothesisWorks/hypothesis/pull/3044/files

  2. tk0miya commented on Jul 27, 2021

    @tk0miya
    Member

    Oops... the change of NewType was introduced after b4 release. It will be included in the next release (rc1?). Could you wait for it for a while?

  3. mgorny commented on Jul 27, 2021

    @mgorny
    ContributorAuthor

    That would effectively mean we can't package new Sphinx version until it happens. Can't you just extend sys.version_info check to include beta5?

  4. psss commented on Jul 28, 2021

    @psss

    Hi, seems one of our tests is failing on this on Fedora Rawhide.

    Could you wait for it for a while?

    Sure, but how roughly long is "a while"? :) Is it worth disabling failing tests or will it be fixed soon?

  5. abravalheri commented on Jul 29, 2021

    @abravalheri

    Hello, I also found the same error when running sphinx-build ... / python -m sphinx ... on Python 3.10.0b4 on my project (not related to sphinx test suite).

  6. tk0miya commented on Jul 29, 2021

    @tk0miya
    Member

    3.10.0rc1 will be released next Monday. IMO, it's not too far.
    https://www.python.org/dev/peps/pep-0619/#schedule

  7. abravalheri commented on Jul 29, 2021

    @abravalheri

    Aaah, OK, I see, so sphinx should be compatible with 3.10.0rc1, right?

    That is wonderful news, thank you very much @tk0miya 👏

  8. tk0miya commented on Jul 30, 2021

    @tk0miya
    Member

    Yes, we're using the HEAD of 3.10 for testing. So it will be compat with 3.10.0rc1. (But I can't promise that because it's still fragile)

  9. mgorny commented on Aug 3, 2021

    @mgorny
    ContributorAuthor

    And so it turns out that due to other last minute changes, sphinx 4.1.2 is compatible neither with 3.10.0b4 nor with 3.10.0rc1.

  10. added this to the some future version milestone on Sep 29, 2022
  11. locked as resolved and limited conversation to collaborators on Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions