Skip to content

int.to_bytes() and int.from_bytes(): raise ValueError when bytes count is zero #71810

@socketpair

Description

@socketpair
BPO 27623
Nosy @mdickinson, @socketpair, @vadmium, @serhiy-storchaka, @Vgr255, @lucasem, @Phaqui
Files
  • int_to_bytes_overflow_1.patch
  • int_to_bytes_overflow_cornercase.patch: Throws OverflowError on (-1).to_bytes(0, 'big', signed=True)
  • int_to_bytes_overflow_cornercase2.patch: (-x).to_bytes(0, 'big', signed=True), x=0 or -1 now throws OverflowError; also updated the tests. They run successfully.
  • 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 2016-07-26.06:26:20.726>
    labels = ['interpreter-core', 'type-bug']
    title = 'int.to_bytes() and int.from_bytes(): raise ValueError when bytes count is zero'
    updated_at = <Date 2016-07-30.01:21:55.777>
    user = 'https://github.com/socketpair'

    bugs.python.org fields:

    activity = <Date 2016-07-30.01:21:55.777>
    actor = 'martin.panter'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Interpreter Core']
    creation = <Date 2016-07-26.06:26:20.726>
    creator = 'socketpair'
    dependencies = []
    files = ['43913', '43925', '43942']
    hgrepos = []
    issue_num = 27623
    keywords = ['patch']
    message_count = 14.0
    messages = ['271329', '271330', '271476', '271479', '271484', '271485', '271487', '271499', '271504', '271506', '271564', '271565', '271657', '271660']
    nosy_count = 7.0
    nosy_names = ['mark.dickinson', 'socketpair', 'martin.panter', 'serhiy.storchaka', 'abarry', 'lucasem', 'Phaqui']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue27623'
    versions = ['Python 3.6']

    Linked PRs

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

      Projects

      No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions