Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Pickling of exhausted generator objects fails #130

Closed
ghost opened this issue Sep 2, 2017 · 1 comment
Closed

Pickling of exhausted generator objects fails #130

ghost opened this issue Sep 2, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Sep 2, 2017

Originally reported by: Anselm Kruis (Bitbucket: akruis, GitHub: akruis)


If you pickle an exhausted generator you get a SystemError (2.7-slp) or an access violation (3.x). The cause for this bug is obvious: generator->gi_frame is NULL and pricklepit.c gen_reduce() does not handle this situation.

The fix is simple: change gen_reduce() to return Py_None, if generator->gi_frame is NULL. change gen_setstate() to set gen->gi_frame to NULL, if the frame is Py_None.


@ghost
Copy link
Author

ghost commented Sep 2, 2017

Original comment by Anselm Kruis (Bitbucket: akruis, GitHub: akruis):


Fixed in changeset:

  • 2.7-slp: b86bda31f4e3
  • 3.3-slp: 524e60faeb5c
  • 3.4-slp: e97487c7c482
  • 3.5-slp: 897d37941044

Not yet merged to default-slp

@ghost ghost closed this as completed Sep 24, 2017
akruis pushed a commit that referenced this issue Sep 26, 2017
PyEval_ReInitThread can run arbitrary Python code, which really ought to have
the TLS initialized.
akruis pushed a commit that referenced this issue Nov 1, 2017
Pickling of an exhausted generator no longer causes a segmentation fault.

https://bitbucket.org/stackless-dev/stackless/issues/130
(grafted from b86bda31f4e3372bbde61179cc890af24d83ae71)
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

0 participants