From 9ca80f7eeae5c8c8fd4cf095dfb5c0ec4a9ebb4d Mon Sep 17 00:00:00 2001 From: ruang Date: Thu, 5 Sep 2024 10:41:36 +0800 Subject: [PATCH 1/7] Added missing windows handle types to wintypes.py --- Lib/ctypes/wintypes.py | 8 ++++++++ .../2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst | 1 + 2 files changed, 9 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst diff --git a/Lib/ctypes/wintypes.py b/Lib/ctypes/wintypes.py index 9c4e721438aad5..197089a5e3883c 100644 --- a/Lib/ctypes/wintypes.py +++ b/Lib/ctypes/wintypes.py @@ -63,10 +63,16 @@ def __repr__(self): HBITMAP = HANDLE HBRUSH = HANDLE HCOLORSPACE = HANDLE +HCONV = HANDLE +HCONVLIST = HANDLE +HCURSOR = HANDLE HDC = HANDLE +HDDEDATA = HANDLE HDESK = HANDLE +HDROP = HANDLE HDWP = HANDLE HENHMETAFILE = HANDLE +HFILE = HANDLE HFONT = HANDLE HGDIOBJ = HANDLE HGLOBAL = HANDLE @@ -82,8 +88,10 @@ def __repr__(self): HMONITOR = HANDLE HPALETTE = HANDLE HPEN = HANDLE +HRESULT = HANDLE HRGN = HANDLE HRSRC = HANDLE +HSZ = HANDLE HSTR = HANDLE HTASK = HANDLE HWINSTA = HANDLE diff --git a/Misc/NEWS.d/next/Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst b/Misc/NEWS.d/next/Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst new file mode 100644 index 00000000000000..dea96346af6b3c --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst @@ -0,0 +1 @@ +Added missing windows handle types to wintypes.py From 0a3f9e29576c7addfcfa4fc8830ba1406f0c27fc Mon Sep 17 00:00:00 2001 From: ruang Date: Thu, 5 Sep 2024 11:07:54 +0800 Subject: [PATCH 2/7] Fixed the data types of HFILE and HRESULT --- Lib/ctypes/wintypes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/ctypes/wintypes.py b/Lib/ctypes/wintypes.py index 197089a5e3883c..15444cf4351311 100644 --- a/Lib/ctypes/wintypes.py +++ b/Lib/ctypes/wintypes.py @@ -72,7 +72,7 @@ def __repr__(self): HDROP = HANDLE HDWP = HANDLE HENHMETAFILE = HANDLE -HFILE = HANDLE +HFILE = INT HFONT = HANDLE HGDIOBJ = HANDLE HGLOBAL = HANDLE @@ -88,7 +88,7 @@ def __repr__(self): HMONITOR = HANDLE HPALETTE = HANDLE HPEN = HANDLE -HRESULT = HANDLE +HRESULT = LONG HRGN = HANDLE HRSRC = HANDLE HSZ = HANDLE From e7f40a6e2ce469ddb67bf68092674a1c35be7284 Mon Sep 17 00:00:00 2001 From: ruang Date: Thu, 5 Sep 2024 20:44:25 +0800 Subject: [PATCH 3/7] Move HSZ after HSTR --- Lib/ctypes/wintypes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/ctypes/wintypes.py b/Lib/ctypes/wintypes.py index 15444cf4351311..4beba0d19513e2 100644 --- a/Lib/ctypes/wintypes.py +++ b/Lib/ctypes/wintypes.py @@ -91,8 +91,8 @@ def __repr__(self): HRESULT = LONG HRGN = HANDLE HRSRC = HANDLE -HSZ = HANDLE HSTR = HANDLE +HSZ = HANDLE HTASK = HANDLE HWINSTA = HANDLE HWND = HANDLE From 6f8a2a19e517aa41a0be83f7b744c05725f51e48 Mon Sep 17 00:00:00 2001 From: ruang Date: Thu, 5 Sep 2024 20:52:01 +0800 Subject: [PATCH 4/7] Modified NEW description --- .../next/Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst b/Misc/NEWS.d/next/Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst index dea96346af6b3c..ba985cd64532df 100644 --- a/Misc/NEWS.d/next/Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst +++ b/Misc/NEWS.d/next/Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst @@ -1 +1 @@ -Added missing windows handle types to wintypes.py +In wintypes.py added missing handle types including `HCONV`, `HCONVLIST`, `HCURSOR`, `HDDEDATA`, `HDROP`, `HFILE`, `HRESULT` and `HSZ`. From b114122da920395b894957095098ce81a1813f3e Mon Sep 17 00:00:00 2001 From: ruang Date: Thu, 5 Sep 2024 21:26:05 +0800 Subject: [PATCH 5/7] Modified NEWS style --- .../Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst b/Misc/NEWS.d/next/Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst index ba985cd64532df..4cf74030de2a4b 100644 --- a/Misc/NEWS.d/next/Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst +++ b/Misc/NEWS.d/next/Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst @@ -1 +1,3 @@ -In wintypes.py added missing handle types including `HCONV`, `HCONVLIST`, `HCURSOR`, `HDDEDATA`, `HDROP`, `HFILE`, `HRESULT` and `HSZ`. +In wintypes.py added missing handle types including +HCONV, HCONVLIST, HCURSOR, HDDEDATA, +HDROP, HFILE, HRESULT, HSZ. \ No newline at end of file From f8e2eac9720ec8921ed4f089fef59582dc653508 Mon Sep 17 00:00:00 2001 From: ruang Date: Thu, 5 Sep 2024 21:28:24 +0800 Subject: [PATCH 6/7] Added a line break at the end --- .../next/Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst b/Misc/NEWS.d/next/Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst index 4cf74030de2a4b..9143a847168619 100644 --- a/Misc/NEWS.d/next/Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst +++ b/Misc/NEWS.d/next/Library/2024-09-05-10-39-48.gh-issue-123610.lhbSJj.rst @@ -1,3 +1,3 @@ In wintypes.py added missing handle types including HCONV, HCONVLIST, HCURSOR, HDDEDATA, -HDROP, HFILE, HRESULT, HSZ. \ No newline at end of file +HDROP, HFILE, HRESULT, HSZ. From dc2a3b12aa4ab3dcc4e74cad3ffb61efa7b17fa2 Mon Sep 17 00:00:00 2001 From: ruang Date: Fri, 6 Sep 2024 11:29:41 +0800 Subject: [PATCH 7/7] After analyzing the email encoding format, added logic to remove unexpected spaces --- Lib/email/message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/email/message.py b/Lib/email/message.py index 08192c50a8ff5c..9851074b891724 100644 --- a/Lib/email/message.py +++ b/Lib/email/message.py @@ -287,7 +287,7 @@ def get_payload(self, i=None, decode=False): raise TypeError('Expected list, got %s' % type(self._payload)) payload = self._payload # cte might be a Header, so for now stringify it. - cte = str(self.get('content-transfer-encoding', '')).lower() + cte = str(self.get('content-transfer-encoding', '')).lower().strip(' ') # payload may be bytes here. if not decode: if isinstance(payload, str) and utils._has_surrogates(payload):