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

Cleanup of Python variables wrong in nogil functions #3590

Closed
da-woods opened this issue May 8, 2020 · 1 comment
Closed

Cleanup of Python variables wrong in nogil functions #3590

da-woods opened this issue May 8, 2020 · 1 comment

Comments

@da-woods
Copy link
Contributor

da-woods commented May 8, 2020

cdef void f() nogil:
    with gil:
        x = []

On current master this generates the C code:

goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  #ifdef WITH_THREAD
  __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_WriteUnraisable("xxx.f", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);

Note that both __Pyx_XDECREFs happen outside the __Pyx_PyGILState_Ensure block.

On 0.29.x the code generated looks fine.

@scoder scoder added this to the 3.0 milestone May 9, 2020
@scoder scoder closed this as completed in 2d8f7f3 May 9, 2020
@scoder
Copy link
Contributor

scoder commented May 9, 2020

Thanks for noticing and for the short reproducer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants