Author: Michael R. Crusoe , Julian Gilbey Description: Default to pure python parsing on big endian systems The current version fails on big-endian systems as described in https://sourceforge.net/p/ruamel-yaml/tickets/360/ and https://sourceforge.net/p/ruamel-yaml-clib/tickets/34/ . The current version of this patch completely disables the C extension on big-endian systems. . Thanks to Rebecca N. Palmer for the tip about sys.byteorder! Forwarded: not-needed Last-Update: 2024-04-18 --- a/__init__.py +++ b/__init__.py @@ -1,4 +1,5 @@ from __future__ import annotations +import sys if False: # MYPY @@ -47,11 +47,13 @@ version_info = _package_data['version_info'] __version__ = _package_data['__version__'] -try: - from .cyaml import * # NOQA - - __with_libyaml__ = True -except (ImportError, ValueError): # for Jython - __with_libyaml__ = False +__with_libyaml__ = False +if sys.byteorder == "little": + try: + from .cyaml import * # NOQA + + __with_libyaml__ = True + except (ImportError, ValueError): # for Jython + pass from ruamel.yaml.main import * # NOQA --- a/_test/test_cyaml.py +++ b/_test/test_cyaml.py @@ -7,6 +7,10 @@ NO_CLIB_VER = (3, 12) +pytestmark = pytest.mark.skipif( + sys.byteorder == "big", + reason="compiled library disabled on big-endian machines" +) @pytest.mark.skipif( # type: ignore platform.python_implementation() in ['Jython', 'PyPy'],