Hi,
I just upgraded from weasyprint 0.24 to weasyprint 0.40 and it seems to crash during css parsing
here is a sample of code to reproduce the issue :
from weasyprint import CSS
CSS(string=".foo { image-resolution: from-image; }")
and the stacktrace :
Traceback (most recent call last):
File "", line 1, in
File "/home/jg/.virtualenvs/fluid-topics/lib/python3.5/site-packages/weasyprint/init.py", line 267, in init
self.page_rules, self.fonts, font_config)
File "/home/jg/.virtualenvs/fluid-topics/lib/python3.5/site-packages/weasyprint/css/init.py", line 609, in preprocess_stylesheet
base_url, tinycss2.parse_declaration_list(rule.content)))
File "/home/jg/.virtualenvs/fluid-topics/lib/python3.5/site-packages/weasyprint/css/validation.py", line 2189, in preprocess_declarations
result = list(expander_(base_url, name, tokens))
File "/home/jg/.virtualenvs/fluid-topics/lib/python3.5/site-packages/weasyprint/css/validation.py", line 2136, in validate_non_shorthand
value = function(tokens)
File "/home/jg/.virtualenvs/fluid-topics/lib/python3.5/site-packages/weasyprint/css/validation.py", line 159, in single_token_validator
return function(tokens[0], *args)
File "/home/jg/.virtualenvs/fluid-topics/lib/python3.5/site-packages/weasyprint/css/validation.py", line 1106, in image_resolution
return get_resolution(token)
File "/home/jg/.virtualenvs/fluid-topics/lib/python3.5/site-packages/weasyprint/css/validation.py", line 218, in get_resolution
factor = RESOLUTION_TO_DPPX.get(token.unit)
AttributeError: 'IdentToken' object has no attribute 'unit'
It worked fine previously on 0.24 and produced a warning :
Ignored image-resolution: from-image at 1:8, invalid value.
I suppose it may be a missing feature from tinycss2 migration.
I removed the css value in my content since it is not supported but it might still be worth it to produce a warning instead of a crash
The text was updated successfully, but these errors were encountered:
Hi,
I just upgraded from weasyprint 0.24 to weasyprint 0.40 and it seems to crash during css parsing
here is a sample of code to reproduce the issue :
and the stacktrace :
It worked fine previously on 0.24 and produced a warning :
I suppose it may be a missing feature from tinycss2 migration.
I removed the css value in my content since it is not supported but it might still be worth it to produce a warning instead of a crash
The text was updated successfully, but these errors were encountered: