]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Replace KB unit with KiB (#4293)
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 8 Nov 2017 22:44:44 +0000 (14:44 -0800)
committerGitHub <noreply@github.com>
Wed, 8 Nov 2017 22:44:44 +0000 (14:44 -0800)
kB (*kilo* byte) unit means 1000 bytes, whereas KiB ("kibibyte")
means 1024 bytes. KB was misused: replace kB or KB with KiB when
appropriate.

Same change for MB and GB which become MiB and GiB.

Change the output of Tools/iobench/iobench.py.

Round also the size of the documentation from 5.5 MB to 5 MiB.

38 files changed:
Doc/c-api/memory.rst
Doc/library/hashlib.rst
Doc/library/locale.rst
Doc/library/multiprocessing.rst
Doc/tools/templates/download.html
Include/internal/pymalloc.h
Lib/distutils/cygwinccompiler.py
Lib/gzip.py
Lib/test/_test_multiprocessing.py
Lib/test/libregrtest/cmdline.py
Lib/test/pickletester.py
Lib/test/test_bigaddrspace.py
Lib/test/test_bz2.py
Lib/test/test_io.py
Lib/test/test_largefile.py
Lib/test/test_mmap.py
Lib/test/test_os.py
Lib/test/test_socket.py
Lib/test/test_tarfile.py
Lib/test/test_threading.py
Lib/test/test_zipfile64.py
Lib/test/test_zlib.py
Lib/xmlrpc/client.py
Misc/NEWS.d/3.5.0a1.rst
Misc/README.AIX
Modules/_hashopenssl.c
Modules/_io/fileio.c
Modules/_io/winconsoleio.c
Modules/_threadmodule.c
Modules/faulthandler.c
Modules/hashtable.c
Objects/accu.c
Objects/typeobject.c
Python/fileutils.c
Python/thread_nt.h
Python/thread_pthread.h
Tools/iobench/iobench.py
setup.py

index 0a5b0ef44b4c8dec4a3cc33486140e47f78cb047..4b1e666ef3576525afdd47b427ba9b955d5d378e 100644 (file)
@@ -450,7 +450,7 @@ The pymalloc allocator
 
 Python has a *pymalloc* allocator optimized for small objects (smaller or equal
 to 512 bytes) with a short lifetime. It uses memory mappings called "arenas"
-with a fixed size of 256 KB. It falls back to :c:func:`PyMem_RawMalloc` and
+with a fixed size of 256 KiB. It falls back to :c:func:`PyMem_RawMalloc` and
 :c:func:`PyMem_RawRealloc` for allocations larger than 512 bytes.
 
 *pymalloc* is the default allocator of the :c:data:`PYMEM_DOMAIN_MEM` (ex:
index 3a27a5b566f58dad62ce605e8923f06e2899cf3b..452705f4d2ae787d02bbac7ebb7a728631b3bd3c 100644 (file)
@@ -267,7 +267,7 @@ include a `salt <https://en.wikipedia.org/wiki/Salt_%28cryptography%29>`_.
    should be about 16 or more bytes from a proper source, e.g. :func:`os.urandom`.
 
    *n* is the CPU/Memory cost factor, *r* the block size, *p* parallelization
-   factor and *maxmem* limits memory (OpenSSL 1.1.0 defaults to 32 MB).
+   factor and *maxmem* limits memory (OpenSSL 1.1.0 defaults to 32 MiB).
    *dklen* is the length of the derived key.
 
    Availability: OpenSSL 1.1+
index f423d704ca59edff28ae3091640018f59e6a28c4..e8567a7b658a8879cc82f3126904322c91efc948 100644 (file)
@@ -373,7 +373,7 @@ The :mod:`locale` module defines the following exception and functions:
 
    Please note that this function works like :meth:`format_string` but will
    only work for exactly one ``%char`` specifier.  For example, ``'%f'`` and
-   ``'%.0f'`` are both valid specifiers, but ``'%f kB'`` is not.
+   ``'%.0f'`` are both valid specifiers, but ``'%f KiB'`` is not.
 
    For whole format strings, use :func:`format_string`.
 
index 80a87b8590e9efcdb6b73a23017e2087993c75ab..3619cccfe63578a20693c9bfd9b7fa4b67ce8289 100644 (file)
@@ -1034,7 +1034,7 @@ Connection objects are usually created using :func:`Pipe` -- see also
       Send an object to the other end of the connection which should be read
       using :meth:`recv`.
 
-      The object must be picklable.  Very large pickles (approximately 32 MB+,
+      The object must be picklable.  Very large pickles (approximately 32 MiB+,
       though it depends on the OS) may raise a :exc:`ValueError` exception.
 
    .. method:: recv()
@@ -1071,7 +1071,7 @@ Connection objects are usually created using :func:`Pipe` -- see also
 
       If *offset* is given then data is read from that position in *buffer*.  If
       *size* is given then that many bytes will be read from buffer.  Very large
-      buffers (approximately 32 MB+, though it depends on the OS) may raise a
+      buffers (approximately 32 MiB+, though it depends on the OS) may raise a
       :exc:`ValueError` exception
 
    .. method:: recv_bytes([maxlength])
index d49ebdd14ba8a1c12d303f1250c1ecbfc9a75388..1a99b18bbb268ec38d36232da015697590bf7ba1 100644 (file)
@@ -18,23 +18,23 @@ in the table are the size of the download files in megabytes.</p>
 <table class="docutils">
   <tr><th>Format</th><th>Packed as .zip</th><th>Packed as .tar.bz2</th></tr>
   <tr><td>PDF (US-Letter paper size)</td>
-    <td><a href="{{ dlbase }}/python-{{ release }}-docs-pdf-letter.zip">Download</a> (ca. 13 MB)</td>
-    <td><a href="{{ dlbase }}/python-{{ release }}-docs-pdf-letter.tar.bz2">Download</a> (ca. 13 MB)</td>
+    <td><a href="{{ dlbase }}/python-{{ release }}-docs-pdf-letter.zip">Download</a> (ca. 13 MiB)</td>
+    <td><a href="{{ dlbase }}/python-{{ release }}-docs-pdf-letter.tar.bz2">Download</a> (ca. 13 MiB)</td>
   </tr>
   <tr><td>PDF (A4 paper size)</td>
-    <td><a href="{{ dlbase }}/python-{{ release }}-docs-pdf-a4.zip">Download</a> (ca. 13 MB)</td>
-    <td><a href="{{ dlbase }}/python-{{ release }}-docs-pdf-a4.tar.bz2">Download</a> (ca. 13 MB)</td>
+    <td><a href="{{ dlbase }}/python-{{ release }}-docs-pdf-a4.zip">Download</a> (ca. 13 MiB)</td>
+    <td><a href="{{ dlbase }}/python-{{ release }}-docs-pdf-a4.tar.bz2">Download</a> (ca. 13 MiB)</td>
   </tr>
   <tr><td>HTML</td>
-    <td><a href="{{ dlbase }}/python-{{ release }}-docs-html.zip">Download</a> (ca. 9 MB)</td>
-    <td><a href="{{ dlbase }}/python-{{ release }}-docs-html.tar.bz2">Download</a> (ca. 6 MB)</td>
+    <td><a href="{{ dlbase }}/python-{{ release }}-docs-html.zip">Download</a> (ca. 9 MiB)</td>
+    <td><a href="{{ dlbase }}/python-{{ release }}-docs-html.tar.bz2">Download</a> (ca. 6 MiB)</td>
   </tr>
   <tr><td>Plain Text</td>
-    <td><a href="{{ dlbase }}/python-{{ release }}-docs-text.zip">Download</a> (ca. 3 MB)</td>
-    <td><a href="{{ dlbase }}/python-{{ release }}-docs-text.tar.bz2">Download</a> (ca. 2 MB)</td>
+    <td><a href="{{ dlbase }}/python-{{ release }}-docs-text.zip">Download</a> (ca. 3 MiB)</td>
+    <td><a href="{{ dlbase }}/python-{{ release }}-docs-text.tar.bz2">Download</a> (ca. 2 MiB)</td>
   </tr>
  <tr><td>EPUB</td>
-    <td><a href="{{ dlbase }}/python-{{ release }}-docs.epub">Download</a> (ca. 5.5 MB)</td>
+    <td><a href="{{ dlbase }}/python-{{ release }}-docs.epub">Download</a> (ca. 5 MiB)</td>
     <td></td>
   </tr>
 </table>
index e9d6ab6a8b39d6dd64bbe2563bee2cb54626296f..723d9e7e671a8ee3fc30f02bb30f7cb16f4e5c5c 100644 (file)
  */
 #ifdef WITH_MEMORY_LIMITS
 #ifndef SMALL_MEMORY_LIMIT
-#define SMALL_MEMORY_LIMIT      (64 * 1024 * 1024)      /* 64 MB -- more? */
+#define SMALL_MEMORY_LIMIT      (64 * 1024 * 1024)      /* 64 MiB -- more? */
 #endif
 #endif
 
  * Arenas are allocated with mmap() on systems supporting anonymous memory
  * mappings to reduce heap fragmentation.
  */
-#define ARENA_SIZE              (256 << 10)     /* 256KB */
+#define ARENA_SIZE              (256 << 10)     /* 256 KiB */
 
 #ifdef WITH_MEMORY_LIMITS
 #define MAX_ARENAS              (SMALL_MEMORY_LIMIT / ARENA_SIZE)
@@ -435,7 +435,7 @@ currently in use isn't on either list.
 */
 
 /* How many arena_objects do we initially allocate?
- * 16 = can allocate 16 arenas = 16 * ARENA_SIZE = 4MB before growing the
+ * 16 = can allocate 16 arenas = 16 * ARENA_SIZE = 4 MiB before growing the
  * `arenas` vector.
  */
 #define INITIAL_ARENA_OBJECTS 16
index 1c369903477e7937c7eaa59d42f3fc714b291ead..6c5d77746b6f567c3dd77d4c0e66f174820b0b50 100644 (file)
@@ -234,8 +234,8 @@ class CygwinCCompiler(UnixCCompiler):
         # who wants symbols and a many times larger output file
         # should explicitly switch the debug mode on
         # otherwise we let dllwrap/ld strip the output file
-        # (On my machine: 10KB < stripped_file < ??100KB
-        #   unstripped_file = stripped_file + XXX KB
+        # (On my machine: 10KiB < stripped_file < ??100KiB
+        #   unstripped_file = stripped_file + XXX KiB
         #  ( XXX=254 for a typical python extension))
         if not debug:
             extra_preargs.append("-s")
index 76ab497853c1d20dca671b58358b19e64c977673..ddc7bda1fecbbd25ef4f3db6175f4e59e897f142 100644 (file)
@@ -308,7 +308,7 @@ class GzipFile(_compression.BaseStream):
             if self.mode == WRITE:
                 fileobj.write(self.compress.flush())
                 write32u(fileobj, self.crc)
-                # self.size may exceed 2GB, or even 4GB
+                # self.size may exceed 2 GiB, or even 4 GiB
                 write32u(fileobj, self.size & 0xffffffff)
             elif self.mode == READ:
                 self._buffer.close()
index d4e8a8a7e1a841b59b1d934ca821d70f11eb7668..dbca2d89ed14e4c4b7e1d4918fdd02c59467fee8 100644 (file)
@@ -4221,7 +4221,7 @@ class TestIgnoreEINTR(unittest.TestCase):
         conn.send('ready')
         x = conn.recv()
         conn.send(x)
-        conn.send_bytes(b'x'*(1024*1024))   # sending 1 MB should block
+        conn.send_bytes(b'x' * (1024 * 1024))   # sending 1 MiB should block
 
     @unittest.skipUnless(hasattr(signal, 'SIGUSR1'), 'requires SIGUSR1')
     def test_ignore(self):
index 4999fa734114a13b7a379ee29e01d2e40c80e30a..dab17c3edf32aef869d39ed3bb7641b78838f4e7 100644 (file)
@@ -96,7 +96,7 @@ resources to test.  Currently only the following are defined:
 
     largefile - It is okay to run some test that may create huge
                 files.  These tests can take a long time and may
-                consume >2GB of disk space temporarily.
+                consume >2 GiB of disk space temporarily.
 
     network -   It is okay to run tests that use external network
                 resource, e.g. testing SSL support for sockets.
index 5c83361027bdb2548c561951ffc5033f36b4df9c..296faf0a76b02f55ff8d6d13b0cb6eb88d1178c4 100644 (file)
@@ -2276,7 +2276,7 @@ class AbstractPickleTests(unittest.TestCase):
 
 class BigmemPickleTests(unittest.TestCase):
 
-    # Binary protocols can serialize longs of up to 2GB-1
+    # Binary protocols can serialize longs of up to 2 GiB-1
 
     @bigmemtest(size=_2G, memuse=3.6, dry_run=False)
     def test_huge_long_32b(self, size):
@@ -2291,7 +2291,7 @@ class BigmemPickleTests(unittest.TestCase):
         finally:
             data = None
 
-    # Protocol 3 can serialize up to 4GB-1 as a bytes object
+    # Protocol 3 can serialize up to 4 GiB-1 as a bytes object
     # (older protocols don't have a dedicated opcode for bytes and are
     # too inefficient)
 
index b8c59d41d394037775b148491f0da749cce1d278..b639f68c2347bf72f0e7dff814e2d5b14843c2db 100644 (file)
@@ -3,7 +3,7 @@ These tests are meant to exercise that requests to create objects bigger
 than what the address space allows are properly met with an OverflowError
 (rather than crash weirdly).
 
-Primarily, this means 32-bit builds with at least 2 GB of available memory.
+Primarily, this means 32-bit builds with at least 2 GiB of available memory.
 You need to pass the -M option to regrtest (e.g. "-M 2.1G") for tests to
 be enabled.
 """
index 58dbf96d3c80e93aae41c34ef65be7aa3c0c30f4..58abdc1a0668c07bdc3b6cb409b47345faaa8812 100644 (file)
@@ -62,7 +62,7 @@ class BaseTest(unittest.TestCase):
     BAD_DATA = b'this is not a valid bzip2 file'
 
     # Some tests need more than one block of uncompressed data. Since one block
-    # is at least 100 kB, we gather some data dynamically and compress it.
+    # is at least 100,000 bytes, we gather some data dynamically and compress it.
     # Note that this assumes that compression works correctly, so we cannot
     # simply use the bigger test data for all tests.
     test_size = 0
index ce4ed1b8f6a48ff7fbad9409ae3ab6c758a60687..3158729a7fada58645ae1d0371b6a8df0812e059 100644 (file)
@@ -564,7 +564,7 @@ class IOTest(unittest.TestCase):
 
     def test_large_file_ops(self):
         # On Windows and Mac OSX this test comsumes large resources; It takes
-        # a long time to build the >2GB file and takes >2GB of disk space
+        # a long time to build the >2 GiB file and takes >2 GiB of disk space
         # therefore the resource must be enabled to run this test.
         if sys.platform[:3] == 'win' or sys.platform == 'darwin':
             support.requires(
@@ -736,7 +736,7 @@ class IOTest(unittest.TestCase):
         if sys.maxsize > 0x7FFFFFFF:
             self.skipTest("test can only run in a 32-bit address space")
         if support.real_max_memuse < support._2G:
-            self.skipTest("test requires at least 2GB of memory")
+            self.skipTest("test requires at least 2 GiB of memory")
         with self.open(zero, "rb", buffering=0) as f:
             self.assertRaises(OverflowError, f.read)
         with self.open(zero, "rb") as f:
@@ -1421,7 +1421,7 @@ class CBufferedReaderTest(BufferedReaderTest, SizeofTest):
     def test_constructor(self):
         BufferedReaderTest.test_constructor(self)
         # The allocation can succeed on 32-bit builds, e.g. with more
-        # than 2GB RAM and a 64-bit kernel.
+        # than 2 GiB RAM and a 64-bit kernel.
         if sys.maxsize > 0x7FFFFFFF:
             rawio = self.MockRawIO()
             bufio = self.tp(rawio)
@@ -1733,7 +1733,7 @@ class CBufferedWriterTest(BufferedWriterTest, SizeofTest):
     def test_constructor(self):
         BufferedWriterTest.test_constructor(self)
         # The allocation can succeed on 32-bit builds, e.g. with more
-        # than 2GB RAM and a 64-bit kernel.
+        # than 2 GiB RAM and a 64-bit kernel.
         if sys.maxsize > 0x7FFFFFFF:
             rawio = self.MockRawIO()
             bufio = self.tp(rawio)
@@ -2206,7 +2206,7 @@ class CBufferedRandomTest(BufferedRandomTest, SizeofTest):
     def test_constructor(self):
         BufferedRandomTest.test_constructor(self)
         # The allocation can succeed on 32-bit builds, e.g. with more
-        # than 2GB RAM and a 64-bit kernel.
+        # than 2 GiB RAM and a 64-bit kernel.
         if sys.maxsize > 0x7FFFFFFF:
             rawio = self.MockRawIO()
             bufio = self.tp(rawio)
index 5b276e76ff2ec76ec6ac4c4d52fb5266bfe45da1..f409c5b5110aee2b6147dca2f54be7d38f1bf514 100644 (file)
@@ -9,12 +9,12 @@ from test.support import TESTFN, requires, unlink
 import io  # C implementation of io
 import _pyio as pyio # Python implementation of io
 
-# size of file to create (>2GB; 2GB == 2147483648 bytes)
+# size of file to create (>2 GiB; 2 GiB == 2,147,483,648 bytes)
 size = 2500000000
 
 class LargeFileTest:
     """Test that each file function works as expected for large
-    (i.e. > 2GB) files.
+    (i.e. > 2 GiB) files.
     """
 
     def setUp(self):
@@ -142,7 +142,7 @@ def setUpModule():
         pass
 
     # On Windows and Mac OSX this test comsumes large resources; It
-    # takes a long time to build the >2GB file and takes >2GB of disk
+    # takes a long time to build the >2 GiB file and takes >2 GiB of disk
     # space therefore the resource must be enabled to run this test.
     # If not, nothing after this line stanza will be executed.
     if sys.platform[:3] == 'win' or sys.platform == 'darwin':
index 56d85e75f87a9379879c585dd0bb6f857f021029..80835c9519cd879c0eb83144b3d8b23c4de8aa65 100644 (file)
@@ -777,7 +777,7 @@ class LargeMmapTests(unittest.TestCase):
             with mmap.mmap(f.fileno(), 0x10000, access=mmap.ACCESS_READ) as m:
                 self.assertEqual(m.size(), 0x180000000)
 
-    # Issue 11277: mmap() with large (~4GB) sparse files crashes on OS X.
+    # Issue 11277: mmap() with large (~4 GiB) sparse files crashes on OS X.
 
     def _test_around_boundary(self, boundary):
         tail = b'  DEARdear  '
index 4d57bfbf9ab20d3d20203020deb44829fce1fc97..ff19fac0f77af65ac31e721caa745ed8b6f8db3f 100644 (file)
@@ -171,7 +171,7 @@ class FileTests(unittest.TestCase):
         with open(support.TESTFN, "rb") as fp:
             data = os.read(fp.fileno(), size)
 
-        # The test does not try to read more than 2 GB at once because the
+        # The test does not try to read more than 2 GiB at once because the
         # operating system is free to return less bytes than requested.
         self.assertEqual(data, b'test')
 
@@ -2573,7 +2573,7 @@ class SendfileTestServer(asyncore.dispatcher, threading.Thread):
 @unittest.skipUnless(hasattr(os, 'sendfile'), "test needs os.sendfile()")
 class TestSendfile(unittest.TestCase):
 
-    DATA = b"12345abcde" * 16 * 1024  # 160 KB
+    DATA = b"12345abcde" * 16 * 1024  # 160 KiB
     SUPPORT_HEADERS_TRAILERS = not sys.platform.startswith("linux") and \
                                not sys.platform.startswith("solaris") and \
                                not sys.platform.startswith("sunos")
index 096fb54ac1580ea8b66b36490c8761915694125d..fb16d091f90274ec9f7776418f2005e858885877 100644 (file)
@@ -5299,7 +5299,7 @@ class SendfileUsingSendTest(ThreadedTCPSocketTest):
     Test the send() implementation of socket.sendfile().
     """
 
-    FILESIZE = (10 * 1024 * 1024)  # 10MB
+    FILESIZE = (10 * 1024 * 1024)  # 10 MiB
     BUFSIZE = 8192
     FILEDATA = b""
     TIMEOUT = 2
index 030ace14f16d38edcf26252d6ef7ae7ab2944b92..f0a5b21ab5a7438bbc9d42d2789d06ffbfe7d297 100644 (file)
@@ -779,12 +779,12 @@ class Bz2DetectReadTest(Bz2Test, DetectReadTest):
     def test_detect_stream_bz2(self):
         # Originally, tarfile's stream detection looked for the string
         # "BZh91" at the start of the file. This is incorrect because
-        # the '9' represents the blocksize (900kB). If the file was
+        # the '9' represents the blocksize (900,000 bytes). If the file was
         # compressed using another blocksize autodetection fails.
         with open(tarname, "rb") as fobj:
             data = fobj.read()
 
-        # Compress with blocksize 100kB, the file starts with "BZh11".
+        # Compress with blocksize 100,000 bytes, the file starts with "BZh11".
         with bz2.BZ2File(tmpname, "wb", compresslevel=1) as fobj:
             fobj.write(data)
 
index a4887af051e8f61ab9bf6af30fdda3d37331dac9..007581d7213b1f04503c2771e28a067c772a9ef4 100644 (file)
@@ -132,10 +132,10 @@ class ThreadTests(BaseTestCase):
         # Kill the "immortal" _DummyThread
         del threading._active[ident[0]]
 
-    # run with a small(ish) thread stack size (256kB)
+    # run with a small(ish) thread stack size (256 KiB)
     def test_various_ops_small_stack(self):
         if verbose:
-            print('with 256kB thread stack size...')
+            print('with 256 KiB thread stack size...')
         try:
             threading.stack_size(262144)
         except _thread.error:
@@ -144,10 +144,10 @@ class ThreadTests(BaseTestCase):
         self.test_various_ops()
         threading.stack_size(0)
 
-    # run with a large thread stack size (1MB)
+    # run with a large thread stack size (1 MiB)
     def test_various_ops_large_stack(self):
         if verbose:
-            print('with 1MB thread stack size...')
+            print('with 1 MiB thread stack size...')
         try:
             threading.stack_size(0x100000)
         except _thread.error:
index ae29545abf16051ae6cecf03ebdb053480565750..cba909f6bce2772430b09643c4239440d3f44540 100644 (file)
@@ -39,7 +39,7 @@ class TestsWithSourceFile(unittest.TestCase):
         # Create the ZIP archive.
         zipfp = zipfile.ZipFile(f, "w", compression)
 
-        # It will contain enough copies of self.data to reach about 6GB of
+        # It will contain enough copies of self.data to reach about 6 GiB of
         # raw data to store.
         filecount = 6*1024**3 // len(self.data)
 
index 20174d8343f2b554b7ebe1f241f4c0321ed2bce0..e67bee97cb3d3be55d7870ba0efd4a8a7d592c93 100644 (file)
@@ -72,7 +72,7 @@ class ChecksumTestCase(unittest.TestCase):
         self.assertEqual(binascii.crc32(b'spam'), zlib.crc32(b'spam'))
 
 
-# Issue #10276 - check that inputs >=4GB are handled correctly.
+# Issue #10276 - check that inputs >=4 GiB are handled correctly.
 class ChecksumBigBufferTestCase(unittest.TestCase):
 
     @bigmemtest(size=_4G + 4, memuse=1, dry_run=False)
@@ -130,7 +130,7 @@ class ExceptionTestCase(unittest.TestCase):
 class BaseCompressTestCase(object):
     def check_big_compress_buffer(self, size, compress_func):
         _1M = 1024 * 1024
-        # Generate 10MB worth of random, and expand it by repeating it.
+        # Generate 10 MiB worth of random, and expand it by repeating it.
         # The assumption is that zlib's memory is not big enough to exploit
         # such spread out redundancy.
         data = b''.join([random.getrandbits(8 * _1M).to_bytes(_1M, 'little')
index bd3278e005a19d0826cbe972e7cbd39e6c6cf4d0..28525036c46640ec7a09c3222eeb73b8224572ca 100644 (file)
@@ -1046,7 +1046,7 @@ def gzip_encode(data):
 # in the HTTP header, as described in RFC 1952
 #
 # @param data The encoded data
-# @keyparam max_decode Maximum bytes to decode (20MB default), use negative
+# @keyparam max_decode Maximum bytes to decode (20 MiB default), use negative
 #    values for unlimited decoding
 # @return the unencoded data
 # @raises ValueError if data is not correctly coded.
index bc835442b6f286fa28bca3238d860025ce69e9d4..e83a8080cf8dd4959416afd1728100f53474b87e 100644 (file)
@@ -3035,7 +3035,7 @@ by Phil Elson.
 .. section: Library
 
 os.read() now uses a :c:func:`Py_ssize_t` type instead of :c:type:`int` for
-the size to support reading more than 2 GB at once. On Windows, the size is
+the size to support reading more than 2 GiB at once. On Windows, the size is
 truncted to INT_MAX. As any call to os.read(), the OS may read less bytes
 than the number of requested bytes.
 
@@ -3144,7 +3144,7 @@ by Pablo Torres Navarrete and SilentGhost.
 .. nonce: u_oiv9
 .. section: Library
 
-ssl.RAND_add() now supports strings longer than 2 GB.
+ssl.RAND_add() now supports strings longer than 2 GiB.
 
 ..
 
index 82348f29ebc29802fbdb8fad7c52fe5a7926ac42..92ad0293e65850b5927b231dcadb0f95366885c4 100644 (file)
@@ -51,24 +51,24 @@ Note: this section may not apply when compiling Python as a 64 bit
 application.
 
 By default on AIX each program gets one segment register for its data
-segment. As each segment register covers 256 MB, a Python program that
-would use more than 256MB will raise a MemoryError.  The standard
+segment. As each segment register covers 256 MiB, a Python program that
+would use more than 256 MiB will raise a MemoryError.  The standard
 Python test suite is one such application.
 
 To allocate more segment registers to Python, you must use the linker
 option -bmaxdata or the ldedit tool to specify the number of bytes you
 need in the data segment.
 
-For example, if you want to allow 512MB of memory for Python (this is
+For example, if you want to allow 512 MiB of memory for Python (this is
 enough for the test suite to run without MemoryErrors), you should run
 the following command at the end of compilation:
 
 ldedit -b maxdata:0x20000000 ./python
 
-You can allow up to 2GB of memory for Python by using the value
+You can allow up to 2 GiB of memory for Python by using the value
 0x80000000 for maxdata.
 
-It is also possible to go beyond 2GB of memory by activating Large
+It is also possible to go beyond 2 GiB of memory by activating Large
 Page Use. You should consult the IBM documentation if you need to use
 this option. You can also follow the discussion of this problem
 in issue 11212 at bugs.python.org.
index 01f1671a8f50565134b983456e9c73e9b6c24515..d597987b4428f210dc87844895e7f4e9f38a7977 100644 (file)
@@ -801,7 +801,7 @@ _hashlib_scrypt_impl(PyObject *module, Py_buffer *password, Py_buffer *salt,
     }
 
     if (maxmem < 0 || maxmem > INT_MAX) {
-        /* OpenSSL 1.1.0 restricts maxmem to 32MB. It may change in the
+        /* OpenSSL 1.1.0 restricts maxmem to 32 MiB. It may change in the
            future. The maxmem constant is private to OpenSSL. */
         PyErr_Format(PyExc_ValueError,
                      "maxmem must be positive and smaller than %d",
index cc7061fced153eb1609805e31adbed31664e8236..b6755b851dca8ed0c4d9a3e1dc7978ddb7793dcc 100644 (file)
@@ -41,7 +41,7 @@
 #if BUFSIZ < (8*1024)
 #define SMALLCHUNK (8*1024)
 #elif (BUFSIZ >= (2 << 25))
-#error "unreasonable BUFSIZ > 64MB defined"
+#error "unreasonable BUFSIZ > 64 MiB defined"
 #else
 #define SMALLCHUNK BUFSIZ
 #endif
index 6600fde1942978d1ca281f8fe1ca119c6a3f18d7..30d1c767afcf74d99bd47e3c2da7b909975e63a8 100644 (file)
@@ -31,7 +31,7 @@
 #if BUFSIZ < (16*1024)
 #define SMALLCHUNK (2*1024)
 #elif (BUFSIZ >= (2 << 25))
-#error "unreasonable BUFSIZ > 64MB defined"
+#error "unreasonable BUFSIZ > 64 MiB defined"
 #else
 #define SMALLCHUNK BUFSIZ
 #endif
index 99611eebcb74450d37244455ec86573ac4b33bc3..aaa13da890b19fc891b29215b4c41c3a111a655a 100644 (file)
@@ -1276,10 +1276,10 @@ exception is raised, and the stack size is unmodified.  32k bytes\n\
 sufficient stack space for the interpreter itself.\n\
 \n\
 Note that some platforms may have particular restrictions on values for\n\
-the stack size, such as requiring a minimum stack size larger than 32kB or\n\
+the stack size, such as requiring a minimum stack size larger than 32 KiB or\n\
 requiring allocation in multiples of the system memory page size\n\
 - platform documentation should be referred to for more information\n\
-(4kB pages are common; using multiples of 4096 for the stack size is\n\
+(4 KiB pages are common; using multiples of 4096 for the stack size is\n\
 the suggested approach in the absence of more specific information).");
 
 static PyMethodDef thread_methods[] = {
index 9b51f7e30a9e9b1b26e44735590cebab04223ae3..33edc0547e6a745787527242f14d79be7e0d531b 100644 (file)
@@ -14,8 +14,8 @@
 #  include <sys/resource.h>
 #endif
 
-/* Allocate at maximum 100 MB of the stack to raise the stack overflow */
-#define STACK_OVERFLOW_MAX_SIZE (100*1024*1024)
+/* Allocate at maximum 100 MiB of the stack to raise the stack overflow */
+#define STACK_OVERFLOW_MAX_SIZE (100 * 1024 * 1024)
 
 #define FAULTHANDLER_LATER
 
index 0547a6def2aac6fa1bc22afaa690fc3a7b9fd25e..e6f8daf7966408bbf8a39e57b126565f40409924 100644 (file)
@@ -243,7 +243,7 @@ _Py_hashtable_print_stats(_Py_hashtable_t *ht)
            ht, ht->entries, ht->num_buckets, load * 100.0);
     if (nchains)
         printf("avg_chain_len=%.1f, ", (double)total_chain_len / nchains);
-    printf("max_chain_len=%" PY_FORMAT_SIZE_T "u, %" PY_FORMAT_SIZE_T "u kB\n",
+    printf("max_chain_len=%" PY_FORMAT_SIZE_T "u, %" PY_FORMAT_SIZE_T "u KiB\n",
            max_chain_len, size / 1024);
 }
 #endif
index 5bd2ee41fef7b666e731f5413316a0e2ee4ba295..48fe02da5409ee5ff5a1d3cafe2efeee17afef53 100644 (file)
@@ -64,7 +64,7 @@ _PyAccu_Accumulate(_PyAccu *acc, PyObject *unicode)
      * builds) of:
      *   - 8 bytes for the list slot
      *   - 56 bytes for the header of the unicode object
-     * that is, 64 bytes.  100000 such objects waste more than 6MB
+     * that is, 64 bytes.  100000 such objects waste more than 6 MiB
      * compared to a single concatenated string.
      */
     if (nsmall < 100000)
index e72460bfbb3bec5daee9dc586c4aeca794c2ca57..2a8118b43c5a0a7a1d11cb8cb5f0216018f80158 100644 (file)
@@ -206,7 +206,7 @@ PyType_ClearCache(void)
             method_cache_misses, (int) (100.0 * method_cache_misses / total));
     fprintf(stderr, "-- Method cache collisions  = %zd (%d%%)\n",
             method_cache_collisions, (int) (100.0 * method_cache_collisions / total));
-    fprintf(stderr, "-- Method cache size        = %zd KB\n",
+    fprintf(stderr, "-- Method cache size        = %zd KiB\n",
             sizeof(method_cache) / 1024);
 #endif
 
index 1cd8ac5302cad8eebdd679a7bac563ff41087ec3..eab58c5056147a72c9110de160124eca15458024 100644 (file)
@@ -599,8 +599,8 @@ _Py_attribute_data_to_stat(BY_HANDLE_FILE_INFORMATION *info, ULONG reparse_tag,
    On POSIX, use fstat().
 
    On Windows, use GetFileType() and GetFileInformationByHandle() which support
-   files larger than 2 GB.  fstat() may fail with EOVERFLOW on files larger
-   than 2 GB because the file size type is a signed 32-bit integer: see issue
+   files larger than 2 GiB.  fstat() may fail with EOVERFLOW on files larger
+   than 2 GiB because the file size type is a signed 32-bit integer: see issue
    #23152.
 
    On Windows, set the last Windows error and return nonzero on error. On
@@ -665,8 +665,8 @@ _Py_fstat_noraise(int fd, struct _Py_stat_struct *status)
    On POSIX, use fstat().
 
    On Windows, use GetFileType() and GetFileInformationByHandle() which support
-   files larger than 2 GB.  fstat() may fail with EOVERFLOW on files larger
-   than 2 GB because the file size type is a signed 32-bit integer: see issue
+   files larger than 2 GiB.  fstat() may fail with EOVERFLOW on files larger
+   than 2 GiB because the file size type is a signed 32-bit integer: see issue
    #23152.
 
    Raise an exception and return -1 on error. On Windows, set the last Windows
index 46df346692839158d4b272954b972bd64d5214c5..14213076bcb920b2b7aba81e61b843391ec92d53 100644 (file)
@@ -323,8 +323,8 @@ PyThread_release_lock(PyThread_type_lock aLock)
 }
 
 /* minimum/maximum thread stack sizes supported */
-#define THREAD_MIN_STACKSIZE    0x8000          /* 32kB */
-#define THREAD_MAX_STACKSIZE    0x10000000      /* 256MB */
+#define THREAD_MIN_STACKSIZE    0x8000          /* 32 KiB */
+#define THREAD_MAX_STACKSIZE    0x10000000      /* 256 MiB */
 
 /* set the thread stack size.
  * Return 0 if size is valid, -1 otherwise.
index 13cffa3bf3e3f8e39ffe88baf65ce29f29c21133..b7463c0ca67763691210b5425c7582ea3e7a39f8 100644 (file)
@@ -35,7 +35,7 @@
 #define THREAD_STACK_SIZE       0x400000
 #endif
 /* for safety, ensure a viable minimum stacksize */
-#define THREAD_STACK_MIN        0x8000  /* 32kB */
+#define THREAD_STACK_MIN        0x8000  /* 32 KiB */
 #else  /* !_POSIX_THREAD_ATTR_STACKSIZE */
 #ifdef THREAD_STACK_SIZE
 #error "THREAD_STACK_SIZE defined but _POSIX_THREAD_ATTR_STACKSIZE undefined"
index 712e58472ed96016e3f4d134bcce0db6873a0978..b0a7feb92e4f9232f4b9307d76debdd90098ad62 100644 (file)
@@ -29,9 +29,9 @@ def text_open(fn, mode, encoding=None):
         return open(fn, mode)
 
 def get_file_sizes():
-    for s in ['20 KB', '400 KB', '10 MB']:
+    for s in ['20 KiB', '400 KiB', '10 MiB']:
         size, unit = s.split()
-        size = int(size) * {'KB': 1024, 'MB': 1024 ** 2}[unit]
+        size = int(size) * {'KiB': 1024, 'MiB': 1024 ** 2}[unit]
         yield s.replace(' ', ''), size
 
 def get_binary_files():
@@ -273,7 +273,7 @@ def run_all_tests(options):
 
     def print_results(size, n, real, cpu):
         bw = n * float(size) / 1024 ** 2 / real
-        bw = ("%4d MB/s" if bw > 100 else "%.3g MB/s") % bw
+        bw = ("%4d MiB/s" if bw > 100 else "%.3g MiB/s") % bw
         out.write(bw.rjust(12) + "\n")
         if cpu < 0.90 * real:
             out.write("   warning: test above used only %d%% CPU, "
index 51e5d7eff7fed823093f3800c6d16297e31a6e73..f284301ea4ccaa4595e75cbfc2578efbd94e5063 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -907,7 +907,7 @@ class PyBuildExt(build_ext):
                 missing.append('_hashlib')
 
         # We always compile these even when OpenSSL is available (issue #14693).
-        # It's harmless and the object code is tiny (40-50 KB per module,
+        # It's harmless and the object code is tiny (40-50 KiB per module,
         # only loaded when actually used).
         exts.append( Extension('_sha256', ['sha256module.c'],
                                depends=['hashlib.h']) )