-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Python] Wrong input for python regex #3610
Comments
Okay, that was not the error, as the |
@Freymaurer What F# code would crash on all matches? I'm not sure I understand how you trigged an error here. The code is obviously wrong, but I don't think it's ever used, ref: 7f494c4#diff-d143e99366f0ba295fb8bbc80bca86f86884323796fb2da0e473e8a8dcf7eeb0 |
Hey! The issue actually was us not checking for python regex dialect. But when we lloked at the source code in python we saw that "input und pattern" are switched between re.search and the match function. Thats why we thought there is a bug in the source code. But the match function was also given input and pattern switched so "two false make a right" everything is working correctly, just the function arguments have the wrong names. |
I hope i was able to explain the issue @dbrattli 😅 Everything works as intended, but the argument names of |
Are you sure? How do you see they are wrong? I tried: let regex = Regex("pattern")
let mat = regex.Match("input") This transpiles to: regex: Any = create("pattern")
mat: Any = match(regex, "input") So the pattern is the first argument and input text is the second which seems right? |
Have a look at the image from my original post, there it says: return re.search(input, reg, flags) With Pattern -> string -> FlagsType But according to the string -> Pattern -> FlagsType |
Yes, my question was how did you trigger that part of the code to run? I'm not sure it's even used since it's been removed in the TypeScript specific part of Fable. There looks to be no unit-test that hits that code. So just want to check with you how/if you manged to call that code-line. If not, I will just remove the code. |
A sorry i must have misunderstood! Here is a REPL of a minimal example. |
Thanks, now I see the problem. Making a fix for this ... |
Using Regex.Match(..,..) in dotnet, it gets transpiled to the following in fable_library/reg_exp.py:
But
re.search
get its arguments in the order of:pattern
,input
... . So pattern and input are switched, which crashes obviously all matches.😅
The text was updated successfully, but these errors were encountered: