diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2016-03-23 14:12:17 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2016-03-23 14:12:17 -0300 |
| commit | acff3ad88db13bb6d74170a3db475a4e45ddb51f (patch) | |
| tree | 12ad34c5beebf8c29d0266007dd9a51192eec817 /bugs | |
| parent | e7b2e01d43d9c3ab6d223daa18eebb94a322e082 (diff) | |
| download | lua-acff3ad88db13bb6d74170a3db475a4e45ddb51f.tar.gz lua-acff3ad88db13bb6d74170a3db475a4e45ddb51f.tar.bz2 lua-acff3ad88db13bb6d74170a3db475a4e45ddb51f.zip | |
bug: 'gmatch' iterator fails when called from a coroutine different
from the one that created it
Diffstat (limited to 'bugs')
| -rw-r--r-- | bugs | 27 |
1 files changed, 27 insertions, 0 deletions
| @@ -3575,6 +3575,33 @@ patch = [[ | |||
| 3575 | } | 3575 | } |
| 3576 | 3576 | ||
| 3577 | 3577 | ||
| 3578 | Bug{ | ||
| 3579 | what = [['gmatch' iterator fails when called from a coroutine different | ||
| 3580 | from the one that created it]], | ||
| 3581 | report = [[Nagaev Boris, 2016/03/18]], | ||
| 3582 | since = [[5.3.2]], | ||
| 3583 | fix = nil, | ||
| 3584 | example = [[ | ||
| 3585 | local f = string.gmatch("1 2 3 4 5", "%d+") | ||
| 3586 | print(f()) --> 1 | ||
| 3587 | co = coroutine.wrap(f) | ||
| 3588 | print(co()) --> ??? (should be 2) | ||
| 3589 | ]], | ||
| 3590 | patch = [[ | ||
| 3591 | --- lstrlib.c 2016/02/25 19:42:55 1.240 | ||
| 3592 | +++ lstrlib.c 2016/03/21 17:27:07 | ||
| 3593 | @@ -688,14 +688,13 @@ | ||
| 3594 | static int gmatch_aux (lua_State *L) { | ||
| 3595 | GMatchState *gm = (GMatchState *)lua_touserdata(L, lua_upvalueindex(3)); | ||
| 3596 | const char *src; | ||
| 3597 | + gm->ms.L = L; | ||
| 3598 | for (src = gm->src; src <= gm->ms.src_end; src++) { | ||
| 3599 | const char *e; | ||
| 3600 | reprepstate(&gm->ms); | ||
| 3601 | ]] | ||
| 3602 | } | ||
| 3603 | |||
| 3604 | |||
| 3578 | --[=[ | 3605 | --[=[ |
| 3579 | Bug{ | 3606 | Bug{ |
| 3580 | what = [[ ]], | 3607 | what = [[ ]], |
