Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ARM64 macOS variadic arguments not passed properly in ctypes #92892

Closed
Labels
OS-macdocsDocumentation in the Doc dirtopic-ctypestype-bugAn unexpected behavior, bug, or error
@Rapptz

Description

@Rapptz

Bug report

Using ctypes with variadic functions on ARM64 macOS machines seems to improperly pass the arguments, leading to truncation.

Minimal repro:

>>>importctypes>>>fromctypesimportutil>>>libc=ctypes.CDLL(util.find_library("c"))>>>libc.printf(b"hello %d world\n",128_000_000)hello0world14

This happens regardless of casting it to actypes.c_int explicitly or not.

>>>libc.printf(b"hello %ld world\n",ctypes.c_int(1))hello0world14

On my regular machine (in this case an x64 Windows machine) it works as expected:

>>>importctypes>>>libc=ctypes.cdll.msvcrt>>>libc.printf(b"hello %d world\n",128_000_000)hello128000000world22

Your environment

I do not personally have a macOS machine, but I got a few others who did have a machine test for me. Their versions were as follows:

Machine 1:
Python 3.10.1, macOS 12.3.1 (21E258)

Machine 2:

Python 3.9.13 (v3.9.13:6de2ca5339, May 17 2022, 11:37:23) [Clang 13.0.0 (clang-1300.0.29.30)] on darwinmacOS-12.2.1-arm64-arm-64bit

Machine 3:

~ % python3 --versionPython 3.9.10~ % sw_versProductName:     macOSProductVersion:  12.3.1BuildVersion:    21E258
  • CPython versions tested on: 3.9, 3.10
  • Operating system and architecture: ARM64 Apple Silicon macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-macdocsDocumentation in the Doc dirtopic-ctypestype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp