mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Fix per-instance Regexp timeout (#6621)
Fix per-instance Regexp timeout This makes it follow what was decided in [Bug #19055]: * `Regexp.new(str, timeout: nil)` should respect the global timeout * `Regexp.new(str, timeout: huge_val)` should use the maximum value that can be represented in the internal representation * `Regexp.new(str, timeout: 0 or negative value)` should raise an error
This commit is contained in:
parent
6700fa7f62
commit
b51b22513f
Notes:
git
2025-05-14 12:41:59 +00:00
Merged-By: mame <mame@ruby-lang.org>
3 changed files with 74 additions and 10 deletions
1
hrtime.h
1
hrtime.h
|
@ -206,6 +206,7 @@ double2hrtime(rb_hrtime_t *hrt, double d)
|
|||
const double TIMESPEC_SEC_MAX_PLUS_ONE = 2.0 * (TIMESPEC_SEC_MAX_as_double / 2.0 + 1.0);
|
||||
|
||||
if (TIMESPEC_SEC_MAX_PLUS_ONE <= d) {
|
||||
*hrt = RB_HRTIME_MAX;
|
||||
return NULL;
|
||||
}
|
||||
else if (d <= 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue