Skip to content

Commit 9dbe2f5

Browse files
authored
Add PyPy to the build matrix and adapt for pypy pybind11 issue (#61)
* skip printing value to stdout on PyPy * add builds for pypy * fixes from review, linter * fix linter
1 parent 1cc2c01 commit 9dbe2f5

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

.github/workflows/dists.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ jobs:
5555
5656
- name: Build wheels
5757
env:
58-
# Skip building on Python 2.7 and PyPy
58+
# Skip building on Python 2.7
5959
# Additionally, skip 32-bit Windows for now as MSVC needs seperate setup with different toolchain to do this
6060
# Refer: https://cibuildwheel.readthedocs.io/en/stable/cpp_standards/#windows-and-python-27
61-
CIBW_SKIP: cp27-* pp* *-win32 cp35-*
61+
CIBW_SKIP: cp27-* *-win32 cp35-*
6262
CIBW_BEFORE_TEST: pip install -r tests/requirements.txt
6363
CIBW_TEST_COMMAND: pytest {project}/tests
6464
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64" # build on M1 chip

src/encoding_decoding.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,15 @@ toml::array py_list_to_toml_array(const py::list &list) {
7474
arr.push_back(time_value);
7575
} else {
7676
std::stringstream ss;
77+
#ifdef PYPY_VERSION
78+
// see
79+
// https://github.com/conda-forge/pytomlpp-feedstock/pull/1#issuecomment-972738986
80+
// and
81+
// https://github.com/pybind/pybind11/issues/3408#issuecomment-972752210
82+
ss << "not a valid type for conversion " << std::endl;
83+
#else
7784
ss << "not a valid type for conversion " << it << std::endl;
85+
#endif
7886
throw py::type_error(ss.str());
7987
}
8088
}

tests/python-tests/test_api.py

+2
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ class A:
117117
pass
118118
with pytest.raises(TypeError):
119119
pytomlpp.dumps({'a': A()})
120+
with pytest.raises(TypeError):
121+
pytomlpp.dumps({'a': [A()]})
120122

121123
@pytest.mark.parametrize("toml_file", valid_toml_files)
122124
def test_decode_encode_binary(toml_file, tmp_path):

0 commit comments

Comments
 (0)