mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-10-24 23:27:39 -05:00
gnc_price_set_source_string maps a source string to the PriceSource enum and silently leaves the source unchanged for anything it doesn't recognize -- a silent no-op a naive Python or Guile script can hit. Steer callers to set_source() with a PriceSource member (added in #2317) instead. Python bindings: - Deprecate GncPrice.set_source_string(): it now emits a DeprecationWarning pointing at set_source(PriceSource.<...>). It still works during the deprecation period and still guards -- if the string is not recognized (the round-tripped source no longer equals the input) it raises ValueError rather than silently doing nothing. - Fix the deprecated() decorator in deprecation.py: it referenced the undefined DeprecationWarnig and inspect.current_frame(), so it raised instead of warning (the one existing @deprecated use was latently broken). Guile bindings: - mark gnc-price-set-source-string deprecated in engine.i. (Python and Guile use separate SWIG interface files, so Python is handled separately). The only in-tree Guile caller is the QIF importer, updated to gnc-price-set-source with PRICE-SOURCE-USER-PRICE; the redundant set-source-string in test-engine-extras.scm's fixture helper is dropped. Tests (test_price_and_wrapping.py): - TestSetSourceStringGuard covers the guard (still raises on an unrecognized string) and the new DeprecationWarning. Removing set_source_string from the Python bindings is a follow-up.