@@ -1380,20 +1380,22 @@ def wrapped_callback(
13801380 # signature length for correctness.
13811381 try :
13821382 if not data_ptr or data_len <= 0 :
1383- # Error: invalid input, native code will handle if seeing
1384- # signature size being 0
1383+ # Error: invalid input, invalid so return -1,
1384+ # native code will handle it!
13851385 return - 1
13861386
13871387 # Convert C pointer to Python bytes
13881388 data = bytes (data_ptr [:data_len ])
13891389 if not data :
1390- # Error: empty data, native code will handle it!
1390+ # Error: empty data, invalid so return -1,
1391+ # native code will also handle it!
13911392 return - 1
13921393
13931394 # Call the user's callback
13941395 signature = callback (data )
13951396 if not signature :
1396- # Error: empty signature, native code will handle that too!
1397+ # Error: empty signature, invalid so return -1,
1398+ # native code will handle that too!
13971399 return - 1
13981400
13991401 # Copy the signature back to the C buffer (since callback is
@@ -1408,6 +1410,8 @@ def wrapped_callback(
14081410 print (
14091411 error_messages ['callback_error' ].format (
14101412 str (e )), file = sys .stderr )
1413+ # Error: exception raised, invalid so return -1,
1414+ # native code will handle the error when seeing -1
14111415 return - 1
14121416
14131417 # Encode strings with error handling in case it's invalid UTF8
0 commit comments