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

Unpickling of range objects fail in Py3k #46834

Closed
pythonhacker mannequin opened this issue Apr 8, 2008 · 6 comments
Closed

Unpickling of range objects fail in Py3k #46834

pythonhacker mannequin opened this issue Apr 8, 2008 · 6 comments
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) stdlib Python modules in the Lib dir

Comments

@pythonhacker
Copy link
Mannequin

pythonhacker mannequin commented Apr 8, 2008

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

    @pythonhacker
    Copy link
    Mannequin Author

    pythonhacker mannequin commented Apr 8, 2008

    Unpickling of range objects is throwing an exception in Python 3.0

    @pythonhacker pythonhacker mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) stdlib Python modules in the Lib dir labels Apr 8, 2008
    @avassalotti
    Copy link
    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.

    @avassalotti avassalotti self-assigned this Jun 5, 2008
    @avassalotti
    Copy link
    Member

    Oh, here is a slightly more efficient version.

    @avassalotti
    Copy link
    Member

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

    @avassalotti
    Copy link
    Member

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

    @avassalotti
    Copy link
    Member

    Fixed in r64056 and r64057 for Python 2.6

    Oops, I meant r64057 and r64058.

    @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) stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant