Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

LWPCookieJar.save() gives unexpected results in 3.11.0 #99576

Closed
Labels
type-bugAn unexpected behavior, bug, or error
@sebdelsol

Description

@sebdelsol

Bug report

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)]
  • Windows 10 64 bits 22H2

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp