Skip to content

Commit 3e07edc

Browse files
Merge remote-tracking branch 'upstream/main' into imaplib-search-charset
# Conflicts: # Doc/library/imaplib.rst # Lib/imaplib.py # Lib/test/test_imaplib.py
2 parents 4e46ab2 + c98e984 commit 3e07edc

15 files changed

Lines changed: 509 additions & 318 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@ jobs:
554554
- Thread
555555
free-threading:
556556
- false
557+
- true
557558
sanitizer:
558559
- TSan
559560
include:
@@ -565,17 +566,6 @@ jobs:
565566
sanitizer: ${{ matrix.sanitizer }}
566567
free-threading: ${{ matrix.free-threading }}
567568

568-
# XXX: Temporarily allow this job to fail to not block PRs.
569-
build-san-free-threading:
570-
# ${{ '' } is a hack to nest jobs under the same sidebar category.
571-
name: Sanitizers${{ '' }} # zizmor: ignore[obfuscation]
572-
needs: build-context
573-
if: needs.build-context.outputs.run-ubuntu == 'true'
574-
uses: ./.github/workflows/reusable-san.yml
575-
with:
576-
sanitizer: TSan
577-
free-threading: true
578-
579569
cross-build-linux:
580570
name: Cross build Linux
581571
runs-on: ubuntu-26.04
@@ -679,7 +669,6 @@ jobs:
679669
- test-hypothesis
680670
- build-asan
681671
- build-san
682-
- build-san-free-threading
683672
- cross-build-linux
684673
- cifuzz
685674
if: always()
@@ -691,7 +680,6 @@ jobs:
691680
allowed-failures: >-
692681
build-android,
693682
build-emscripten,
694-
build-san-free-threading,
695683
build-windows-msi,
696684
build-ubuntu-ssltests,
697685
test-hypothesis,

Doc/c-api/float.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,6 @@ most likely :exc:`OverflowError`).
233233
234234
Pack a C double as the IEEE 754 binary64 double precision format.
235235
236-
.. impl-detail::
237-
This function always succeeds in CPython.
238-
239236
240237
Unpack functions
241238
^^^^^^^^^^^^^^^^
@@ -251,9 +248,6 @@ Return value: The unpacked double. On error, this is ``-1.0`` and
251248
:c:func:`PyErr_Occurred` is true (and an exception is set, most likely
252249
:exc:`OverflowError`).
253250
254-
.. impl-detail::
255-
These functions always succeed in CPython.
256-
257251
.. c:function:: double PyFloat_Unpack2(const char *p, int le)
258252
259253
Unpack the IEEE 754 binary16 half-precision format as a C double.

Doc/library/imaplib.rst

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,16 @@ An :class:`IMAP4` instance has the following methods:
273273
mailbox. This is the recommended command before ``LOGOUT``.
274274

275275

276-
.. method:: IMAP4.copy(message_set, new_mailbox)
276+
.. method:: IMAP4.copy(message_set, new_mailbox, *, uid=False)
277277

278278
Copy *message_set* messages onto end of *new_mailbox*.
279279

280+
If *uid* is true, *message_set* is a set of UIDs and the ``UID COPY``
281+
command is used instead of ``COPY``.
282+
283+
.. versionchanged:: next
284+
Added the *uid* parameter.
285+
280286

281287
.. method:: IMAP4.create(mailbox)
282288

@@ -303,19 +309,33 @@ An :class:`IMAP4` instance has the following methods:
303309
The :meth:`enable` method itself, and :RFC:`6855` support.
304310

305311

306-
.. method:: IMAP4.expunge()
312+
.. method:: IMAP4.expunge(message_set=None, *, uid=False)
307313

308314
Permanently remove deleted items from selected mailbox. Generates an ``EXPUNGE``
309315
response for each deleted message. Returned data contains a list of ``EXPUNGE``
310316
message numbers in order received.
311317

318+
If *uid* is true, the ``UID EXPUNGE`` command (:rfc:`4315`) is used to remove
319+
only the messages that both are marked as deleted and have a UID in
320+
*message_set*. *message_set* is required in this case, and must be omitted
321+
otherwise.
312322

313-
.. method:: IMAP4.fetch(message_set, message_parts)
323+
.. versionchanged:: next
324+
Added the *message_set* and *uid* parameters.
325+
326+
327+
.. method:: IMAP4.fetch(message_set, message_parts, *, uid=False)
314328

315329
Fetch (parts of) messages. *message_parts* should be a string of message part
316330
names enclosed within parentheses, eg: ``"(UID BODY[TEXT])"``. Returned data
317331
are tuples of message part envelope and data.
318332

333+
If *uid* is true, *message_set* is a set of UIDs and the message numbers in
334+
the response are UIDs (``UID FETCH``).
335+
336+
.. versionchanged:: next
337+
Added the *uid* parameter.
338+
319339

320340
.. method:: IMAP4.getacl(mailbox)
321341

@@ -495,12 +515,15 @@ An :class:`IMAP4` instance has the following methods:
495515
Returned data are tuples of message part envelope and data.
496516

497517

498-
.. method:: IMAP4.move(message_set, new_mailbox)
518+
.. method:: IMAP4.move(message_set, new_mailbox, *, uid=False)
499519

500520
Move *message_set* messages onto end of *new_mailbox*.
501521

502522
The server must support the ``MOVE`` capability (:rfc:`6851`).
503523

524+
If *uid* is true, *message_set* is a set of UIDs and the ``UID MOVE``
525+
command is used instead of ``MOVE``.
526+
504527
.. versionadded:: next
505528

506529

@@ -575,7 +598,7 @@ An :class:`IMAP4` instance has the following methods:
575598
code, instead of the usual type.
576599

577600

578-
.. method:: IMAP4.search(charset, criterion[, ...])
601+
.. method:: IMAP4.search(charset, criterion[, ...], *, uid=False)
579602

580603
Search mailbox for matching messages. *charset* may be ``None``, in which case
581604
no ``CHARSET`` will be specified in the request to the server. The IMAP
@@ -584,14 +607,14 @@ An :class:`IMAP4` instance has the following methods:
584607
the ``UTF8=ACCEPT`` capability was enabled using the :meth:`enable`
585608
command.
586609

610+
If *uid* is true, the message numbers in the response are UIDs
611+
(``UID SEARCH``).
612+
587613
A criterion passed as :class:`str` is encoded to *charset* (which must name
588614
a codec known to Python); pass :class:`bytes` to send a criterion that is
589615
already encoded, for example when *charset* is one that Python does not
590616
support.
591617

592-
.. versionchanged:: next
593-
``str`` search criteria are encoded to *charset*.
594-
595618
Example::
596619

597620
# M is a connected IMAP4 instance...
@@ -600,6 +623,12 @@ An :class:`IMAP4` instance has the following methods:
600623
# or:
601624
typ, msgnums = M.search(None, '(FROM "LDJ")')
602625

626+
.. versionchanged:: next
627+
Added the *uid* parameter.
628+
629+
.. versionchanged:: next
630+
``str`` search criteria are encoded to *charset*.
631+
603632

604633
.. method:: IMAP4.select(mailbox='INBOX', readonly=False)
605634

@@ -644,7 +673,7 @@ An :class:`IMAP4` instance has the following methods:
644673
Returns socket instance used to connect to server.
645674

646675

647-
.. method:: IMAP4.sort(sort_criteria, charset, search_criterion[, ...])
676+
.. method:: IMAP4.sort(sort_criteria, charset, search_criterion[, ...], *, uid=False)
648677

649678
The ``sort`` command is a variant of ``search`` with sorting semantics for the
650679
results. Returned data contains a space separated list of matching message
@@ -659,11 +688,16 @@ An :class:`IMAP4` instance has the following methods:
659688
the interpretation of strings in the searching criteria. It then returns the
660689
numbers of matching messages.
661690

691+
If *uid* is true, the message numbers in the response are UIDs (``UID SORT``).
692+
662693
As with :meth:`search`, a *search_criterion* passed as :class:`str` is
663694
encoded to *charset*; pass :class:`bytes` to send one already encoded.
664695

665696
This is an ``IMAP4rev1`` extension command.
666697

698+
.. versionchanged:: next
699+
Added the *uid* parameter.
700+
667701
.. versionchanged:: next
668702
``str`` search criteria are encoded to *charset*.
669703

@@ -695,12 +729,15 @@ An :class:`IMAP4` instance has the following methods:
695729
Request named status conditions for *mailbox*.
696730

697731

698-
.. method:: IMAP4.store(message_set, command, flag_list)
732+
.. method:: IMAP4.store(message_set, command, flag_list, *, uid=False)
699733

700734
Alters flag dispositions for messages in mailbox. *command* is specified by
701735
section 6.4.6 of :rfc:`3501` as being one of "FLAGS", "+FLAGS", or "-FLAGS",
702736
optionally with a suffix of ".SILENT".
703737

738+
If *uid* is true, *message_set* is a set of UIDs and the ``UID STORE``
739+
command is used instead of ``STORE``.
740+
704741
For example, to set the delete flag on all messages::
705742

706743
typ, data = M.search(None, 'ALL')
@@ -720,12 +757,15 @@ An :class:`IMAP4` instance has the following methods:
720757
Python 3.6, handles them if they are sent from the server, since this
721758
improves real-world compatibility.
722759

760+
.. versionchanged:: next
761+
Added the *uid* parameter.
762+
723763
.. method:: IMAP4.subscribe(mailbox)
724764

725765
Subscribe to new mailbox.
726766

727767

728-
.. method:: IMAP4.thread(threading_algorithm, charset, search_criterion[, ...])
768+
.. method:: IMAP4.thread(threading_algorithm, charset, search_criterion[, ...], *, uid=False)
729769

730770
The ``thread`` command is a variant of ``search`` with threading semantics for
731771
the results. Returned data contains a space separated list of thread members.
@@ -743,11 +783,17 @@ An :class:`IMAP4` instance has the following methods:
743783
returns the matching messages threaded according to the specified threading
744784
algorithm.
745785

786+
If *uid* is true, the message numbers in the response are UIDs
787+
(``UID THREAD``).
788+
746789
As with :meth:`search`, a *search_criterion* passed as :class:`str` is
747790
encoded to *charset*; pass :class:`bytes` to send one already encoded.
748791

749792
This is an ``IMAP4rev1`` extension command.
750793

794+
.. versionchanged:: next
795+
Added the *uid* parameter.
796+
751797
.. versionchanged:: next
752798
``str`` search criteria are encoded to *charset*.
753799

Doc/tools/.nitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,4 @@ Doc/library/xml.sax.reader.rst
3333
Doc/library/xml.sax.rst
3434
Doc/library/xmlrpc.client.rst
3535
Doc/library/xmlrpc.server.rst
36-
Doc/whatsnew/2.4.rst
37-
Doc/whatsnew/2.5.rst
3836
Doc/whatsnew/2.6.rst

Doc/using/windows.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,9 +1174,9 @@ on using nuget. What follows is a summary that is sufficient for Python
11741174
developers.
11751175

11761176
The ``nuget.exe`` command line tool may be downloaded directly from
1177-
``https://aka.ms/nugetclidl``, for example, using curl or PowerShell. With the
1178-
tool, the latest version of Python for 64-bit or 32-bit machines is installed
1179-
using::
1177+
``https://dist.nuget.org/win-x86-commandline/latest/nuget.exe``, for example,
1178+
using curl or PowerShell. With the tool, the latest version of Python for
1179+
64-bit or 32-bit machines is installed using::
11801180

11811181
nuget.exe install python -ExcludeVersion -OutputDirectory .
11821182
nuget.exe install pythonx86 -ExcludeVersion -OutputDirectory .

0 commit comments

Comments
 (0)