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

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

Closed
vstinner opened this issue Mar 17, 2009 · 6 comments
Closed

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

vstinner opened this issue Mar 17, 2009 · 6 comments

Comments

@vstinner
Copy link
Member

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']

    @vstinner
    Copy link
    Member Author

    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.

    @vstinner
    Copy link
    Member Author

    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.

    @ocean-city ocean-city mannequin added the release-blocker label Mar 31, 2009
    @ocean-city
    Copy link
    Mannequin

    ocean-city mannequin commented Mar 31, 2009

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

    @gpshead
    Copy link
    Member

    gpshead commented Apr 1, 2009

    good catch. the patch looks correct to me.

    @benjaminp
    Copy link
    Contributor

    Fixed in r71013.

    @vstinner
    Copy link
    Member Author

    vstinner commented Apr 2, 2009

    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.

    @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
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants