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

Fix import of pickle module on PYPY 3.8 (#455) #461

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python_version: [3.6, 3.7, 3.8, 3.9, "3.10-dev", "pypy3"]
python_version: [3.6, 3.7, 3.8, 3.9, "3.10-dev", "pypy-3.8"]
exclude:
# Do not test all minor versions on all platforms, especially if they
# are not the oldest/newest supported versions
Expand All @@ -41,7 +41,7 @@ jobs:
python_version: 3.8
# as of 4/02/2020, psutil won't build under PyPy + Windows
- os: windows-latest
python_version: "pypy3"
python_version: "pypy-3.8"
- os: macos-latest
python_version: 3.6
- os: macos-latest
Expand All @@ -51,7 +51,7 @@ jobs:
- os: macos-latest
# numpy triggers: RuntimeError: Polyfit sanity test emitted a
# warning
python_version: "pypy3"
python_version: "pypy-3.8"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be possible to explicitly set one of those 2 pypy config to use pypy-3.7?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually I was confused by the way the matrix is defined negatively. We need to add "pypy-3.7" to the list of Python version and then exclude the all the macos / windows + pypy combos that still fail.


runs-on: ${{ matrix.os }}

Expand Down
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
and `abc.abstractstaticmethod`.
([PR #450](https://github.com/cloudpipe/cloudpickle/pull/450))

- Fix import of pickle module on PYPY 3.8.
([issue #455](https://github.com/cloudpipe/cloudpickle/issues/455))

2.0.0
=====

Expand Down
5 changes: 1 addition & 4 deletions cloudpickle/cloudpickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import builtins
import dis
import opcode
import platform
import sys
import types
import weakref
Expand All @@ -53,7 +52,7 @@
import typing
import warnings

from .compat import pickle
from .compat import pickle, PYPY
from collections import OrderedDict
from typing import ClassVar, Generic, Union, Tuple, Callable
from pickle import _getattribute
Expand Down Expand Up @@ -92,8 +91,6 @@ def g():
_DYNAMIC_CLASS_TRACKER_BY_ID = weakref.WeakValueDictionary()
_DYNAMIC_CLASS_TRACKER_LOCK = threading.Lock()

PYPY = platform.python_implementation() == "PyPy"

builtin_code_type = None
if PYPY:
# builtin-code objects only exist in pypy
Expand Down
4 changes: 2 additions & 2 deletions cloudpickle/cloudpickle_fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
from enum import Enum
from collections import ChainMap, OrderedDict

from .compat import pickle, Pickler
from .compat import pickle, Pickler, PYPY
from .cloudpickle import (
_extract_code_globals, _BUILTIN_TYPE_NAMES, DEFAULT_PROTOCOL,
_find_imported_submodules, _get_cell_contents, _should_pickle_by_reference,
_builtin_type, _get_or_create_tracker_id, _make_skeleton_class,
_make_skeleton_enum, _extract_class_dict, dynamic_subimport, subimport,
_typevar_reduce, _get_bases, _make_cell, _make_empty_cell, CellType,
_is_parametrized_type_hint, PYPY, cell_set,
_is_parametrized_type_hint, cell_set,
parametrized_type_hint_getinitargs, _create_parametrized_type_hint,
builtin_code_type,
_make_dict_keys, _make_dict_values, _make_dict_items,
Expand Down
4 changes: 3 additions & 1 deletion cloudpickle/compat.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import sys
import platform

PYPY = platform.python_implementation() == "PyPy"

if sys.version_info < (3, 8):
if sys.version_info < (3, 8) or PYPY:
try:
import pickle5 as pickle # noqa: F401
from pickle5 import Pickler # noqa: F401
Expand Down