Skip to content

only accept byte for getarg('c') and unicode for getarg('C') #49749

Closed

Description

@vstinner
BPO 5499
Nosy @gpshead, @vstinner, @benjaminp
Files
  • getarg_strict_char.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-02.00:34:27.194>
    created_at = <Date 2009-03-17.12:58:17.303>
    labels = ['release-blocker']
    title = "only accept byte for getarg('c') and unicode for getarg('C')"
    updated_at = <Date 2009-04-02.08:23:07.851>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2009-04-02.08:23:07.851>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-04-02.00:34:27.194>
    closer = 'benjamin.peterson'
    components = []
    creation = <Date 2009-03-17.12:58:17.303>
    creator = 'vstinner'
    dependencies = []
    files = ['13350']
    hgrepos = []
    issue_num = 5499
    keywords = ['patch']
    message_count = 6.0
    messages = ['83676', '83687', '84874', '85112', '85124', '85181']
    nosy_count = 4.0
    nosy_names = ['gregory.p.smith', 'vstinner', 'ocean-city', 'benjamin.peterson']
    pr_nums = []
    priority = 'release blocker'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue5499'
    versions = ['Python 3.1']

    Activity

    1. vstinner commented on Mar 17, 2009

      @vstinner
      MemberAuthor

      To avoid byte/character mixture, getarg('c') must only accept a byte
      string of 1 byte and getarg('C') only an unicode string of 1
      character.

      Impacted methods:

      • datetime.datetime.isoformat(sep), array.array(type, data): don't
        accept byte anymore
      • msvcrt.putch(char), msvcrt.ungetch(char), <mmap
        object>.write_byte(char): don't accept unicode anymore

      I tried runtests.sh: only the 3 bytes.{center,ljust,rjust} tests have
      to be changed, all other tests are ok.

      Related issues: bpo-3446, bpo-5391.

    2. vstinner commented on Mar 17, 2009

      @vstinner
      MemberAuthor

      unicode methods center(), ljust(), rjust() use a callback (convert_uc)
      to get an unicode character (unicode string of 1 character). If 'C' is
      fixed, convert_uc() callback can be removed.

    3. ocean-city commented on Mar 31, 2009

      ocean-citymannequin
      Mannequin

      Note: bpo-5391 and bpo-5410 are depends on this issue.

    4. gpshead commented on Apr 1, 2009

      @gpshead
      Member

      good catch. the patch looks correct to me.

    5. benjaminp commented on Apr 2, 2009

      @benjaminp
      Contributor

      Fixed in r71013.

    6. vstinner commented on Apr 2, 2009

      @vstinner
      MemberAuthor

      Ooops, I read converterr("a unicode character", ...), but it should be
      converterr("an unicode character", ...) ;-)

      Thanks benjamin.peterson, it will help other issues like bpo-5391 and
      bpo-5410.

    7. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions