Skip to content
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

Py_BuildValue("c") should return bytes? #49916

Closed
ocean-city mannequin opened this issue Apr 2, 2009 · 4 comments
Closed

Py_BuildValue("c") should return bytes? #49916

ocean-city mannequin opened this issue Apr 2, 2009 · 4 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) release-blocker

Comments

@ocean-city
Copy link
Mannequin

ocean-city mannequin commented Apr 2, 2009

BPO 5666
Nosy @vstinner, @benjaminp
Files
  • py3k_build_value.patch
  • py3k_build_value-2.patch
  • 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 = <Date 2009-04-03.22:19:17.033>
    created_at = <Date 2009-04-02.09:04:53.232>
    labels = ['interpreter-core', 'release-blocker']
    title = 'Py_BuildValue("c") should return bytes?'
    updated_at = <Date 2009-04-03.22:19:17.031>
    user = 'https://bugs.python.org/ocean-city'

    bugs.python.org fields:

    activity = <Date 2009-04-03.22:19:17.031>
    actor = 'benjamin.peterson'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-04-03.22:19:17.033>
    closer = 'benjamin.peterson'
    components = ['Interpreter Core']
    creation = <Date 2009-04-02.09:04:53.232>
    creator = 'ocean-city'
    dependencies = []
    files = ['13574', '13579']
    hgrepos = []
    issue_num = 5666
    keywords = ['patch']
    message_count = 4.0
    messages = ['85184', '85195', '85196', '85339']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'ocean-city', 'benjamin.peterson']
    pr_nums = []
    priority = 'release blocker'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue5666'
    versions = ['Python 3.1']

    @ocean-city
    Copy link
    Mannequin Author

    ocean-city mannequin commented Apr 2, 2009

    This is related to bpo-5499. PyArg_ParseTuple treats "c" as bytes of 1
    length now, but Py_BuildValue still treats "c" as unicode of 1 length.

    @ocean-city ocean-city mannequin added release-blocker interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Apr 2, 2009
    @vstinner
    Copy link
    Member

    vstinner commented Apr 2, 2009

    Let's try grep on py3k:
    grep 'Py_BuildValue("[^"]*c' $(find -name "*.c")

    Py_BuildValue("c") is used for:

    • mmap.read_byte() result
    • <curses window>.getkey() result: this method returns also unicode
      string => your patch breaks getkey()!
    • array.__reduce__(): i don't understand if the patch breaks anything

    I think that curses and array should use "C" format, but... it doesn't
    exist for Py_BuildValue. It was maybe forgotten.

    @vstinner
    Copy link
    Member

    vstinner commented Apr 2, 2009

    "C" format, but... it doesn't exist for Py_BuildValue

    Ooops, it does exist but it looks that nobody uses it. It's also not
    documented :-( I wrote a new patch:

    • document "C" format for Py_BuildValue (fix also a typo)
    • use "C" format in array and _curses
    • (and leave ocean-city's changes unchanged)

    @benjaminp
    Copy link
    Contributor

    Applied the patch in r71107. The issues these depend on can be fixed now.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    interpreter-core (Objects, Python, Grammar, and Parser dirs) release-blocker
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants