Skip to content

Commit c7e415d

Browse files
committed
Merge pull request #56 from asottile/more_32_prep
More libsass 3.2 prep (changes in beta3, beta4)
2 parents 0ff0e0e + 76058a4 commit c7e415d

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

pysass.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,10 +362,12 @@ static union Sass_Value* _to_sass_value(PyObject* value) {
362362
}
363363

364364
static union Sass_Value* _call_py_f(
365-
const union Sass_Value* sass_args, void* cookie
365+
const union Sass_Value* sass_args,
366+
Sass_Function_Entry cb,
367+
struct Sass_Options* opts
366368
) {
367369
size_t i;
368-
PyObject* pyfunc = (PyObject*)cookie;
370+
PyObject* pyfunc = (PyObject*)sass_function_get_cookie(cb);
369371
PyObject* py_args = PyTuple_New(sass_list_get_length(sass_args));
370372
PyObject* py_result = NULL;
371373
union Sass_Value* sass_result = NULL;
@@ -394,13 +396,13 @@ static void _add_custom_functions(
394396
struct Sass_Options* options, PyObject* custom_functions
395397
) {
396398
Py_ssize_t i;
397-
Sass_C_Function_List fn_list = sass_make_function_list(
399+
Sass_Function_List fn_list = sass_make_function_list(
398400
PyList_Size(custom_functions)
399401
);
400402
for (i = 0; i < PyList_GET_SIZE(custom_functions); i += 1) {
401403
PyObject* sass_function = PyList_GET_ITEM(custom_functions, i);
402404
PyObject* signature = PySass_Object_Bytes(sass_function);
403-
Sass_C_Function_Callback fn = sass_make_function(
405+
Sass_Function_Entry fn = sass_make_function(
404406
PySass_Bytes_AS_STRING(signature),
405407
_call_py_f,
406408
sass_function

sasstests.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,34 +1009,40 @@ def test_raises(self):
10091009
r' Backtrace:\n'
10101010
r' \tstdin:0, in function `raises`\n'
10111011
r' \tstdin:0\n'
1012-
r' on line 1 of stdin\n$'
1012+
r' on line 1 of stdin\n'
1013+
r'>> a { content: raises\(\); }\n'
1014+
r' -------------\^\n$'
10131015
)):
10141016
compile_with_func('a { content: raises(); }')
10151017

10161018
def test_warning(self):
10171019
with assert_raises_compile_error(
1018-
'Error: warning in C function returns-warning: '
1020+
'Error: warning in C function returns_warning: '
10191021
'This is a warning\n'
10201022
' Backtrace:\n'
1021-
' \tstdin:0, in function `returns-warning`\n'
1023+
' \tstdin:0, in function `returns_warning`\n'
10221024
' \tstdin:0\n'
10231025
' on line 1 of stdin\n'
1026+
'>> a { content: returns_warning(); }\n'
1027+
' -------------^\n'
10241028
):
10251029
compile_with_func('a { content: returns_warning(); }')
10261030

10271031
def test_error(self):
10281032
with assert_raises_compile_error(
1029-
'Error: error in C function returns-error: This is an error\n'
1033+
'Error: error in C function returns_error: This is an error\n'
10301034
' Backtrace:\n'
1031-
' \tstdin:0, in function `returns-error`\n'
1035+
' \tstdin:0, in function `returns_error`\n'
10321036
' \tstdin:0\n'
10331037
' on line 1 of stdin\n'
1038+
'>> a { content: returns_error(); }\n'
1039+
' -------------^\n'
10341040
):
10351041
compile_with_func('a { content: returns_error(); }')
10361042

10371043
def test_returns_unknown_object(self):
10381044
with assert_raises_compile_error(
1039-
'Error: error in C function returns-unknown: '
1045+
'Error: error in C function returns_unknown: '
10401046
'Unexpected type: `tuple`.\n'
10411047
' Expected one of:\n'
10421048
' - None\n'
@@ -1050,9 +1056,11 @@ def test_returns_unknown_object(self):
10501056
' - SassWarning\n'
10511057
' - SassError\n\n'
10521058
' Backtrace:\n'
1053-
' \tstdin:0, in function `returns-unknown`\n'
1059+
' \tstdin:0, in function `returns_unknown`\n'
10541060
' \tstdin:0\n'
10551061
' on line 1 of stdin\n'
1062+
'>> a { content: returns_unknown(); }\n'
1063+
' -------------^\n'
10561064
):
10571065
compile_with_func('a { content: returns_unknown(); }')
10581066

0 commit comments

Comments
 (0)