Skip to content

Commit 7198fe1

Browse files
committed
Track the bound before invoking the callback
1 parent 243d5ee commit 7198fe1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

hash.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1301,8 +1301,9 @@ hash_ar_foreach_iter(st_data_t key, st_data_t value, st_data_t argp, int error)
13011301
if (error) return ST_STOP;
13021302

13031303
ar_table *tbl = RHASH_AR_TABLE(arg->hash);
1304+
unsigned bound = RHASH_AR_TABLE_BOUND(arg->hash);
13041305
int status = (*arg->func)((VALUE)key, (VALUE)value, arg->arg);
1305-
if (!RHASH_AR_TABLE_P(arg->hash) || RHASH_AR_TABLE(arg->hash) != tbl) {
1306+
if (!RHASH_AR_TABLE_P(arg->hash) || RHASH_AR_TABLE_BOUND(arg->hash) != bound) {
13061307
rb_raise(rb_eRuntimeError, "rehash occurred during iteration");
13071308
}
13081309

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy