Skip to content
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

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 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 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 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 join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
0 participants
You can’t perform that action at this time.