Skip to content

Commit d480b26

Browse files
authored
Merge branch 'main' into pythongh-131624
2 parents 48dad88 + 557d2d2 commit d480b26

File tree

5 files changed

+33
-23
lines changed

5 files changed

+33
-23
lines changed

Doc/library/mailbox.rst

+27-2
Original file line numberDiff line numberDiff line change
@@ -587,12 +587,27 @@ Supported mailbox formats are Maildir, mbox, MH, Babyl, and MMDF.
587587
remarks:
588588

589589

590-
.. method:: get_file(key)
590+
.. method:: get_bytes(key, from_=False)
591+
592+
Note: This method has an extra parameter (*from_*) compared with other classes.
593+
The first line of an mbox file entry is the Unix "From " line.
594+
If *from_* is False, the first line of the file is dropped.
595+
596+
.. method:: get_file(key, from_=False)
591597

592598
Using the file after calling :meth:`~Mailbox.flush` or
593599
:meth:`~Mailbox.close` on the :class:`!mbox` instance may yield
594600
unpredictable results or raise an exception.
595601

602+
Note: This method has an extra parameter (*from_*) compared with other classes.
603+
The first line of an mbox file entry is the Unix "From " line.
604+
If *from_* is False, the first line of the file is dropped.
605+
606+
.. method:: get_string(key, from_=False)
607+
608+
Note: This method has an extra parameter (*from_*) compared with other classes.
609+
The first line of an mbox file entry is the Unix "From " line.
610+
If *from_* is False, the first line of the file is dropped.
596611

597612
.. method:: lock()
598613
unlock()
@@ -851,12 +866,22 @@ Supported mailbox formats are Maildir, mbox, MH, Babyl, and MMDF.
851866
remarks:
852867

853868

854-
.. method:: get_file(key)
869+
.. method:: get_bytes(key, from_=False)
870+
871+
Note: This method has an extra parameter (*from_*) compared with other classes.
872+
The first line of an mbox file entry is the Unix "From " line.
873+
If *from_* is False, the first line of the file is dropped.
874+
875+
.. method:: get_file(key, from_=False)
855876

856877
Using the file after calling :meth:`~Mailbox.flush` or
857878
:meth:`~Mailbox.close` on the :class:`!MMDF` instance may yield
858879
unpredictable results or raise an exception.
859880

881+
Note: This method has an extra parameter (*from_*) compared with other classes.
882+
The first line of an mbox file entry is the Unix "From " line.
883+
If *from_* is False, the first line of the file is dropped.
884+
860885

861886
.. method:: lock()
862887
unlock()

Lib/test/test_capi/test_bytearray.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class CAPITest(unittest.TestCase):
2020
def test_check(self):
2121
# Test PyByteArray_Check()
2222
check = _testlimitedcapi.bytearray_check
23+
self.assertTrue(check(bytearray(b'')))
2324
self.assertTrue(check(bytearray(b'abc')))
2425
self.assertFalse(check(b'abc'))
2526
self.assertTrue(check(ByteArraySubclass(b'abc')))
@@ -33,6 +34,7 @@ def test_check(self):
3334
def test_checkexact(self):
3435
# Test PyByteArray_CheckExact()
3536
check = _testlimitedcapi.bytearray_checkexact
37+
self.assertTrue(check(bytearray(b'')))
3638
self.assertTrue(check(bytearray(b'abc')))
3739
self.assertFalse(check(b'abc'))
3840
self.assertFalse(check(ByteArraySubclass(b'abc')))
@@ -78,7 +80,7 @@ def test_fromobject(self):
7880
def test_size(self):
7981
# Test PyByteArray_Size()
8082
size = _testlimitedcapi.bytearray_size
81-
83+
self.assertEqual(size(bytearray(b'')), 0)
8284
self.assertEqual(size(bytearray(b'abc')), 3)
8385
self.assertEqual(size(ByteArraySubclass(b'abc')), 3)
8486

@@ -89,7 +91,7 @@ def test_size(self):
8991
def test_asstring(self):
9092
"""Test PyByteArray_AsString()"""
9193
asstring = _testlimitedcapi.bytearray_asstring
92-
94+
self.assertEqual(asstring(bytearray(b''), 1), b'\0')
9395
self.assertEqual(asstring(bytearray(b'abc'), 4), b'abc\0')
9496
self.assertEqual(asstring(ByteArraySubclass(b'abc'), 4), b'abc\0')
9597
self.assertEqual(asstring(bytearray(b'abc\0def'), 8), b'abc\0def\0')
@@ -105,6 +107,7 @@ def test_concat(self):
105107
ba = bytearray(b'abc')
106108
self.assertEqual(concat(ba, b'def'), bytearray(b'abcdef'))
107109
self.assertEqual(ba, b'abc')
110+
self.assertEqual(concat(ba, ba), bytearray(b'abcabc'))
108111

109112
self.assertEqual(concat(b'abc', b'def'), bytearray(b'abcdef'))
110113
self.assertEqual(concat(b'a\0b', b'c\0d'), bytearray(b'a\0bc\0d'))

Modules/_multiprocessing/semaphore.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class _multiprocessing.SemLock "SemLockObject *" "&_PyMp_SemLockType"
6565
#define SEM_UNLINK(name) 0
6666

6767
static int
68-
_GetSemaphoreValue(HANDLE handle, long *value)
68+
_GetSemaphoreValue(HANDLE handle, int *value)
6969
{
7070
long previous;
7171

Modules/md5module.c

-9
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@ class MD5Type "MD5object *" "&PyType_Type"
2929
[clinic start generated code]*/
3030
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=6e5261719957a912]*/
3131

32-
/* Some useful types */
33-
34-
#if SIZEOF_INT == 4
35-
typedef unsigned int MD5_INT32; /* 32-bit integer */
36-
typedef long long MD5_INT64; /* 64-bit integer */
37-
#else
38-
/* not defined. compilation will die. */
39-
#endif
40-
4132
/* The MD5 block size and message digest sizes, in bytes */
4233

4334
#define MD5_BLOCKSIZE 64

Modules/sha1module.c

-9
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ class SHA1Type "SHA1object *" "&PyType_Type"
3030
[clinic start generated code]*/
3131
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=3dc9a20d1becb759]*/
3232

33-
/* Some useful types */
34-
35-
#if SIZEOF_INT == 4
36-
typedef unsigned int SHA1_INT32; /* 32-bit integer */
37-
typedef long long SHA1_INT64; /* 64-bit integer */
38-
#else
39-
/* not defined. compilation will die. */
40-
#endif
41-
4233
/* The SHA1 block size and message digest sizes, in bytes */
4334

4435
#define SHA1_BLOCKSIZE 64

0 commit comments

Comments
 (0)