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

Python 3.6 compatibility issue #71

Closed
pitrou opened this issue Nov 25, 2016 · 0 comments
Closed

Python 3.6 compatibility issue #71

pitrou opened this issue Nov 25, 2016 · 0 comments
Labels

Comments

@pitrou
Copy link
Member

pitrou commented Nov 25, 2016

A first quick testing with dask shows the bytecode analysis in cloudpickle isn't 3.6-compatible:

    @staticmethod
    def extract_code_globals(co):
        """
            Find all globals names read or written to by codeblock co
            """
    
        code = getattr(co, 'co_code', None)
        if code is None:
            return set()
        if not PY3:
            code = [ord(c) for c in code]
        names = co.co_names
        out_names = set()
    
        n = len(code)
        i = 0
        extended_arg = 0
        while i < n:
            op = code[i]
    
            i += 1
            if op >= HAVE_ARGUMENT:
                oparg = code[i] + code[i+1] * 256 + extended_arg
                extended_arg = 0
                i += 2
                if op == EXTENDED_ARG:
                    extended_arg = oparg*65536
                if op in GLOBAL_OPS:
>                   out_names.add(names[oparg])
E                   IndexError: tuple index out of range
@pitrou pitrou added the bug label Nov 25, 2016
@pitrou pitrou mentioned this issue Nov 25, 2016
@rgbkrk rgbkrk closed this as completed in 4945361 Nov 25, 2016
rgbkrk added a commit that referenced this issue Nov 25, 2016
Fix #71: make cloudpickle Python 3.6 compatible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant