Thanks for the merge of #2317 adding a more friendly PriceSource enum
class. The example in #2282 now updated to use it and ready for
continued review / merge.

Regarding what to do about set_source_string:
 - after exploring a couple angles, I agree it is too complicated to
make it "private" or internal-use-only.  The complexity outweighs the
benefits.
 - removing it from the Python and Guile bindings makes sense but
might break some existing external use cases
 -  I updated #2315 to mark the Python version deprecated.  That work
actually exposed a bug to fix in the deprecation decorator -- I fix it
in the same commit.
 - #2315 *removes* the Guile -exposed set_source_string binding
immediately.  I find it unlikely anyone is using it besides the
now-updated QIF importer.  To deprecate now like the Python version
would require adding new wrapping code which feels like going in the
wrong direction.

- #2314 (gnc_price_set_source_string: warn on an unknown source
string) is free standing.  It is unlikely to expose much and I have no
strong feelings about the approach.  We could also just doc string
document the contract in gnc-pricedb.h "Set the price's source from
its string form; the string must name a PriceSource value. An
unrecognized string is ignored and the source is left unchanged."  But
none of those .h functions have doc string entries at the moment.

Cheers,
-Noah

On Thu, Sep 24, 2026 at 10:11 AM Noah Reddell <[email protected]> wrote:
>
> A quick update and a recommendation.
>
>
> I've added #2317, which puts a friendlier PriceSource enum in the Python 
> bindings (alongside SessionOpenMode), so a script can write 
> price.set_source(PriceSource.FINANCE_QUOTE) instead of reaching into 
> gnucash_core_c for the raw constants.
>
>
>
> For 5.17 release, my recommendation is to merge #2317 and rebase #2282 onto 
> it to yield a cleaner example script — I'm standing by to rebase.
>
>
> #2314 and #2315 can wait for more discussion — no need to hurry them for 5.17.
>
>
> On the bindings: I agree set_source_string should come out of the Python 
> bindings (the %ignore John suggested). But that is breaking for existing 
> scripts using it, so I want to callu that out while I think it's the right 
> move. By the same logic, the C gnc_price_set_source_string is the same 
> situation for C callers — I'd argue it should ultimately be private too. A 
> reasonable path: add a deprecation notice now (a PINFO in the C function) and 
> target making it private in v6.
>
>
> Thanks,
>
> Noah
>
>
>
> On Sep 23, 2026, at 16:13, Noah <[email protected]> wrote:
>
> 
> Good morning,
>
> Three small, related PRs are ready for review, all stemming from Bug 799796.
>
>
> #2282 is the main one and closes Bug 799796. The price example scripts still 
> used the pre-5.15 raw _gnc_numeric idiom and broke when #2187 made 
> GncPrice.get_value() return a GncNumeric wrapper — cloned prices silently 
> kept the original value. It fixes the three example scripts, reworks 
> quotes_historic.py to construct prices directly (it now actually runs on 
> 5.x), and adds a GncNumeric.__setattr__ guard + test so the silent 
> num/denom-assignment mistake fails clearly rather than corrupting data.
>
>
> That work turned up a related silent-drop at the price source boundary:
>
> gnc_price_set_source_string() maps a fixed set of canonical strings to the 
> PriceSource enum and silently does nothing for anything else. Two independent 
> follow-ups make that fail better:
>
>
> • #2314 [engine]: PWARN on an unrecognized source string and cleans up one 
> dead CI test-fixture line the warning exposed. There's an open question on 
> the PR about PWARN vs PINFO, since it sits on the book load path — see the 
> comment there.  I think PWARN is best but others may prefer a different 
> handling.
>
> • #2315 [bindings/python]: GncPrice.set_source_string() raises ValueError on 
> an unrecognized source, so a typo from Python is an immediate error rather 
> than a no-op.
>
>
> All three are independent and can land separately. Happy to squash or adjust 
> as needed.
>
>
> Thanks,
>
> Noah
>
>
_______________________________________________
gnucash-devel mailing list
[email protected]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to