Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion libsass
10 changes: 6 additions & 4 deletions pysass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,12 @@ static union Sass_Value* _to_sass_value(PyObject* value) {
}

static union Sass_Value* _call_py_f(
const union Sass_Value* sass_args, void* cookie
const union Sass_Value* sass_args,
Sass_Function_Entry cb,
struct Sass_Options* opts
) {
size_t i;
PyObject* pyfunc = (PyObject*)cookie;
PyObject* pyfunc = (PyObject*)sass_function_get_cookie(cb);
PyObject* py_args = PyTuple_New(sass_list_get_length(sass_args));
PyObject* py_result = NULL;
union Sass_Value* sass_result = NULL;
Expand Down Expand Up @@ -394,13 +396,13 @@ static void _add_custom_functions(
struct Sass_Options* options, PyObject* custom_functions
) {
Py_ssize_t i;
Sass_C_Function_List fn_list = sass_make_function_list(
Sass_Function_List fn_list = sass_make_function_list(
PyList_Size(custom_functions)
);
for (i = 0; i < PyList_GET_SIZE(custom_functions); i += 1) {
PyObject* sass_function = PyList_GET_ITEM(custom_functions, i);
PyObject* signature = PySass_Object_Bytes(sass_function);
Sass_C_Function_Callback fn = sass_make_function(
Sass_Function_Entry fn = sass_make_function(
PySass_Bytes_AS_STRING(signature),
_call_py_f,
sass_function
Expand Down
22 changes: 15 additions & 7 deletions sasstests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,34 +1009,40 @@ def test_raises(self):
r' Backtrace:\n'
r' \tstdin:0, in function `raises`\n'
r' \tstdin:0\n'
r' on line 1 of stdin\n$'
r' on line 1 of stdin\n'
r'>> a { content: raises\(\); }\n'
r' -------------\^\n$'
)):
compile_with_func('a { content: raises(); }')

def test_warning(self):
with assert_raises_compile_error(
'Error: warning in C function returns-warning: '
'Error: warning in C function returns_warning: '
'This is a warning\n'
' Backtrace:\n'
' \tstdin:0, in function `returns-warning`\n'
' \tstdin:0, in function `returns_warning`\n'
' \tstdin:0\n'
' on line 1 of stdin\n'
'>> a { content: returns_warning(); }\n'
' -------------^\n'
):
compile_with_func('a { content: returns_warning(); }')

def test_error(self):
with assert_raises_compile_error(
'Error: error in C function returns-error: This is an error\n'
'Error: error in C function returns_error: This is an error\n'
' Backtrace:\n'
' \tstdin:0, in function `returns-error`\n'
' \tstdin:0, in function `returns_error`\n'
' \tstdin:0\n'
' on line 1 of stdin\n'
'>> a { content: returns_error(); }\n'
' -------------^\n'
):
compile_with_func('a { content: returns_error(); }')

def test_returns_unknown_object(self):
with assert_raises_compile_error(
'Error: error in C function returns-unknown: '
'Error: error in C function returns_unknown: '
'Unexpected type: `tuple`.\n'
' Expected one of:\n'
' - None\n'
Expand All @@ -1050,9 +1056,11 @@ def test_returns_unknown_object(self):
' - SassWarning\n'
' - SassError\n\n'
' Backtrace:\n'
' \tstdin:0, in function `returns-unknown`\n'
' \tstdin:0, in function `returns_unknown`\n'
' \tstdin:0\n'
' on line 1 of stdin\n'
'>> a { content: returns_unknown(); }\n'
' -------------^\n'
):
compile_with_func('a { content: returns_unknown(); }')

Expand Down