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