You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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]
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.
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.
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:See the full traceback
The text was updated successfully, but these errors were encountered: