Condition variables must be deleted and only then the mutexes which
the condition variables use. The segfault was caused by the deletion
of mutexes which still active condition variables
referenced. Reversing the cleanup order made things segfault free.
...which does not use Py_RETURN_TRUE or Py_RETURN_FALSE. This means
the function does not return a boolean value. A doxygen todo comment
was added to revisist this at a later time.
Modernized some code to comply with newer (python 2.4+) C-API
interfaces. Some wesnoth functions now return bool values, as
documented, rather than ints. A new version of bruteforce has been
added which shows unsafe AI. This AI runs 2x-14x faster than the stock
bruteforce because of memoize pattern and psyco. The AI is only
available if unsafe AI execution is enabled (disable option).
If the key is not found, the default value is returned. set_variable
exception handling has been fixed to return an exception in the
current call frame.
Many wesnoth module functions now release the python GIL when it is
both safe to do so and the function call takes long enough where it
also makes sense. A new global boolean variable, 'restricted' is now
set before the user AI script is invoked. This variable indicates if
it is running inside of a restricted python environment or not. A new
class of unrestricted scripts are now listed. Previously only scripts
which have '#!WPY' at the top are allowed. If only allow safe python
scripts is disabled, scripts which start with #!UNSAFE_WPY are also
shown to users. This allows AI authors to specifically target either a
restricted or unrestricted environment. New "system" class attributes
are exposed in the restricted environment. These include; '__call__',
'__copy__', '__deepcopy__', '__doc__', '__name__', '__repr__' and
'__str__', in addition to the old __init__ method.
- Consider no, false, off, 0, 0.0 as false, empty as default, others as true
- This allow to optimize this very frequently called function, and so
we may use the same one in sensible areas too.
could not be marshalled, an exception was throw but not indicated
by the return value. This confused the exception stack causing
the stack to unwind - ignoring the existing stack frame. This
essentially prevented the exception from being caught unless
wrapped in double try/except blocks.