Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
pyversion: ["3", "3.8"]
pyversion: ["3.13", "3.12", "3.11", "3.10", "3.9", "3.8"]

steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 2 additions & 4 deletions src/C/consts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,12 @@ end
vectorcall::Ptr{Cvoid} = C_NULL

# Python 3.12+ fields
tp_watched::Cchar = 0
watched::Cuchar = 0

# Python 3.13+ fields
tp_versions_used::Cushort = 0
versions_used::UInt16 = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

julia> Cushort === UInt16
true

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily on all systems.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, sorry.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, which systems would this actually not be true for?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Julia the "C*" aliases are best guesses based on observed experience of common compilers (mainly gcc and clang), and in this specific case Cushort is indeed always UInt16: https://github.com/JuliaLang/julia/blob/11eeed32e8fe3cd24c8439fbe2220d3f4183f306/base/ctypes.jl#L27. But the reality is that the C standard doesn't specify fixed size for types, and leaves the implementation up to compilers which can do what the heck they want. "short" is only expected to be at least 16 bits, but a compiler making "short" 17 bits could be fully standard-compliant.

end

const PyTypePtr = Ptr{PyTypeObject}

@kwdef struct PySimpleObject{T}
ob_base::PyObject = PyObject()
value::T
Expand Down
Loading