List of commits:
Subject Hash Author Date (UTC)
bpo-30052: Link `bytes` & `bytearray` to stdtypes not functions (GH-1271) c6db4811f9ea3aeff0e1fafe1c60a22835ef359e csabella 2017-04-26 05:47:01
bpo-30107: Make SuppressCrashReport quiet on macOS (#1279) d819ad9832292d854e9710493ecdf959b69802e3 Victor Stinner 2017-04-25 22:55:08
bpo:29950: Rename SlotWrapperType to WrapperDescriptorType (GH-926) 08c16016e2a2d1368d001ddebfe9ca92465773c4 Jim Fasarakis-Hilliard 2017-04-25 18:26:36
bpo-28851: Improve namedtuple documentation (GH-1274) 97bf722fcd1de1236824377e052369dc7686b644 csabella 2017-04-25 16:14:45
bpo-29617: Remove Python 3.3 support from asyncio (GH-232) 3e2ad8ec61a322370a6fbdfb2209cf74546f5e08 INADA Naoki 2017-04-25 01:57:18
bpo-30132: distutils test_build_ext() uses temp_cwd() (#1278) f6448e5d65c349576df6e83b8324b9c208e77615 Victor Stinner 2017-04-25 00:11:09
tmtotuple(): use time_t for gmtoff (#1276) 0d659e5614cad512a1940125135b443b3eecb5d7 Victor Stinner 2017-04-24 23:22:42
bpo-30131: Cleanup threads in test_logging (#1275) 4bcfa3a2363c30d406c6826e291b30c33a649d18 Victor Stinner 2017-04-24 22:41:36
bpo-29822: Make inspect.isabstract() work during __init_subclass__. (#678) fcfe80ec2592fed8b3941c79056a8737abef7d3b Nate 2017-04-24 17:06:15
bpo-30144: Import collections ABC from collections.abc rather than collections. (#1263) 2e576f5aec1f8f23f07001e2eb3db9276851a4fc Serhiy Storchaka 2017-04-24 06:05:00
bpo-29751: add Cheryl Sabella to Misc/ACKS (GH-1268) 9eb5ca0774f94215be48442100c829db2484e146 Mariatta 2017-04-24 04:05:19
bpo-29751: Improve PyLong_FromString documentation (GH-915) 26896f2832324dde85cdd63d525571ca669f6f0b csabella 2017-04-24 03:54:08
bpo-15718: Document the upper bound constrain on the __len__ return value. (#1256) 85157cd89a6edac347a5b6871fcf20c500c6fbbf Serhiy Storchaka 2017-04-23 05:37:58
Remove outdated note about constraining of the bit shift right operand. (#1258) 997a4adea606069e01beac6269920709db3994d1 Serhiy Storchaka 2017-04-22 18:50:09
Fix trailing colon and newline in test.rst (#1250) 7fae81e1672d0b4110d31ea6a765b54f63a2e54b Louie Lu 2017-04-22 06:46:18
Remove unneeded Misc/NEWS entry for bpo-29802. (#1251) 7bfd740e3d484e6fdf3f5c2d4640450957f9d89c Serhiy Storchaka 2017-04-22 06:24:59
bpo-29960 _random.Random corrupted on exception in setstate(). (#1019) 9616a82e7802241a4b74cf7ae38d43c37bf66e48 bladebryan 2017-04-22 06:10:46
bpo-29867: Add asserts in PyTuple_GET_SIZE, PyList_GET_SIZE and PySet_GET_SIZE. (#751) 1a5856bf9295fa73995898d576e0bedf016aee1f Serhiy Storchaka 2017-04-21 23:48:11
bpo-30125: disable faulthandler in ctypes test_SEH (#1237) a36e939aeb3b5a2c56561eb24f0e339eee9f3f9d Victor Stinner 2017-04-21 22:31:13
bpo-30098: Clarify that run_coroutine_threadsafe expects asyncio.Future (GH-1170) ae5b3260dd459845aad8a30491b76d471577785d Charles Renwick 2017-04-21 20:49:48
Commit c6db4811f9ea3aeff0e1fafe1c60a22835ef359e - bpo-30052: Link `bytes` & `bytearray` to stdtypes not functions (GH-1271)
Builtin container types have two potential link targets in the docs:

- their entry in the list of builtin callables
- their type documentation

This change brings `bytes` and `bytearray` into line with other
container types by having cross-references default to linking to
their type documentation, rather than their builtin callable entry.
Author: csabella
Author date (UTC): 2017-04-26 05:47
Committer name: Nick Coghlan
Committer date (UTC): 2017-04-26 05:47
Parent(s): d819ad9832292d854e9710493ecdf959b69802e3
Signer:
Signing key:
Signing status: N
Tree: b27d11afad8a52fc60ce80108279e67c1a59539c
File Lines added Lines deleted
Doc/library/functions.rst 6 3
Doc/library/stdtypes.rst 84 78
Doc/reference/datamodel.rst 8 8
File Doc/library/functions.rst changed (mode: 100644) (index 138f7d027c..6621f4aabf)
... ... are always available. They are listed here in alphabetical order.
16 16 :func:`ascii` :func:`enumerate` :func:`input` :func:`oct` :func:`staticmethod` :func:`ascii` :func:`enumerate` :func:`input` :func:`oct` :func:`staticmethod`
17 17 :func:`bin` :func:`eval` :func:`int` :func:`open` |func-str|_ :func:`bin` :func:`eval` :func:`int` :func:`open` |func-str|_
18 18 :func:`bool` :func:`exec` :func:`isinstance` :func:`ord` :func:`sum` :func:`bool` :func:`exec` :func:`isinstance` :func:`ord` :func:`sum`
19 :func:`bytearray` :func:`filter` :func:`issubclass` :func:`pow` :func:`super`
20 :func:`bytes` :func:`float` :func:`iter` :func:`print` |func-tuple|_
19 |func-bytearray|_ :func:`filter` :func:`issubclass` :func:`pow` :func:`super`
20 |func-bytes|_ :func:`float` :func:`iter` :func:`print` |func-tuple|_
21 21 :func:`callable` :func:`format` :func:`len` :func:`property` :func:`type` :func:`callable` :func:`format` :func:`len` :func:`property` :func:`type`
22 22 :func:`chr` |func-frozenset|_ |func-list|_ |func-range|_ :func:`vars` :func:`chr` |func-frozenset|_ |func-list|_ |func-range|_ :func:`vars`
23 23 :func:`classmethod` :func:`getattr` :func:`locals` :func:`repr` :func:`zip` :func:`classmethod` :func:`getattr` :func:`locals` :func:`repr` :func:`zip`
 
... ... are always available. They are listed here in alphabetical order.
37 37 .. |func-str| replace:: ``str()`` .. |func-str| replace:: ``str()``
38 38 .. |func-tuple| replace:: ``tuple()`` .. |func-tuple| replace:: ``tuple()``
39 39 .. |func-range| replace:: ``range()`` .. |func-range| replace:: ``range()``
40
40 .. |func-bytearray| replace:: ``bytearray()``
41 .. |func-bytes| replace:: ``bytes()``
41 42
42 43 .. function:: abs(x) .. function:: abs(x)
43 44
 
... ... are always available. They are listed here in alphabetical order.
99 100
100 101 .. _func-bytearray: .. _func-bytearray:
101 102 .. class:: bytearray([source[, encoding[, errors]]]) .. class:: bytearray([source[, encoding[, errors]]])
103 :noindex:
102 104
103 105 Return a new array of bytes. The :class:`bytearray` class is a mutable Return a new array of bytes. The :class:`bytearray` class is a mutable
104 106 sequence of integers in the range 0 <= x < 256. It has most of the usual sequence of integers in the range 0 <= x < 256. It has most of the usual
 
... ... are always available. They are listed here in alphabetical order.
128 130
129 131 .. _func-bytes: .. _func-bytes:
130 132 .. class:: bytes([source[, encoding[, errors]]]) .. class:: bytes([source[, encoding[, errors]]])
133 :noindex:
131 134
132 135 Return a new "bytes" object, which is an immutable sequence of integers in Return a new "bytes" object, which is an immutable sequence of integers in
133 136 the range ``0 <= x < 256``. :class:`bytes` is an immutable version of the range ``0 <= x < 256``. :class:`bytes` is an immutable version of
File Doc/library/stdtypes.rst changed (mode: 100644) (index a9877ba666..552d7fc7c3)
... ... The :mod:`array` module supports efficient storage of basic data types like
2265 2265
2266 2266 .. _typebytes: .. _typebytes:
2267 2267
2268 Bytes
2269 -----
2268 Bytes Objects
2269 -------------
2270 2270
2271 2271 .. index:: object: bytes .. index:: object: bytes
2272 2272
 
... ... binary protocols are based on the ASCII text encoding, bytes objects offer
2275 2275 several methods that are only valid when working with ASCII compatible several methods that are only valid when working with ASCII compatible
2276 2276 data and are closely related to string objects in a variety of other ways. data and are closely related to string objects in a variety of other ways.
2277 2277
2278 Firstly, the syntax for bytes literals is largely the same as that for string
2279 literals, except that a ``b`` prefix is added:
2278 .. class:: bytes([source[, encoding[, errors]]])
2280 2279
2281 * Single quotes: ``b'still allows embedded "double" quotes'``
2282 * Double quotes: ``b"still allows embedded 'single' quotes"``.
2283 * Triple quoted: ``b'''3 single quotes'''``, ``b"""3 double quotes"""``
2280 Firstly, the syntax for bytes literals is largely the same as that for string
2281 literals, except that a ``b`` prefix is added:
2284 2282
2285 Only ASCII characters are permitted in bytes literals (regardless of the
2286 declared source code encoding). Any binary values over 127 must be entered
2287 into bytes literals using the appropriate escape sequence.
2283 * Single quotes: ``b'still allows embedded "double" quotes'``
2284 * Double quotes: ``b"still allows embedded 'single' quotes"``.
2285 * Triple quoted: ``b'''3 single quotes'''``, ``b"""3 double quotes"""``
2288 2286
2289 As with string literals, bytes literals may also use a ``r`` prefix to disable
2290 processing of escape sequences. See :ref:`strings` for more about the various
2291 forms of bytes literal, including supported escape sequences.
2287 Only ASCII characters are permitted in bytes literals (regardless of the
2288 declared source code encoding). Any binary values over 127 must be entered
2289 into bytes literals using the appropriate escape sequence.
2292 2290
2293 While bytes literals and representations are based on ASCII text, bytes
2294 objects actually behave like immutable sequences of integers, with each
2295 value in the sequence restricted such that ``0 <= x < 256`` (attempts to
2296 violate this restriction will trigger :exc:`ValueError`. This is done
2297 deliberately to emphasise that while many binary formats include ASCII based
2298 elements and can be usefully manipulated with some text-oriented algorithms,
2299 this is not generally the case for arbitrary binary data (blindly applying
2300 text processing algorithms to binary data formats that are not ASCII
2301 compatible will usually lead to data corruption).
2291 As with string literals, bytes literals may also use a ``r`` prefix to disable
2292 processing of escape sequences. See :ref:`strings` for more about the various
2293 forms of bytes literal, including supported escape sequences.
2302 2294
2303 In addition to the literal forms, bytes objects can be created in a number of
2304 other ways:
2295 While bytes literals and representations are based on ASCII text, bytes
2296 objects actually behave like immutable sequences of integers, with each
2297 value in the sequence restricted such that ``0 <= x < 256`` (attempts to
2298 violate this restriction will trigger :exc:`ValueError`. This is done
2299 deliberately to emphasise that while many binary formats include ASCII based
2300 elements and can be usefully manipulated with some text-oriented algorithms,
2301 this is not generally the case for arbitrary binary data (blindly applying
2302 text processing algorithms to binary data formats that are not ASCII
2303 compatible will usually lead to data corruption).
2305 2304
2306 * A zero-filled bytes object of a specified length: ``bytes(10)``
2307 * From an iterable of integers: ``bytes(range(20))``
2308 * Copying existing binary data via the buffer protocol: ``bytes(obj)``
2305 In addition to the literal forms, bytes objects can be created in a number of
2306 other ways:
2309 2307
2310 Also see the :ref:`bytes <func-bytes>` built-in.
2308 * A zero-filled bytes object of a specified length: ``bytes(10)``
2309 * From an iterable of integers: ``bytes(range(20))``
2310 * Copying existing binary data via the buffer protocol: ``bytes(obj)``
2311 2311
2312 Since 2 hexadecimal digits correspond precisely to a single byte, hexadecimal
2313 numbers are a commonly used format for describing binary data. Accordingly,
2314 the bytes type has an additional class method to read data in that format:
2312 Also see the :ref:`bytes <func-bytes>` built-in.
2315 2313
2316 .. classmethod:: bytes.fromhex(string)
2314 Since 2 hexadecimal digits correspond precisely to a single byte, hexadecimal
2315 numbers are a commonly used format for describing binary data. Accordingly,
2316 the bytes type has an additional class method to read data in that format:
2317 2317
2318 This :class:`bytes` class method returns a bytes object, decoding the
2319 given string object. The string must contain two hexadecimal digits per
2320 byte, with ASCII whitespace being ignored.
2318 .. classmethod:: fromhex(string)
2321 2319
2322 >>> bytes.fromhex('2Ef0 F1f2 ')
2323 b'.\xf0\xf1\xf2'
2320 This :class:`bytes` class method returns a bytes object, decoding the
2321 given string object. The string must contain two hexadecimal digits per
2322 byte, with ASCII whitespace being ignored.
2324 2323
2325 .. versionchanged:: 3.7
2326 :meth:`bytes.fromhex` now skips all ASCII whitespace in the string,
2327 not just spaces.
2324 >>> bytes.fromhex('2Ef0 F1f2 ')
2325 b'.\xf0\xf1\xf2'
2328 2326
2329 A reverse conversion function exists to transform a bytes object into its
2330 hexadecimal representation.
2327 .. versionchanged:: 3.7
2328 :meth:`bytes.fromhex` now skips all ASCII whitespace in the string,
2329 not just spaces.
2331 2330
2332 .. method:: bytes.hex()
2331 A reverse conversion function exists to transform a bytes object into its
2332 hexadecimal representation.
2333 2333
2334 Return a string object containing two hexadecimal digits for each
2335 byte in the instance.
2334 .. method:: hex()
2336 2335
2337 >>> b'\xf0\xf1\xf2'.hex()
2338 'f0f1f2'
2336 Return a string object containing two hexadecimal digits for each
2337 byte in the instance.
2339 2338
2340 .. versionadded:: 3.5
2339 >>> b'\xf0\xf1\xf2'.hex()
2340 'f0f1f2'
2341
2342 .. versionadded:: 3.5
2341 2343
2342 2344 Since bytes objects are sequences of integers (akin to a tuple), for a bytes Since bytes objects are sequences of integers (akin to a tuple), for a bytes
2343 2345 object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be a bytes object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be a bytes
 
... ... Bytearray Objects
2367 2369 .. index:: object: bytearray .. index:: object: bytearray
2368 2370
2369 2371 :class:`bytearray` objects are a mutable counterpart to :class:`bytes` :class:`bytearray` objects are a mutable counterpart to :class:`bytes`
2370 objects. There is no dedicated literal syntax for bytearray objects, instead
2371 they are always created by calling the constructor:
2372 objects.
2372 2373
2373 * Creating an empty instance: ``bytearray()``
2374 * Creating a zero-filled instance with a given length: ``bytearray(10)``
2375 * From an iterable of integers: ``bytearray(range(20))``
2376 * Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``
2374 .. class:: bytearray([source[, encoding[, errors]]])
2377 2375
2378 As bytearray objects are mutable, they support the
2379 :ref:`mutable <typesseq-mutable>` sequence operations in addition to the
2380 common bytes and bytearray operations described in :ref:`bytes-methods`.
2376 There is no dedicated literal syntax for bytearray objects, instead
2377 they are always created by calling the constructor:
2381 2378
2382 Also see the :ref:`bytearray <func-bytearray>` built-in.
2379 * Creating an empty instance: ``bytearray()``
2380 * Creating a zero-filled instance with a given length: ``bytearray(10)``
2381 * From an iterable of integers: ``bytearray(range(20))``
2382 * Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``
2383 2383
2384 Since 2 hexadecimal digits correspond precisely to a single byte, hexadecimal
2385 numbers are a commonly used format for describing binary data. Accordingly,
2386 the bytearray type has an additional class method to read data in that format:
2384 As bytearray objects are mutable, they support the
2385 :ref:`mutable <typesseq-mutable>` sequence operations in addition to the
2386 common bytes and bytearray operations described in :ref:`bytes-methods`.
2387 2387
2388 .. classmethod:: bytearray.fromhex(string)
2388 Also see the :ref:`bytearray <func-bytearray>` built-in.
2389 2389
2390 This :class:`bytearray` class method returns bytearray object, decoding
2391 the given string object. The string must contain two hexadecimal digits
2392 per byte, with ASCII whitespace being ignored.
2390 Since 2 hexadecimal digits correspond precisely to a single byte, hexadecimal
2391 numbers are a commonly used format for describing binary data. Accordingly,
2392 the bytearray type has an additional class method to read data in that format:
2393 2393
2394 >>> bytearray.fromhex('2Ef0 F1f2 ')
2395 bytearray(b'.\xf0\xf1\xf2')
2394 .. classmethod:: fromhex(string)
2396 2395
2397 .. versionchanged:: 3.7
2398 :meth:`bytearray.fromhex` now skips all ASCII whitespace in the string,
2399 not just spaces.
2396 This :class:`bytearray` class method returns bytearray object, decoding
2397 the given string object. The string must contain two hexadecimal digits
2398 per byte, with ASCII whitespace being ignored.
2400 2399
2401 A reverse conversion function exists to transform a bytearray object into its
2402 hexadecimal representation.
2400 >>> bytearray.fromhex('2Ef0 F1f2 ')
2401 bytearray(b'.\xf0\xf1\xf2')
2403 2402
2404 .. method:: bytearray.hex()
2403 .. versionchanged:: 3.7
2404 :meth:`bytearray.fromhex` now skips all ASCII whitespace in the string,
2405 not just spaces.
2405 2406
2406 Return a string object containing two hexadecimal digits for each
2407 byte in the instance.
2407 A reverse conversion function exists to transform a bytearray object into its
2408 hexadecimal representation.
2408 2409
2409 >>> bytearray(b'\xf0\xf1\xf2').hex()
2410 'f0f1f2'
2410 .. method:: hex()
2411
2412 Return a string object containing two hexadecimal digits for each
2413 byte in the instance.
2411 2414
2412 .. versionadded:: 3.5
2415 >>> bytearray(b'\xf0\xf1\xf2').hex()
2416 'f0f1f2'
2417
2418 .. versionadded:: 3.5
2413 2419
2414 2420 Since bytearray objects are sequences of integers (akin to a list), for a Since bytearray objects are sequences of integers (akin to a list), for a
2415 2421 bytearray object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be bytearray object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be
File Doc/reference/datamodel.rst changed (mode: 100644) (index 058fa90e16..4b49bfd78d)
... ... Sequences
320 320
321 321 A bytes object is an immutable array. The items are 8-bit bytes, A bytes object is an immutable array. The items are 8-bit bytes,
322 322 represented by integers in the range 0 <= x < 256. Bytes literals represented by integers in the range 0 <= x < 256. Bytes literals
323 (like ``b'abc'``) and the built-in function :func:`bytes` can be used to
324 construct bytes objects. Also, bytes objects can be decoded to strings
325 via the :meth:`~bytes.decode` method.
323 (like ``b'abc'``) and the built-in :func:`bytes()` constructor
324 can be used to create bytes objects. Also, bytes objects can be
325 decoded to strings via the :meth:`~bytes.decode` method.
326 326
327 327 Mutable sequences Mutable sequences
328 328 .. index:: .. index::
 
... ... Sequences
349 349 .. index:: bytearray .. index:: bytearray
350 350
351 351 A bytearray object is a mutable array. They are created by the built-in A bytearray object is a mutable array. They are created by the built-in
352 :func:`bytearray` constructor. Aside from being mutable (and hence
353 unhashable), byte arrays otherwise provide the same interface and
354 functionality as immutable bytes objects.
352 :func:`bytearray` constructor. Aside from being mutable
353 (and hence unhashable), byte arrays otherwise provide the same interface
354 and functionality as immutable :class:`bytes` objects.
355 355
356 356 .. index:: module: array .. index:: module: array
357 357
 
... ... Basic customization
1253 1253
1254 1254 .. index:: builtin: bytes .. index:: builtin: bytes
1255 1255
1256 Called by :func:`bytes` to compute a byte-string representation of an
1257 object. This should return a ``bytes`` object.
1256 Called by :ref:`bytes <func-bytes>` to compute a byte-string representation
1257 of an object. This should return a :class:`bytes` object.
1258 1258
1259 1259 .. index:: .. index::
1260 1260 single: string; __format__() (object method) single: string; __format__() (object method)
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/benf_wspdigital/cpython

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/benf_wspdigital/cpython

Clone this repository using git:
git clone git://git.rocketgit.com/user/benf_wspdigital/cpython

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main