Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python3.12] AssertionError: assert 'builtins.classobj' == 'builtins.str' #2116

Closed
hrnciar opened this issue Apr 13, 2023 · 3 comments
Closed
Labels
Blocked 🚧 A PR or issue blocked by another PR or issue Bug 🪳 python 3.12

Comments

@hrnciar
Copy link

hrnciar commented Apr 13, 2023

In Fedora, we are trying to build all Python packages with the upcoming Python 3.12. We see a lot of test failures connected with test_ctypes_redefined_types_members such as:

______________ test_ctypes_redefined_types_members[c_bool-bool-?] ______________

c_type = 'c_bool', builtin_type = 'bool', type_code = '?'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.bool'
E         - builtins.bool
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
See the full traceback
=================================== FAILURES ===================================
______________ test_ctypes_redefined_types_members[c_bool-bool-?] ______________

c_type = 'c_bool', builtin_type = 'bool', type_code = '?'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.bool'
E         - builtins.bool
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
______________ test_ctypes_redefined_types_members[c_byte-int-b] _______________

c_type = 'c_byte', builtin_type = 'int', type_code = 'b'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
_____________ test_ctypes_redefined_types_members[c_char-bytes-c] ______________

c_type = 'c_char', builtin_type = 'bytes', type_code = 'c'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.bytes'
E         - builtins.bytes
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
____________ test_ctypes_redefined_types_members[c_double-float-d] _____________

c_type = 'c_double', builtin_type = 'float', type_code = 'd'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.float'
E         - builtins.float
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
_____________ test_ctypes_redefined_types_members[c_float-float-f] _____________

c_type = 'c_float', builtin_type = 'float', type_code = 'f'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.float'
E         - builtins.float
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
_______________ test_ctypes_redefined_types_members[c_int-int-i] _______________

c_type = 'c_int', builtin_type = 'int', type_code = 'i'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
______________ test_ctypes_redefined_types_members[c_int16-int-h] ______________

c_type = 'c_int16', builtin_type = 'int', type_code = 'h'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
______________ test_ctypes_redefined_types_members[c_int32-int-i] ______________

c_type = 'c_int32', builtin_type = 'int', type_code = 'i'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
______________ test_ctypes_redefined_types_members[c_int64-int-l] ______________

c_type = 'c_int64', builtin_type = 'int', type_code = 'l'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
______________ test_ctypes_redefined_types_members[c_int8-int-b] _______________

c_type = 'c_int8', builtin_type = 'int', type_code = 'b'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
______________ test_ctypes_redefined_types_members[c_long-int-l] _______________

c_type = 'c_long', builtin_type = 'int', type_code = 'l'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
__________ test_ctypes_redefined_types_members[c_longdouble-float-g] ___________

c_type = 'c_longdouble', builtin_type = 'float', type_code = 'g'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.float'
E         - builtins.float
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
____________ test_ctypes_redefined_types_members[c_longlong-int-l] _____________

c_type = 'c_longlong', builtin_type = 'int', type_code = 'l'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
______________ test_ctypes_redefined_types_members[c_short-int-h] ______________

c_type = 'c_short', builtin_type = 'int', type_code = 'h'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
_____________ test_ctypes_redefined_types_members[c_size_t-int-L] ______________

c_type = 'c_size_t', builtin_type = 'int', type_code = 'L'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
  assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
_____________ test_ctypes_redefined_types_members[c_ssize_t-int-l] _____________

c_type = 'c_ssize_t', builtin_type = 'int', type_code = 'l'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
______________ test_ctypes_redefined_types_members[c_ubyte-int-B] ______________

c_type = 'c_ubyte', builtin_type = 'int', type_code = 'B'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
______________ test_ctypes_redefined_types_members[c_uint-int-I] _______________

c_type = 'c_uint', builtin_type = 'int', type_code = 'I'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
_____________ test_ctypes_redefined_types_members[c_uint16-int-H] ______________

c_type = 'c_uint16', builtin_type = 'int', type_code = 'H'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
_____________ test_ctypes_redefined_types_members[c_uint32-int-I] ______________

c_type = 'c_uint32', builtin_type = 'int', type_code = 'I'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
_____________ test_ctypes_redefined_types_members[c_uint64-int-L] ______________

c_type = 'c_uint64', builtin_type = 'int', type_code = 'L'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
______________ test_ctypes_redefined_types_members[c_uint8-int-B] ______________

c_type = 'c_uint8', builtin_type = 'int', type_code = 'B'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
______________ test_ctypes_redefined_types_members[c_ulong-int-L] ______________

c_type = 'c_ulong', builtin_type = 'int', type_code = 'L'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
____________ test_ctypes_redefined_types_members[c_ulonglong-int-L] ____________

c_type = 'c_ulonglong', builtin_type = 'int', type_code = 'L'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
_____________ test_ctypes_redefined_types_members[c_ushort-int-H] ______________

c_type = 'c_ushort', builtin_type = 'int', type_code = 'H'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.int'
E         - builtins.int
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
______________ test_ctypes_redefined_types_members[c_wchar-str-u] ______________

c_type = 'c_wchar', builtin_type = 'str', type_code = 'u'

@pytest.mark.parametrize(
    "c_type,builtin_type,type_code",
    [
        ("c_bool", "bool", "?"),
        ("c_byte", "int", "b"),
        ("c_char", "bytes", "c"),
        ("c_double", "float", "d"),
        pytest.param(
            "c_buffer",
            "bytes",
            "<class 'ctypes.c_char'>",
            marks=pytest.mark.xfail(
                reason="c_buffer is Uninferable but for now we do not know why"
            ),
        ),
        ("c_float", "float", "f"),
        ("c_int", "int", "i"),
        ("c_int16", "int", "h"),
        ("c_int32", "int", "i"),
        ("c_int64", "int", "l"),
        ("c_int8", "int", "b"),
        ("c_long", "int", "l"),
        ("c_longdouble", "float", "g"),
        ("c_longlong", "int", "l"),
        ("c_short", "int", "h"),
        ("c_size_t", "int", "L"),
        ("c_ssize_t", "int", "l"),
        ("c_ubyte", "int", "B"),
        ("c_uint", "int", "I"),
        ("c_uint16", "int", "H"),
        ("c_uint32", "int", "I"),
        ("c_uint64", "int", "L"),
        ("c_uint8", "int", "B"),
        ("c_ulong", "int", "L"),
        ("c_ulonglong", "int", "L"),
        ("c_ushort", "int", "H"),
        ("c_wchar", "str", "u"),
    ],
)
def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):
    """Test that the "value" and "_type_" member of each redefined types are
    correct.
    """
    src = f"""
    import ctypes
    x=ctypes.{c_type}("toto")
    x.value
    """
    node = extract_node(src)
    assert isinstance(node, nodes.NodeNG)
    node_inf = node.inferred()[0]
>       assert node_inf.pytype() == f"builtins.{builtin_type}"
E       AssertionError: assert 'builtins.classobj' == 'builtins.str'
E         - builtins.str
E         + builtins.classobj

tests/brain/test_ctypes.py:71: AssertionError
=========================== short test summary info ============================
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_bool-bool-?]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_byte-int-b]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_char-bytes-c]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_double-float-d]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_float-float-f]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_int-int-i]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_int16-int-h]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_int32-int-i]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_int64-int-l]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_int8-int-b]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_long-int-l]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_longdouble-float-g]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_longlong-int-l]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_short-int-h]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_size_t-int-L]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_ssize_t-int-l]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_ubyte-int-B]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_uint-int-I]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_uint16-int-H]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_uint32-int-I]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_uint64-int-L]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_uint8-int-B]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_ulong-int-L]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_ulonglong-int-L]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_ushort-int-H]
FAILED tests/brain/test_ctypes.py::test_ctypes_redefined_types_members[c_wchar-str-u]
=========== 26 failed, 1451 passed, 58 skipped, 14 xfailed in 23.46s ===========
@Pierre-Sassoulas
Copy link
Member

Thank you for reporting. We haven't been able to test with python 3.12 yet because one of our dependencies was not installable with python 3.12 last time we tried.

@Pierre-Sassoulas Pierre-Sassoulas added Bug 🪳 python 3.12 Blocked 🚧 A PR or issue blocked by another PR or issue labels Apr 13, 2023
@DanielNoord
Copy link
Collaborator

I checked and this is not just a changes to their pytype but we are also unable to infer _type_ of their instances. I'd say we wait until a beta has been released and see what the underlying issue is once the version is a little more stable.

@jacobtylerwalls
Copy link
Member

I can't reproduce this on Python 3.12.0b2. Compatibility with Python 3.12 is blocked on #2201 for now.

@jacobtylerwalls jacobtylerwalls closed this as not planned Won't fix, can't repro, duplicate, stale Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocked 🚧 A PR or issue blocked by another PR or issue Bug 🪳 python 3.12
Projects
None yet
Development

No branches or pull requests

4 participants