diff options
author | Andy Clayton <q3aiml@gmail.com> | 2020-03-24 23:57:51 -0500 |
---|---|---|
committer | Martin Michlmayr <tbm@cyrius.com> | 2020-03-26 06:52:37 +0800 |
commit | 2c77b8292329f00fd22e9542848c1a32888ca8f5 (patch) | |
tree | 642c838bc4f596b91e49949ce1768a84682c8165 /test/unit | |
parent | 8e67a3f09cb4be58ad69f36a20b5de145a1d79f4 (diff) | |
download | fork-ledger-2c77b8292329f00fd22e9542848c1a32888ca8f5.tar.gz fork-ledger-2c77b8292329f00fd22e9542848c1a32888ca8f5.tar.bz2 fork-ledger-2c77b8292329f00fd22e9542848c1a32888ca8f5.zip |
py3: fix builtin ledger module for python command
With python3 the `python` ledger command wound up loading the ledger
module shared library rather than using the builtin module as intended.
This resulted in duplicated initialization and crashing on cleanup. It
was also visible as duplicate converter warnings when importing ledger:
$ ./ledger --no-pager python
Python 3.7.5 (default, Nov 20 2019, 09:21:52)
[...]
>>> import ledger
/usr/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: to-Python converter for boost::posix_time::ptime already registered; second conversion method ignored.
[...]
/usr/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: to-Python converter for ledger::xact_t already registered; second conversion method ignored.
[...]
>>> ledger
<module 'ledger' from '/home/q/src/ledger/ledger.so'>
>>> exit()
Segmentation fault (core dumped)
After this change:
Python 3.7.5 (default, Nov 20 2019, 09:21:52)
[...]
>>> import ledger
>>> ledger
<module 'ledger' (built-in)>
>>> exit()
$
Switches to PyImport_AppendInittab from python::detail::init_module
because 1) that is what the boost docs and examples show and 2)
init_module appears to be undocumented and not intended for outside use.
Fixes #1867
Diffstat (limited to 'test/unit')
0 files changed, 0 insertions, 0 deletions