You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LWPCookieJar.save() gives unexpected results in 3.11.0 #99576
LWPCookieJar.save() doesn't truncate the file.
So removing cookies from an existing jar file then saving it gives unexpected results :
fromhttp.cookiejarimportLWPCookieJarfromurllib.requestimportRequest, urlopenlwp=LWPCookieJar("cookies.lwp")
# get some cookies & saverequest=Request("https://www.scoopmeacookie.com/give-me-more/")
withurlopen(request) asresponse:
lwp.extract_cookies(response, request)
# here's some cookiesprint(f"Extracted : {lwp}")
lwp.save()
# clear the jar & savelwp.clear()
# the jar is now emptyprint(f"Clear : {lwp}")
lwp.save()
# are those cookies really gone ?lwp.load()
# they're back ! that would be great IRL# LWPCookieJar.save() didn't truncate the file (os.O_TRUNC is missing)print(f"Reload : {lwp}")
Environment
Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]
changed the title [-]LWPCookieJar.save() doesn't truncate the file in 3.11.0[/-][+]LWPCookieJar.save() gives unexpected results in 3.11.0[/+]on Nov 18, 2022
Activity
[-]LWPCookieJar.save() doesn't truncate the file in 3.11.0[/-][+]LWPCookieJar.save() gives unexpected results in 3.11.0[/+]pythongh-99576: Fix cookiejar file that was not truncated for some cl…
gh-99576: Fix cookiejar file that was not truncated for some classes (G…
pythongh-99576: Fix cookiejar file that was not truncated for some cl…
[3.11] gh-99576: Fix cookiejar file that was not truncated for some c…
ambv commentedon Dec 20, 2022
Fixed for release in 3.11.2 and 3.12.0.
ambv commentedon Dec 20, 2022
Thanks for the fix, @sobolevn! ✨ 🍰 ✨
Merged main into regmachine branch (#50)