GNCPrice example + source-string handling — three related PRs ready for review [fix Bug 799796]

array_hourly_0u at icloud.com array_hourly_0u at icloud.com
Wed Sep 23 10:13:14 EDT 2026


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20260923/4a3d2197/attachment.htm>


More information about the gnucash-devel mailing list