Skip to content

Unpickling of range objects fail in Py3k #46834

Closed

Description

@pythonhacker
BPO 2582
Nosy @avassalotti
Files
  • bugdemo.py: Demonstrates the bug
  • fix_range_pickling.patch
  • fix_range_pickling-2.patch
  • fix_xrange_pickling.patch: for Python 2.x
  • 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 = 'https://github.com/avassalotti'
    closed_at = <Date 2008-06-10.04:05:51.017>
    created_at = <Date 2008-04-08.12:39:01.162>
    labels = ['interpreter-core', 'library']
    title = 'Unpickling of range objects fail in Py3k'
    updated_at = <Date 2008-06-10.04:06:54.902>
    user = 'https://bugs.python.org/pythonhacker'

    bugs.python.org fields:

    activity = <Date 2008-06-10.04:06:54.902>
    actor = 'alexandre.vassalotti'
    assignee = 'alexandre.vassalotti'
    closed = True
    closed_date = <Date 2008-06-10.04:05:51.017>
    closer = 'alexandre.vassalotti'
    components = ['Interpreter Core', 'Library (Lib)']
    creation = <Date 2008-04-08.12:39:01.162>
    creator = 'pythonhacker'
    dependencies = []
    files = ['9981', '10530', '10531', '10532']
    hgrepos = []
    issue_num = 2582
    keywords = ['patch']
    message_count = 6.0
    messages = ['65157', '67736', '67737', '67739', '67891', '67892']
    nosy_count = 2.0
    nosy_names = ['alexandre.vassalotti', 'pythonhacker']
    pr_nums = []
    priority = 'critical'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue2582'
    versions = ['Python 2.6', 'Python 2.5', 'Python 3.0']

    Activity

    1. pythonhacker commented on Apr 8, 2008

      pythonhackermannequin
      MannequinAuthor

      Unpickling of range objects is throwing an exception in Python 3.0

    2. added
      interpreter-core(Objects, Python, Grammar, and Parser dirs)
      stdlibStandard Library Python modules in the Lib/ directory
      on Apr 8, 2008
    3. avassalotti commented on Jun 5, 2008

      @avassalotti
      Member

      Weird. I wonder why it succeeds to pickle to range object at all. It
      seems the __reduce_ex__ method emits bogus value.

        >>> r.__reduce_ex__(2)
        (<function __newobj__ at 0xb7bfdc94>, (<class 'range'>,), None, None,
      None)

      Anyway, that is easy to fix when you know the trick. So, here is the fix.

    4. self-assigned this
      on Jun 5, 2008
    5. avassalotti commented on Jun 5, 2008

      @avassalotti
      Member

      Oh, here is a slightly more efficient version.

    6. avassalotti commented on Jun 5, 2008

      @avassalotti
      Member

      xrange() in Python 2.x is also affected by this bug. So, here is the fix.

    7. avassalotti commented on Jun 10, 2008

      @avassalotti
      Member

      Fixed in r64059 for Python 3.0
      Fixed in r64056 and r64057 for Python 2.6

    8. avassalotti commented on Jun 10, 2008

      @avassalotti
      Member

      Fixed in r64056 and r64057 for Python 2.6

      Oops, I meant r64057 and r64058.

    9. 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

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)stdlibStandard Library Python modules in the Lib/ directory

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions