Wrap GncPriceDB.get_latest_price, get_nearest_price, and
get_nearest_before_price to return GncNumeric instead of raw
_gnc_numeric SWIG proxies.
Add double-wrap safety in ClassFromFunctions.__init__: if a wrapper
object is passed as instance=, unwrap it to the underlying SWIG proxy.
This prevents breakage when callers re-wrap a return value that changed
from a raw SWIG proxy to a wrapper class, e.g.
GncNumeric(instance=pricedb.get_latest_price(...)).
New tests:
TestGetPriceReturnsGncNumeric (4 tests):
get_latest_price, get_nearest_price, get_nearest_before_price
return GncNumeric; arithmetic works on the result.
TestDoubleWrapProtection (4 tests):
GncNumeric, GncCommodity double-wrap; raw SWIG proxy still works.
default_arguments_decorator until now only allows positional
argument defaults. This adds keyword defaults. The keywords
can be mapped to the positional arguments by optional argument
kargs_pos so interactions between keyword and positional arg
defaults can raise a TypeError. Some more information in
the docstring is included. In addition the docstring of
the wrapped function will be modified to contain information
about the defaults.
allow keyword arguments for function_class methods
and functions. process_dict_convert_to_instance() is added to
mimic the behavior of the process_list_convert_to_instance()
Derived methods in gnucash_core.py like raise_backend_errors_after_call
get modified to accept being called with keyword args.
Also adds some docstrings.
This switches swig to use python 3 specific features when generating the
bindings, switches the build over to python 3 and makes the neccesary
python 2 to 3 conversions in the bindings and tests.
It is split into
- /libgnucash (for the non-gui bits)
- /gnucash (for the gui)
- /common (misc source files used by both)
- /bindings (currently only holds python bindings)
This is the first step in restructuring the code. It will need much
more fine tuning later on.