summaryrefslogtreecommitdiff
path: root/src/pyinterp.cc
Commit message (Collapse)AuthorAgeFilesLines
* Fix Python 3.12 deprecation warningAlexis Hildebrandt2024-07-081-3/+18
| | | | | | as "the global configuration variable Py_UnbufferedStdioFlag was deprecated in Python 3.12 and using PyConfig.buffered_stdio is recommended instead." — https://peps.python.org/pep-0741/
* Refactor python related types into ledger::python namespaceAlexis Hildebrandt2023-04-121-15/+16
|
* Remove unused server related codeAlexis Hildebrandt2023-02-201-43/+0
|
* Update copyright yearAlexis Hildebrandt2023-02-021-1/+1
| | | | [skip ci]
* Remove support for Python 2.xAlexis Hildebrandt2023-02-011-21/+0
|
* Fix typos found by codespellAlexis Hildebrandt2022-07-191-3/+3
|
* Fix SIGABRT when python subcommand raises an exceptionAaron L. Zeng2022-07-131-2/+3
| | | | | | | | | | | | | Before, `ledger python -- -c 'raise RuntimeError'` would terminate messily via SIGABRT, printing the following: terminate called after throwing an instance of 'int' [1] 2151711 abort (core dumped) ledger python -c 'raise RuntimeError' This change makes the python subcommand throw a standard C++ exception rather than just a plain int, which is never caught and triggers the SIGABRT. Now, the process prints the uncaught Python exception as usual and then exits with exit code 1.
* Update copyright statement for 2022Alexis Hildebrandt2022-07-021-1/+1
|
* Fix compilation warningMartin Michlmayr2020-05-181-1/+1
|
* py3: ensure python output is not lostAndy Clayton2020-03-261-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unbuffer python's stdio to avoid output getting stuck in buffer when stdout is not a TTY. Normally buffers are flushed by `Py_Finalize` but Boost has a long-standing issue preventing the proper shutdown of the interpreter with `Py_Finalize` when embedded [1]. This applies the same fix as 139beba but to any ledger usage rather than only the test suite. I removed `PYTHONUNBUFFERED=1` from tests as there is no expectation that users should need to have this set for ledger to function. For example without this fix piping ledger into cat usually loses any output (unless the output is large enough to cause the buffer to flush): $ ./ledger -f "test/baseline/feat-value_py3.test" reg <class 'bool'> True [...] $ ./ledger -f "test/baseline/feat-value_py3.test" reg | cat $ Interestingly `--verify` causes `python_interpreter_t` to be destroyed -- it doesn't appear to be otherwise -- which does call `Py_Finalize`. As expected this fixes the issue but can also crash due to the boost issue mentioned above: $ ./ledger -f "test/baseline/feat-value_py3.test" --verify reg <class 'bool'> True [...] Segmentation fault (core dumped) $ ./ledger -f "test/baseline/feat-value_py3.test" --verify reg | cat <class 'bool'> True [...] $ 1. https://www.boost.org/doc/libs/1_62_0/libs/python/doc/html/tutorial/tutorial/embedding.html
* py3: fix builtin ledger module for python commandAndy Clayton2020-03-261-13/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* fix python3 command (argv) wchar_t conversionAndy Clayton2020-03-261-4/+6
| | | | | | | | | | Ensure strings passed to Py_Main have a terminating null character by including the extra character allocated for terminating null in the size passed to mbstowcs. Fix argv index so all arguments are not copied to argv[0]. Fixes potential buffer overflow due to passing argv[0] as destination with argv[i + 1] src and size to mbstowcs.
* Port to python3Dimitri John Ledkov2019-12-051-0/+28
|
* Drop conditionals for Boost earlier than 1.49Tim Landscheidt2019-01-171-15/+1
| | | | | | | Ledger requires Boost 1.49 or later and enforces this in CMakeLists.txt. This means BOOST_VERSION will always be 104900 or higher. Also, since Boost 1.46, BOOST_FILESYSTEM_VERSION is 3.
* [misc] Update year in copyright notice to 2017Alexis Hildebrandt2018-01-271-1/+1
| | | | [ci skip]
* [misc] Update year in copyright notice to 2017Alexis Hildebrandt2017-01-051-1/+1
| | | | [ci skip]
* [misc] Update year in copyright notice to 2016Alexis Hildebrandt2016-01-021-1/+1
| | | | [ci skip]
* Bump copyright notice to 2015Alexis Hildebrandt2014-12-271-1/+1
| | | | | | The following script makes it a no-brainer: % NEXT_YEAR=2015; ag -l 'Copyright.*Wiegley' \ | xargs sed -i '' -e "s/\(Copyright.*\)-20[0-9]\{2\}/\1-${NEXT_YEAR}/"
* Bump copyright information to 2014Alexis Hildebrandt2014-02-021-1/+1
|
* Create default scope from python session only if neededAlexis Hildebrandt2014-02-011-3/+5
| | | | | | Fixes test failures introduced with the commit "Create default scope to read journal" a9078767b8224a223f8942a1cb80d4544024387b
* Create default scope to read journalAlexis Hildebrandt2014-01-271-0/+5
| | | when using ledger python module
* Additional changes required for MSVC to compile ledger.Tim Crews2013-06-161-1/+1
| | | | These changes only matter if ledger is compiled with USE_PYTHON.
* Bump copyright information to 2013John Wiegley2013-02-181-1/+1
|
* Converted the Ledger build system to use CMakeJohn Wiegley2012-05-201-3/+3
|
* Switch to using Boost.FormatJohn Wiegley2012-05-141-5/+5
|
* Added #if's for building optimized with ClangJohn Wiegley2012-03-071-0/+2
|
* Corrected several compile and link problemsJohn Wiegley2012-03-061-0/+1
|
* This now works: ledger --import os eval 'os.path.isdir("/tmp")'John Wiegley2012-03-021-57/+86
|
* Allow --options to be added by the user in PythonJohn Wiegley2012-03-011-1/+10
|
* Fixes to value_t to Python conversionJohn Wiegley2012-03-011-5/+3
|
* Added a new 'python' directiveJohn Wiegley2012-03-011-24/+53
|
* Use filesystem::complete not absolute with Boost < 1.46John Wiegley2012-03-011-0/+4
|
* Started writing Python unit testsJohn Wiegley2012-03-011-0/+2
|
* Refactored the notion of "the current parsing context"John Wiegley2012-03-011-7/+28
|
* Increased file copyrights to 2012John Wiegley2012-02-291-1/+1
|
* Fixed Python initialization problem with --importJohn Wiegley2012-02-291-10/+12
|
* Cleanup whitespaceJohn Wiegley2011-08-181-5/+5
|
* Support Boost 1.46 and Boost.Filesystem v3John Wiegley2011-02-281-1/+7
|
* Completely reworked argument passing in expressionsJohn Wiegley2010-06-131-1/+1
|
* Untabified all source filesJohn Wiegley2010-06-111-54/+54
|
* Updated copyrights to 2003-2010John Wiegley2010-03-051-1/+1
|
* Added another catch handler for Python exceptionsJohn Wiegley2009-11-141-0/+4
|
* Reordered the export_ calls in pyinterp.ccJohn Wiegley2009-11-121-6/+6
|
* Fixes to Python importing; removed "hello" precommandJohn Wiegley2009-11-101-45/+124
|
* Check for Python options before functionsJohn Wiegley2009-11-081-0/+3
|
* Make sure to clean up memory after a Python exceptionJohn Wiegley2009-11-071-2/+12
|
* Python vars of unconvertable type return NULL_VALUEJohn Wiegley2009-11-071-7/+0
|
* Simplified passing of scope objects in PythonJohn Wiegley2009-11-051-40/+63
|
* Segregated symbols into 5 separate namespacesJohn Wiegley2009-11-041-22/+24
| | | | | | | | | | | | | | | | | | | | | The different namespaces are: Function Value expression functions, which receive a "context" Option Command-line options Precommand Commands which are invoked before reading the journal Command Commands which are invoked after reading the journal Directive Directives that occur at column 0 in a data file This greatly eases the ability for Python uses to add intercept hooks to change how the basic Ledger module functions. An example of what should be possible soon: import ledger def my_foo_handler(value): print "--foo received:", value ledger.add_handler(ledger.Option, "foo=", my_foo_handler)
* Removed several unneeded Python interface filesJohn Wiegley2009-11-041-10/+4
|