Skip to content

Cannot cast '\0' to c_void_p #76222

Closed
Closed

Description

@Kentzo
mannequin
BPO 32041
Nosy @Kentzo

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2017-11-15.21:01:06.691>
labels = ['ctypes', 'type-bug']
title = "Cannot cast '\\0' to c_void_p"
updated_at = <Date 2017-11-16.01:38:43.651>
user = 'https://github.com/Kentzo'

bugs.python.org fields:

activity = <Date 2017-11-16.01:38:43.651>
actor = 'Ilya.Kulakov'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['ctypes']
creation = <Date 2017-11-15.21:01:06.691>
creator = 'Ilya.Kulakov'
dependencies = []
files = []
hgrepos = []
issue_num = 32041
keywords = []
message_count = 3.0
messages = ['306307', '306323', '306325']
nosy_count = 1.0
nosy_names = ['Ilya.Kulakov']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue32041'
versions = ['Python 3.6']

Activity

  1. Kentzo commented on Nov 15, 2017

    Kentzomannequin
    MannequinAuthor

    Happens on 3.6.3 only:

    >>> import ctypes
    >>> ctypes.cast('\0', ctypes.c_void_p)
    ctypes.ArgumentError: argument 1: <class 'ValueError'>: embedded null character
  2. added
    type-bug
    on Nov 15, 2017
  3. Kentzo commented on Nov 16, 2017

    Kentzomannequin
    MannequinAuthor

    That's the change that introduced the bug: #2285

  4. Kentzo commented on Nov 16, 2017

    Kentzomannequin
    MannequinAuthor

    I have fixed that problem by ensuring that ctypes-facing code passes bytes, not strings.

  5. transferred this issue fromon Apr 10, 2022
  6. ZeroIntensity commented on Jul 18, 2026

    @ZeroIntensity
    Member

    I can no longer reproduce this in 3.14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-ctypestype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions