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

Added fix for #16245 #16279

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions astropy/wcs/src/wcslib_wrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
* Helper functions *
***************************************************************************/

static int WCSSET = 137;

enum e_altlin {
has_pc = 1,
has_cd = 2,
Expand Down Expand Up @@ -1620,6 +1622,15 @@ PyWcsprm_cset(
PyWcsprm* self,
const int convert) {

/* A (previous) call to wcsset() will set the flag to WCSSET -
and if any of the fields got set from python, then the wcs->flag
gets changed to 0 by note_change(). Therefore, if x.flag == WCSSET,
there is no need to call wcsset() and we can return immediately. Was
needed to solve #16245 - memory race condition with multiple threads */
if(self->x.flag == WCSSET) {
return 0;
}

int status = 0;

if (convert) wcsprm_python2c(&self->x);
Expand Down