Pango.parse_markup returns "userdata" for error (instead of string) / add __concat
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 491
- Forks
- 81
- PR merge metrics
- No merged PRs in 30d
Description
I've noticed that Pango.parse_markup returns userdata as the second return value, which is the error message and should be a string probably.
% lua
> a,b = require("lgi").Pango.parse_markup("&", -1, 0)
> return type(b)
userdata
While it can be print()ed, it fails when trying to concatenate it:
> print(b)
Error on line 1: Entity did not end with a semicolon; most likely you used an ampersand character without intending to start an entity - escape ampersand as &
> a = ""..b
stdin:1: attempt to concatenate global 'b' (a userdata value)
stack traceback:
stdin:1: in main chunk
[C]: in ?
I've noticed this with awesomeWM, where the call to error with this returns in another error (but it works in the Lua console above). This is related to additional handling of the error, where it's assumed to be a string.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Pango.parse_markup entry point and reproduce the reported Lua console behavior with an invalid ampersand. Trace how the error return is converted before it reaches Lua. Done means the error is a string and concatenating it no longer raises a userdata error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100