Bug 1899555 - pyscss: SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
Summary: pyscss: SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: python-scss
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Matthias Runge
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1914347 (view as bug list)
Depends On:
Blocks: PYTHON3.10
TreeView+ depends on / blocked
 
Reported: 2020-11-19 14:30 UTC by Tomáš Hrnčiar
Modified: 2021-02-09 16:23 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2020-11-19 14:30:23 UTC
python-webassets fails to build with Python 3.10.0a2.

=================================== FAILURES ===================================
_______________________________ TestPyScss.test ________________________________

self = <scss.compiler.Compilation object at 0x7fe87cad0130>
rule = <SassRule <RuleAncestry ()>, 0 props>, scope = None

    def manage_children(self, rule, scope):
        try:
>           self._manage_children_impl(rule, scope)

/usr/lib64/python3.10/site-packages/scss/compiler.py:349: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <scss.compiler.Compilation object at 0x7fe87cad0130>
rule = <SassRule <RuleAncestry ()>, 0 props>, scope = None

    def _manage_children_impl(self, rule, scope):
        calculator = self._make_calculator(rule.namespace)
    
>       for c_lineno, c_property, c_codestr in locate_blocks(rule.unparsed_contents):
E       SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

/usr/lib64/python3.10/site-packages/scss/compiler.py:359: SystemError

During handling of the above exception, another exception occurred:

self = <tests.test_filters.TestPyScss object at 0x7fe87d494190>

    def test(self):
>       self.mkbundle('foo.scss', filters='pyscss', output='out.css').build()

tests/test_filters.py:1025: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/webassets/bundle.py:680: in build
    hunks.append(bundle._build(
src/webassets/bundle.py:617: in _build
    hunk = self._merge_and_apply(
src/webassets/bundle.py:542: in _merge_and_apply
    hunk = filtertool.apply(hunk, filters_to_run, 'input',
src/webassets/merge.py:276: in apply
    return self._wrap_cache(key, func)
src/webassets/merge.py:218: in _wrap_cache
    content = func().getvalue()
src/webassets/merge.py:251: in func
    getattr(filter, type)(data, out, **kwargs_final)
src/webassets/filter/pyscss.py:156: in input
    out.write(scss.compile())
/usr/lib64/python3.10/site-packages/scss/legacy.py:189: in compile
    compiled = compiler.call_and_catch_errors(compilation.run)
/usr/lib64/python3.10/site-packages/scss/compiler.py:176: in call_and_catch_errors
    return f(*args, **kwargs)
/usr/lib64/python3.10/site-packages/scss/compiler.py:296: in run
    self.manage_children(rule, scope=None)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <scss.compiler.Compilation object at 0x7fe87cad0130>
rule = <SassRule <RuleAncestry ()>, 0 props>, scope = None

    def manage_children(self, rule, scope):
        try:
            self._manage_children_impl(rule, scope)
        except SassBaseError as e:
            e.add_rule(rule)
            raise
        except Exception as e:
>           raise SassError(e, rule=rule)
E           scss.errors.SassError: Error parsing block:
E               @import "bar"; a {color: red + green; }
E           
E           
E           on line 1 of /tmp/tmpi2e9vpz7/foo.scss
E           Traceback:
E             File "/usr/lib64/python3.10/site-packages/scss/compiler.py", line 349, in manage_children
E               self._manage_children_impl(rule, scope)
E             File "/usr/lib64/python3.10/site-packages/scss/compiler.py", line 359, in _manage_children_impl
E               for c_lineno, c_property, c_codestr in locate_blocks(rule.unparsed_contents):
E           SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

/usr/lib64/python3.10/site-packages/scss/compiler.py:354: SassError
____________________________ TestPyScss.test_assets ____________________________

self = <scss.compiler.Compilation object at 0x7fe87c7e7ac0>
rule = <SassRule <RuleAncestry ()>, 0 props>, scope = None

    def manage_children(self, rule, scope):
        try:
>           self._manage_children_impl(rule, scope)

/usr/lib64/python3.10/site-packages/scss/compiler.py:349: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <scss.compiler.Compilation object at 0x7fe87c7e7ac0>
rule = <SassRule <RuleAncestry ()>, 0 props>, scope = None

    def _manage_children_impl(self, rule, scope):
        calculator = self._make_calculator(rule.namespace)
    
>       for c_lineno, c_property, c_codestr in locate_blocks(rule.unparsed_contents):
E       SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

/usr/lib64/python3.10/site-packages/scss/compiler.py:359: SystemError

During handling of the above exception, another exception occurred:

self = <tests.test_filters.TestPyScss object at 0x7fe87c7cb0d0>

    def test_assets(self):
        try:
            import PIL
            # Travis does not support PNG files, see
            # https://github.com/travis-ci/travis-ci/issues/746
            from PIL import Image
            Image.new('RGB', (10,10)).save(BytesIO(), 'png')
        except (ImportError, IOError):
            raise SkipTest()
        self.create_files({'noise.scss': 'h1 {background: background-noise()}'})
>       self.mkbundle('noise.scss', filters='pyscss', output='out.css').build()

tests/test_filters.py:1038: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/webassets/bundle.py:680: in build
    hunks.append(bundle._build(
src/webassets/bundle.py:617: in _build
    hunk = self._merge_and_apply(
src/webassets/bundle.py:542: in _merge_and_apply
    hunk = filtertool.apply(hunk, filters_to_run, 'input',
src/webassets/merge.py:276: in apply
    return self._wrap_cache(key, func)
src/webassets/merge.py:218: in _wrap_cache
    content = func().getvalue()
src/webassets/merge.py:251: in func
    getattr(filter, type)(data, out, **kwargs_final)
src/webassets/filter/pyscss.py:156: in input
    out.write(scss.compile())
/usr/lib64/python3.10/site-packages/scss/legacy.py:189: in compile
    compiled = compiler.call_and_catch_errors(compilation.run)
/usr/lib64/python3.10/site-packages/scss/compiler.py:176: in call_and_catch_errors
    return f(*args, **kwargs)
/usr/lib64/python3.10/site-packages/scss/compiler.py:296: in run
    self.manage_children(rule, scope=None)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <scss.compiler.Compilation object at 0x7fe87c7e7ac0>
rule = <SassRule <RuleAncestry ()>, 0 props>, scope = None

    def manage_children(self, rule, scope):
        try:
            self._manage_children_impl(rule, scope)
        except SassBaseError as e:
            e.add_rule(rule)
            raise
        except Exception as e:
>           raise SassError(e, rule=rule)
E           scss.errors.SassError: Error parsing block:
E               h1 {background: background-noise()}
E           
E           
E           on line 1 of /tmp/tmp5e2h2fve/noise.scss
E           Traceback:
E             File "/usr/lib64/python3.10/site-packages/scss/compiler.py", line 349, in manage_children
E               self._manage_children_impl(rule, scope)
E             File "/usr/lib64/python3.10/site-packages/scss/compiler.py", line 359, in _manage_children_impl
E               for c_lineno, c_property, c_codestr in locate_blocks(rule.unparsed_contents):
E           SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

https://docs.python.org/3.10/whatsnew/changelog.html#id16

bpo-41103: PyObject_AsCharBuffer(), PyObject_AsReadBuffer(), PyObject_CheckReadBuffer(), and PyObject_AsWriteBuffer() are removed. Please migrate to new buffer protocol; PyObject_GetBuffer() and PyBuffer_Release().

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01773474-python-webassets/

For all our attempts to build python-webassets with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-webassets/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Dan Callaghan 2020-12-12 08:45:51 UTC
Seems to actually be a problem with python-scss, the crash is in /usr/lib64/python3.10/site-packages/scss/compiler.py.

Comment 2 Dan Callaghan 2021-01-09 01:18:24 UTC
*** Bug 1914347 has been marked as a duplicate of this bug. ***

Comment 3 Ben Cotton 2021-02-09 15:26:12 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.


Note You need to log in before you can comment on or make changes to this bug.