Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
f8def28f
Commit
f8def28f
authored
Feb 16, 2013
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #17193: Use binary prefixes (KiB, MiB, GiB) for memory units.
parent
a0eb8099
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
21 additions
and
21 deletions
+21
-21
Doc/howto/unicode.rst
Doc/howto/unicode.rst
+2
-2
Doc/library/_thread.rst
Doc/library/_thread.rst
+4
-4
Doc/library/lzma.rst
Doc/library/lzma.rst
+3
-3
Doc/library/os.rst
Doc/library/os.rst
+1
-1
Doc/library/posix.rst
Doc/library/posix.rst
+1
-1
Doc/library/tarfile.rst
Doc/library/tarfile.rst
+2
-2
Doc/library/threading.rst
Doc/library/threading.rst
+4
-4
Doc/library/zipfile.rst
Doc/library/zipfile.rst
+2
-2
Modules/_pickle.c
Modules/_pickle.c
+2
-2
No files found.
Doc/howto/unicode.rst
View file @
f8def28f
...
@@ -456,11 +456,11 @@ with ``bytes.decode(encoding)``. However, the manual approach is not recommende
...
@@ -456,11 +456,11 @@ with ``bytes.decode(encoding)``. However, the manual approach is not recommende
One problem is the multi-byte nature of encodings; one Unicode character can be
One problem is the multi-byte nature of encodings; one Unicode character can be
represented by several bytes. If you want to read the file in arbitrary-sized
represented by several bytes. If you want to read the file in arbitrary-sized
chunks (say, 1
k or 4k
), you need to write error-handling code to catch the case
chunks (say, 1
024 or 4096 bytes
), you need to write error-handling code to catch the case
where only part of the bytes encoding a single Unicode character are read at the
where only part of the bytes encoding a single Unicode character are read at the
end of a chunk. One solution would be to read the entire file into memory and
end of a chunk. One solution would be to read the entire file into memory and
then perform the decoding, but that prevents you from working with files that
then perform the decoding, but that prevents you from working with files that
are extremely large; if you need to read a 2
GB file, you need 2G
B of RAM.
are extremely large; if you need to read a 2
GiB file, you need 2 Gi
B of RAM.
(More, really, since for at least a moment you'd need to have both the encoded
(More, really, since for at least a moment you'd need to have both the encoded
string and its Unicode version in memory.)
string and its Unicode version in memory.)
...
...
Doc/library/_thread.rst
View file @
f8def28f
...
@@ -93,15 +93,15 @@ It defines the following constants and functions:
...
@@ -93,15 +93,15 @@ It defines the following constants and functions:
Return the thread stack size used when creating new threads. The optional
Return the thread stack size used when creating new threads. The optional
*size* argument specifies the stack size to be used for subsequently created
*size* argument specifies the stack size to be used for subsequently created
threads, and must be 0 (use platform or configured default) or a positive
threads, and must be 0 (use platform or configured default) or a positive
integer value of at least 32,768 (32
k
B). If changing the thread stack size is
integer value of at least 32,768 (32
Ki
B). If changing the thread stack size is
unsupported, a :exc:`RuntimeError` is raised. If the specified stack size is
unsupported, a :exc:`RuntimeError` is raised. If the specified stack size is
invalid, a :exc:`ValueError` is raised and the stack size is unmodified. 32
k
B
invalid, a :exc:`ValueError` is raised and the stack size is unmodified. 32
Ki
B
is currently the minimum supported stack size value to guarantee sufficient
is currently the minimum supported stack size value to guarantee sufficient
stack space for the interpreter itself. Note that some platforms may have
stack space for the interpreter itself. Note that some platforms may have
particular restrictions on values for the stack size, such as requiring a
particular restrictions on values for the stack size, such as requiring a
minimum stack size > 32
k
B or requiring allocation in multiples of the system
minimum stack size > 32
Ki
B or requiring allocation in multiples of the system
memory page size - platform documentation should be referred to for more
memory page size - platform documentation should be referred to for more
information (4
k
B pages are common; using multiples of 4096 for the stack size is
information (4
Ki
B pages are common; using multiples of 4096 for the stack size is
the suggested approach in the absence of more specific information).
the suggested approach in the absence of more specific information).
Availability: Windows, systems with POSIX threads.
Availability: Windows, systems with POSIX threads.
...
...
Doc/library/lzma.rst
View file @
f8def28f
...
@@ -158,7 +158,7 @@ Compressing and decompressing data in memory
...
@@ -158,7 +158,7 @@ Compressing and decompressing data in memory
In addition to being more CPU-intensive, compression with higher presets
In addition to being more CPU-intensive, compression with higher presets
also requires much more memory (and produces output that needs more memory
also requires much more memory (and produces output that needs more memory
to decompress). With preset ``9`` for example, the overhead for an
to decompress). With preset ``9`` for example, the overhead for an
:class:`LZMACompressor` object can be as high as 800MiB. For this reason,
:class:`LZMACompressor` object can be as high as 800
MiB. For this reason,
it is generally best to stick with the default preset.
it is generally best to stick with the default preset.
The *filters* argument (if provided) should be a filter chain specifier.
The *filters* argument (if provided) should be a filter chain specifier.
...
@@ -302,8 +302,8 @@ entries in the dictionary representing the filter):
...
@@ -302,8 +302,8 @@ entries in the dictionary representing the filter):
* ``preset``: A compression preset to use as a source of default values for
* ``preset``: A compression preset to use as a source of default values for
options that are not specified explicitly.
options that are not specified explicitly.
* ``dict_size``: Dictionary size in bytes. This should be between 4KiB and
* ``dict_size``: Dictionary size in bytes. This should be between 4
KiB and
1.5GiB (inclusive).
1.5
GiB (inclusive).
* ``lc``: Number of literal context bits.
* ``lc``: Number of literal context bits.
* ``lp``: Number of literal position bits. The sum ``lc + lp`` must be at
* ``lp``: Number of literal position bits. The sum ``lc + lp`` must be at
most 4.
most 4.
...
...
Doc/library/os.rst
View file @
f8def28f
...
@@ -2329,7 +2329,7 @@ These functions are all available on Linux only.
...
@@ -2329,7 +2329,7 @@ These functions are all available on Linux only.
.. data:: XATTR_SIZE_MAX
.. data:: XATTR_SIZE_MAX
The maximum size the value of an extended attribute can be. Currently, this
The maximum size the value of an extended attribute can be. Currently, this
is 64
kilobytes
on Linux.
is 64
KiB
on Linux.
.. data:: XATTR_CREATE
.. data:: XATTR_CREATE
...
...
Doc/library/posix.rst
View file @
f8def28f
...
@@ -37,7 +37,7 @@ Large File Support
...
@@ -37,7 +37,7 @@ Large File Support
.. sectionauthor:: Steve Clift <clift@mail.anacapa.net>
.. sectionauthor:: Steve Clift <clift@mail.anacapa.net>
Several operating systems (including AIX, HP-UX, Irix and Solaris) provide
Several operating systems (including AIX, HP-UX, Irix and Solaris) provide
support for files that are larger than 2 GB from a C programming model where
support for files that are larger than 2 G
i
B from a C programming model where
:c:type:`int` and :c:type:`long` are 32-bit values. This is typically accomplished
:c:type:`int` and :c:type:`long` are 32-bit values. This is typically accomplished
by defining the relevant size and offset types as 64-bit values. Such files are
by defining the relevant size and offset types as 64-bit values. Such files are
sometimes referred to as :dfn:`large files`.
sometimes referred to as :dfn:`large files`.
...
...
Doc/library/tarfile.rst
View file @
f8def28f
...
@@ -669,11 +669,11 @@ There are three tar formats that can be created with the :mod:`tarfile` module:
...
@@ -669,11 +669,11 @@ There are three tar formats that can be created with the :mod:`tarfile` module:
* The POSIX.1-1988 ustar format (:const:`USTAR_FORMAT`). It supports filenames
* The POSIX.1-1988 ustar format (:const:`USTAR_FORMAT`). It supports filenames
up to a length of at best 256 characters and linknames up to 100 characters. The
up to a length of at best 256 characters and linknames up to 100 characters. The
maximum file size is 8
gigabytes
. This is an old and limited but widely
maximum file size is 8
GiB
. This is an old and limited but widely
supported format.
supported format.
* The GNU tar format (:const:`GNU_FORMAT`). It supports long filenames and
* The GNU tar format (:const:`GNU_FORMAT`). It supports long filenames and
linknames, files bigger than 8
gigabytes
and sparse files. It is the de facto
linknames, files bigger than 8
GiB
and sparse files. It is the de facto
standard on GNU/Linux systems. :mod:`tarfile` fully supports the GNU tar
standard on GNU/Linux systems. :mod:`tarfile` fully supports the GNU tar
extensions for long names, sparse file support is read-only.
extensions for long names, sparse file support is read-only.
...
...
Doc/library/threading.rst
View file @
f8def28f
...
@@ -80,15 +80,15 @@ This module defines the following functions:
...
@@ -80,15 +80,15 @@ This module defines the following functions:
Return the thread stack size used when creating new threads. The optional
Return the thread stack size used when creating new threads. The optional
*size* argument specifies the stack size to be used for subsequently created
*size* argument specifies the stack size to be used for subsequently created
threads, and must be 0 (use platform or configured default) or a positive
threads, and must be 0 (use platform or configured default) or a positive
integer value of at least 32,768 (32
k
B). If changing the thread stack size is
integer value of at least 32,768 (32
Ki
B). If changing the thread stack size is
unsupported, a :exc:`RuntimeError` is raised. If the specified stack size is
unsupported, a :exc:`RuntimeError` is raised. If the specified stack size is
invalid, a :exc:`ValueError` is raised and the stack size is unmodified. 32
k
B
invalid, a :exc:`ValueError` is raised and the stack size is unmodified. 32
Ki
B
is currently the minimum supported stack size value to guarantee sufficient
is currently the minimum supported stack size value to guarantee sufficient
stack space for the interpreter itself. Note that some platforms may have
stack space for the interpreter itself. Note that some platforms may have
particular restrictions on values for the stack size, such as requiring a
particular restrictions on values for the stack size, such as requiring a
minimum stack size > 32
k
B or requiring allocation in multiples of the system
minimum stack size > 32
Ki
B or requiring allocation in multiples of the system
memory page size - platform documentation should be referred to for more
memory page size - platform documentation should be referred to for more
information (4
k
B pages are common; using multiples of 4096 for the stack size is
information (4
Ki
B pages are common; using multiples of 4096 for the stack size is
the suggested approach in the absence of more specific information).
the suggested approach in the absence of more specific information).
Availability: Windows, systems with POSIX threads.
Availability: Windows, systems with POSIX threads.
...
...
Doc/library/zipfile.rst
View file @
f8def28f
...
@@ -18,7 +18,7 @@ defined in `PKZIP Application Note
...
@@ -18,7 +18,7 @@ defined in `PKZIP Application Note
This
module
does
not
currently
handle
multi
-
disk
ZIP
files
.
This
module
does
not
currently
handle
multi
-
disk
ZIP
files
.
It
can
handle
ZIP
files
that
use
the
ZIP64
extensions
It
can
handle
ZIP
files
that
use
the
ZIP64
extensions
(
that
is
ZIP
files
that
are
more
than
4
G
Byte
in
size
).
It
supports
(
that
is
ZIP
files
that
are
more
than
4
G
iB
in
size
).
It
supports
decryption
of
encrypted
files
in
ZIP
archives
,
but
it
currently
cannot
decryption
of
encrypted
files
in
ZIP
archives
,
but
it
currently
cannot
create
an
encrypted
file
.
Decryption
is
extremely
slow
as
it
is
create
an
encrypted
file
.
Decryption
is
extremely
slow
as
it
is
implemented
in
native
Python
rather
than
C
.
implemented
in
native
Python
rather
than
C
.
...
@@ -148,7 +148,7 @@ ZipFile Objects
...
@@ -148,7 +148,7 @@ ZipFile Objects
(:mod:`zlib`, :mod:`bz2` or :mod:`lzma`) is not available, :exc:`RuntimeError`
(:mod:`zlib`, :mod:`bz2` or :mod:`lzma`) is not available, :exc:`RuntimeError`
is also raised. The default is :const:`ZIP_STORED`. If *allowZip64* is
is also raised. The default is :const:`ZIP_STORED`. If *allowZip64* is
``True`` zipfile will create ZIP files that use the ZIP64 extensions when
``True`` zipfile will create ZIP files that use the ZIP64 extensions when
the zipfile is larger than 2 GB. If it is false (the default) :mod:`zipfile`
the zipfile is larger than 2 G
i
B. If it is false (the default) :mod:`zipfile`
will raise an exception when the ZIP file would require ZIP64 extensions.
will raise an exception when the ZIP file would require ZIP64 extensions.
ZIP64 extensions are disabled by default because the default :program:`zip`
ZIP64 extensions are disabled by default because the default :program:`zip`
and :program:`unzip` commands on Unix (the InfoZIP utilities) don'
t
support
and :program:`unzip` commands on Unix (the InfoZIP utilities) don'
t
support
...
...
Modules/_pickle.c
View file @
f8def28f
...
@@ -1788,7 +1788,7 @@ save_bytes(PicklerObject *self, PyObject *obj)
...
@@ -1788,7 +1788,7 @@ save_bytes(PicklerObject *self, PyObject *obj)
}
}
else
{
else
{
PyErr_SetString
(
PyExc_OverflowError
,
PyErr_SetString
(
PyExc_OverflowError
,
"cannot serialize a bytes object larger than 4
G
B"
);
"cannot serialize a bytes object larger than 4
Gi
B"
);
return
-
1
;
/* string too large */
return
-
1
;
/* string too large */
}
}
...
@@ -1888,7 +1888,7 @@ save_unicode(PicklerObject *self, PyObject *obj)
...
@@ -1888,7 +1888,7 @@ save_unicode(PicklerObject *self, PyObject *obj)
size
=
PyBytes_GET_SIZE
(
encoded
);
size
=
PyBytes_GET_SIZE
(
encoded
);
if
(
size
>
0xffffffffL
)
{
if
(
size
>
0xffffffffL
)
{
PyErr_SetString
(
PyExc_OverflowError
,
PyErr_SetString
(
PyExc_OverflowError
,
"cannot serialize a string larger than 4
G
B"
);
"cannot serialize a string larger than 4
Gi
B"
);
goto
error
;
/* string too large */
goto
error
;
/* string too large */
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment