Skip to content

gh-127295: ctypes: Switch field accessors to fixed-width integers #127297

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

Merged
merged 20 commits into from
Dec 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove comment for obsolete idea
  • Loading branch information
encukou committed Nov 26, 2024
commit a11c0d9b596b5c9e292b6420b455ffde13f22b51
1 change: 0 additions & 1 deletion Modules/_ctypes/cfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,19 +462,19 @@
parts.append(f'_Py_bswap{nbits}')
print(f'FIXINT_GETSET_SW({", ".join(parts)})')
[python start generated code]*/
FIXINT_GETSET(i8, int8_t, 8, PyLong_FromInt32)

Check warning on line 465 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (arm64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 465 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (arm64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 465 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 465 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]
FIXINT_GETSET(u8, uint8_t, 8, PyLong_FromUInt32)

Check warning on line 466 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (arm64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 466 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (arm64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 466 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 466 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]
FIXINT_GETSET(i16, int16_t, 16, PyLong_FromInt32)

Check warning on line 467 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (arm64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 467 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (arm64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 467 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 467 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]
FIXINT_GETSET_SW(i16, int16_t, 16, PyLong_FromInt32, _Py_bswap16)
FIXINT_GETSET(u16, uint16_t, 16, PyLong_FromUInt32)

Check warning on line 469 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (arm64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 469 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (arm64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 469 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 469 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]
FIXINT_GETSET_SW(u16, uint16_t, 16, PyLong_FromUInt32, _Py_bswap16)
FIXINT_GETSET(i32, int32_t, 32, PyLong_FromInt32)

Check warning on line 471 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (arm64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 471 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (arm64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 471 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 471 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]
FIXINT_GETSET_SW(i32, int32_t, 32, PyLong_FromInt32, _Py_bswap32)
FIXINT_GETSET(u32, uint32_t, 32, PyLong_FromUInt32)

Check warning on line 473 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (arm64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 473 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (arm64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 473 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 473 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]
FIXINT_GETSET_SW(u32, uint32_t, 32, PyLong_FromUInt32, _Py_bswap32)
FIXINT_GETSET(i64, int64_t, 64, PyLong_FromInt64)

Check warning on line 475 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (arm64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 475 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (arm64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 475 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 475 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]
FIXINT_GETSET_SW(i64, int64_t, 64, PyLong_FromInt64, _Py_bswap64)
FIXINT_GETSET(u64, uint64_t, 64, PyLong_FromUInt64)

Check warning on line 477 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (arm64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 477 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (arm64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 477 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]

Check warning on line 477 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\a\cpython\cpython\PCbuild\_ctypes.vcxproj]
FIXINT_GETSET_SW(u64, uint64_t, 64, PyLong_FromUInt64, _Py_bswap64)
/*[python end generated code: output=3d60c96fa58e07d5 input=0b7e166f2ea18e70]*/

Expand Down Expand Up @@ -1285,7 +1285,7 @@

/* Macro to call _ctypes_fixint_fielddesc for a given C type */
#define FIXINT_FIELDDESC_FOR(C_TYPE) \
_ctypes_fixint_fielddesc(sizeof(C_TYPE), (C_TYPE)-1 < 0)

Check warning on line 1288 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]

Check warning on line 1288 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]

Check warning on line 1288 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]

Check warning on line 1288 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-aarch64)

comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]

Check warning on line 1288 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-aarch64)

comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]

Check warning on line 1288 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-aarch64)

comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]

Check warning on line 1288 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-aarch64)

comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]

Check warning on line 1288 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]

Check warning on line 1288 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]

Check warning on line 1288 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]

Check warning on line 1288 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]

Check warning on line 1288 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]

Check warning on line 1288 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]

Check warning on line 1288 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]

Check warning on line 1288 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]

Check warning on line 1288 in Modules/_ctypes/cfield.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]


/* Delayed initialization. Windows cannot statically reference dynamically
Expand Down Expand Up @@ -1496,7 +1496,6 @@

/*
Ideas: Implement VARIANT in this table, using 'V' code.
Use '?' as code for BOOL.
*/

/*---------------- EOF ----------------*/
Loading