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

Skip to content

FIX: guard second usage of PyWeakref_GetObject#934

Merged
swt2c merged 4 commits intopycurl:masterfrom
tacaswell:fix/cp315_compat
Feb 7, 2026
Merged

FIX: guard second usage of PyWeakref_GetObject#934
swt2c merged 4 commits intopycurl:masterfrom
tacaswell:fix/cp315_compat

Conversation

@tacaswell
Copy link
Copy Markdown
Contributor

This function was deprecated in 3.13 and will be removed in 3.15. There are two usages in pycurl, one in easy.c was already correctly guarded, the other in share.c was not.

I am not sure what should be done in the case where PyWeakref_GetRef reports an error in this function.

This function was deprecated in 3.13 and will be removed in 3.15.  There
are two usages in pycurl, one in easy.c was already correctly guarded, the
other in share.c was not.
@tacaswell
Copy link
Copy Markdown
Contributor Author

The failure looks like it might be related, but if it was caused by this I would have expected it on all of the py313 and py314 runs not just one macos py314.

@swt2c
Copy link
Copy Markdown
Contributor

swt2c commented Jan 29, 2026

It does look related. @aeroyorch can you please take a look?

Comment thread src/share.c
Comment thread src/share.c Outdated
Comment thread src/share.c
@tacaswell
Copy link
Copy Markdown
Contributor Author

I think it is closer to right now (correctly handles the dead ref case), but I think something is still not right with the error-path in the 3.13 code path.

obj is only `None` in the <3.13 code path if the weakref is dead.  Handle and
return early to simplify later code.
@aeroyorch
Copy link
Copy Markdown
Contributor

aeroyorch commented Jan 30, 2026

Looks good to me. Can it be moved from draft to ready?

@swt2c
Copy link
Copy Markdown
Contributor

swt2c commented Feb 4, 2026

@tacaswell is this ready?

@tacaswell tacaswell marked this pull request as ready for review February 4, 2026 15:25
Comment thread src/share.c Outdated
@tacaswell
Copy link
Copy Markdown
Contributor Author

@aeroyorch Ok, I think this is good to go.

If the weakref call fails, share_cleanup_and_count_live_easies now fails and one place it looks like it is called from was updated to detect the failure and further propagate the error up the call stack.

@swt2c swt2c merged commit bdb17ae into pycurl:master Feb 7, 2026
19 checks passed
@tacaswell tacaswell deleted the fix/cp315_compat branch March 19, 2026 13:48
@tacaswell tacaswell restored the fix/cp315_compat branch March 19, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants