bytearray.html 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
  6. <meta property="og:title" content="Byte Array Objects" />
  7. <meta property="og:type" content="website" />
  8. <meta property="og:url" content="https://docs.python.org/3/c-api/bytearray.html" />
  9. <meta property="og:site_name" content="Python documentation" />
  10. <meta property="og:description" content="Type check macros: Direct API functions: Macros: These macros trade safety for speed and they don’t check pointers." />
  11. <meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
  12. <meta property="og:image:alt" content="Python documentation" />
  13. <meta name="description" content="Type check macros: Direct API functions: Macros: These macros trade safety for speed and they don’t check pointers." />
  14. <meta property="og:image:width" content="200" />
  15. <meta property="og:image:height" content="200" />
  16. <meta name="theme-color" content="#3776ab" />
  17. <title>Byte Array Objects &#8212; Python 3.12.0 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
  18. <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
  19. <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?digest=b37c26da2f7529d09fe70b41c4b2133fe4931a90" />
  20. <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css" />
  21. <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
  22. <script src="../_static/jquery.js"></script>
  23. <script src="../_static/underscore.js"></script>
  24. <script src="../_static/doctools.js"></script>
  25. <script src="../_static/sidebar.js"></script>
  26. <link rel="search" type="application/opensearchdescription+xml"
  27. title="Search within Python 3.12.0 documentation"
  28. href="../_static/opensearch.xml"/>
  29. <link rel="author" title="About these documents" href="../about.html" />
  30. <link rel="index" title="Index" href="../genindex.html" />
  31. <link rel="search" title="Search" href="../search.html" />
  32. <link rel="copyright" title="Copyright" href="../copyright.html" />
  33. <link rel="next" title="Unicode Objects and Codecs" href="unicode.html" />
  34. <link rel="prev" title="Bytes Objects" href="bytes.html" />
  35. <link rel="canonical" href="https://docs.python.org/3/c-api/bytearray.html" />
  36. <style>
  37. @media only screen {
  38. table.full-width-table {
  39. width: 100%;
  40. }
  41. }
  42. </style>
  43. <link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
  44. <link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
  45. <script type="text/javascript" src="../_static/copybutton.js"></script>
  46. <script type="text/javascript" src="../_static/menu.js"></script>
  47. <script type="text/javascript" src="../_static/themetoggle.js"></script>
  48. </head>
  49. <body>
  50. <div class="mobile-nav">
  51. <input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
  52. aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
  53. <nav class="nav-content" role="navigation">
  54. <label for="menuToggler" class="toggler__label">
  55. <span></span>
  56. </label>
  57. <span class="nav-items-wrapper">
  58. <a href="https://www.python.org/" class="nav-logo">
  59. <img src="../_static/py.svg" alt="Logo"/>
  60. </a>
  61. <span class="version_switcher_placeholder"></span>
  62. <form role="search" class="search" action="../search.html" method="get">
  63. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
  64. <path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
  65. </svg>
  66. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
  67. <input type="submit" value="Go"/>
  68. </form>
  69. </span>
  70. </nav>
  71. <div class="menu-wrapper">
  72. <nav class="menu" role="navigation" aria-label="main navigation">
  73. <div class="language_switcher_placeholder"></div>
  74. <label class="theme-selector-label">
  75. Theme
  76. <select class="theme-selector" oninput="activateTheme(this.value)">
  77. <option value="auto" selected>Auto</option>
  78. <option value="light">Light</option>
  79. <option value="dark">Dark</option>
  80. </select>
  81. </label>
  82. <div>
  83. <h3><a href="../contents.html">Table of Contents</a></h3>
  84. <ul>
  85. <li><a class="reference internal" href="#">Byte Array Objects</a><ul>
  86. <li><a class="reference internal" href="#type-check-macros">Type check macros</a></li>
  87. <li><a class="reference internal" href="#direct-api-functions">Direct API functions</a></li>
  88. <li><a class="reference internal" href="#macros">Macros</a></li>
  89. </ul>
  90. </li>
  91. </ul>
  92. </div>
  93. <div>
  94. <h4>Previous topic</h4>
  95. <p class="topless"><a href="bytes.html"
  96. title="previous chapter">Bytes Objects</a></p>
  97. </div>
  98. <div>
  99. <h4>Next topic</h4>
  100. <p class="topless"><a href="unicode.html"
  101. title="next chapter">Unicode Objects and Codecs</a></p>
  102. </div>
  103. <div role="note" aria-label="source link">
  104. <h3>This Page</h3>
  105. <ul class="this-page-menu">
  106. <li><a href="../bugs.html">Report a Bug</a></li>
  107. <li>
  108. <a href="https://github.com/python/cpython/blob/main/Doc/c-api/bytearray.rst"
  109. rel="nofollow">Show Source
  110. </a>
  111. </li>
  112. </ul>
  113. </div>
  114. </nav>
  115. </div>
  116. </div>
  117. <div class="related" role="navigation" aria-label="related navigation">
  118. <h3>Navigation</h3>
  119. <ul>
  120. <li class="right" style="margin-right: 10px">
  121. <a href="../genindex.html" title="General Index"
  122. accesskey="I">index</a></li>
  123. <li class="right" >
  124. <a href="../py-modindex.html" title="Python Module Index"
  125. >modules</a> |</li>
  126. <li class="right" >
  127. <a href="unicode.html" title="Unicode Objects and Codecs"
  128. accesskey="N">next</a> |</li>
  129. <li class="right" >
  130. <a href="bytes.html" title="Bytes Objects"
  131. accesskey="P">previous</a> |</li>
  132. <li><img src="../_static/py.svg" alt="python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  133. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  134. <li class="switchers">
  135. <div class="language_switcher_placeholder"></div>
  136. <div class="version_switcher_placeholder"></div>
  137. </li>
  138. <li>
  139. </li>
  140. <li id="cpython-language-and-version">
  141. <a href="../index.html">3.12.0 Documentation</a> &#187;
  142. </li>
  143. <li class="nav-item nav-item-1"><a href="index.html" >Python/C API Reference Manual</a> &#187;</li>
  144. <li class="nav-item nav-item-2"><a href="concrete.html" accesskey="U">Concrete Objects Layer</a> &#187;</li>
  145. <li class="nav-item nav-item-this"><a href="">Byte Array Objects</a></li>
  146. <li class="right">
  147. <div class="inline-search" role="search">
  148. <form class="inline-search" action="../search.html" method="get">
  149. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
  150. <input type="submit" value="Go" />
  151. </form>
  152. </div>
  153. |
  154. </li>
  155. <li class="right">
  156. <label class="theme-selector-label">
  157. Theme
  158. <select class="theme-selector" oninput="activateTheme(this.value)">
  159. <option value="auto" selected>Auto</option>
  160. <option value="light">Light</option>
  161. <option value="dark">Dark</option>
  162. </select>
  163. </label> |</li>
  164. </ul>
  165. </div>
  166. <div class="document">
  167. <div class="documentwrapper">
  168. <div class="bodywrapper">
  169. <div class="body" role="main">
  170. <section id="byte-array-objects">
  171. <span id="bytearrayobjects"></span><h1>Byte Array Objects<a class="headerlink" href="#byte-array-objects" title="Permalink to this headline">¶</a></h1>
  172. <span class="target" id="index-0"></span><dl class="c type">
  173. <dt class="sig sig-object c" id="c.PyByteArrayObject">
  174. <span class="k"><span class="pre">type</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">PyByteArrayObject</span></span></span><a class="headerlink" href="#c.PyByteArrayObject" title="Permalink to this definition">¶</a><br /></dt>
  175. <dd><p>This subtype of <a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><code class="xref c c-type docutils literal notranslate"><span class="pre">PyObject</span></code></a> represents a Python bytearray object.</p>
  176. </dd></dl>
  177. <dl class="c var">
  178. <dt class="sig sig-object c" id="c.PyByteArray_Type">
  179. <a class="reference internal" href="type.html#c.PyTypeObject" title="PyTypeObject"><span class="n"><span class="pre">PyTypeObject</span></span></a><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">PyByteArray_Type</span></span></span><a class="headerlink" href="#c.PyByteArray_Type" title="Permalink to this definition">¶</a><br /></dt>
  180. <dd><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>This instance of <a class="reference internal" href="type.html#c.PyTypeObject" title="PyTypeObject"><code class="xref c c-type docutils literal notranslate"><span class="pre">PyTypeObject</span></code></a> represents the Python bytearray type;
  181. it is the same object as <a class="reference internal" href="../library/stdtypes.html#bytearray" title="bytearray"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></a> in the Python layer.</p>
  182. </dd></dl>
  183. <section id="type-check-macros">
  184. <h2>Type check macros<a class="headerlink" href="#type-check-macros" title="Permalink to this headline">¶</a></h2>
  185. <dl class="c function">
  186. <dt class="sig sig-object c" id="c.PyByteArray_Check">
  187. <span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">PyByteArray_Check</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">o</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_Check" title="Permalink to this definition">¶</a><br /></dt>
  188. <dd><p>Return true if the object <em>o</em> is a bytearray object or an instance of a
  189. subtype of the bytearray type. This function always succeeds.</p>
  190. </dd></dl>
  191. <dl class="c function">
  192. <dt class="sig sig-object c" id="c.PyByteArray_CheckExact">
  193. <span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">PyByteArray_CheckExact</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">o</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_CheckExact" title="Permalink to this definition">¶</a><br /></dt>
  194. <dd><p>Return true if the object <em>o</em> is a bytearray object, but not an instance of a
  195. subtype of the bytearray type. This function always succeeds.</p>
  196. </dd></dl>
  197. </section>
  198. <section id="direct-api-functions">
  199. <h2>Direct API functions<a class="headerlink" href="#direct-api-functions" title="Permalink to this headline">¶</a></h2>
  200. <dl class="c function">
  201. <dt class="sig sig-object c" id="c.PyByteArray_FromObject">
  202. <a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">PyByteArray_FromObject</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">o</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_FromObject" title="Permalink to this definition">¶</a><br /></dt>
  203. <dd><em class="refcount">Return value: New reference.</em><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Return a new bytearray object from any object, <em>o</em>, that implements the
  204. <a class="reference internal" href="buffer.html#bufferobjects"><span class="std std-ref">buffer protocol</span></a>.</p>
  205. </dd></dl>
  206. <dl class="c function">
  207. <dt class="sig sig-object c" id="c.PyByteArray_FromStringAndSize">
  208. <a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">PyByteArray_FromStringAndSize</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">string</span></span>, <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><span class="n"><span class="pre">Py_ssize_t</span></span></a><span class="w"> </span><span class="n"><span class="pre">len</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_FromStringAndSize" title="Permalink to this definition">¶</a><br /></dt>
  209. <dd><em class="refcount">Return value: New reference.</em><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Create a new bytearray object from <em>string</em> and its length, <em>len</em>. On
  210. failure, <code class="docutils literal notranslate"><span class="pre">NULL</span></code> is returned.</p>
  211. </dd></dl>
  212. <dl class="c function">
  213. <dt class="sig sig-object c" id="c.PyByteArray_Concat">
  214. <a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">PyByteArray_Concat</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">a</span></span>, <a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">b</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_Concat" title="Permalink to this definition">¶</a><br /></dt>
  215. <dd><em class="refcount">Return value: New reference.</em><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Concat bytearrays <em>a</em> and <em>b</em> and return a new bytearray with the result.</p>
  216. </dd></dl>
  217. <dl class="c function">
  218. <dt class="sig sig-object c" id="c.PyByteArray_Size">
  219. <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><span class="n"><span class="pre">Py_ssize_t</span></span></a><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">PyByteArray_Size</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">bytearray</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_Size" title="Permalink to this definition">¶</a><br /></dt>
  220. <dd><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Return the size of <em>bytearray</em> after checking for a <code class="docutils literal notranslate"><span class="pre">NULL</span></code> pointer.</p>
  221. </dd></dl>
  222. <dl class="c function">
  223. <dt class="sig sig-object c" id="c.PyByteArray_AsString">
  224. <span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">PyByteArray_AsString</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">bytearray</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_AsString" title="Permalink to this definition">¶</a><br /></dt>
  225. <dd><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Return the contents of <em>bytearray</em> as a char array after checking for a
  226. <code class="docutils literal notranslate"><span class="pre">NULL</span></code> pointer. The returned array always has an extra
  227. null byte appended.</p>
  228. </dd></dl>
  229. <dl class="c function">
  230. <dt class="sig sig-object c" id="c.PyByteArray_Resize">
  231. <span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">PyByteArray_Resize</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">bytearray</span></span>, <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><span class="n"><span class="pre">Py_ssize_t</span></span></a><span class="w"> </span><span class="n"><span class="pre">len</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_Resize" title="Permalink to this definition">¶</a><br /></dt>
  232. <dd><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Resize the internal buffer of <em>bytearray</em> to <em>len</em>.</p>
  233. </dd></dl>
  234. </section>
  235. <section id="macros">
  236. <h2>Macros<a class="headerlink" href="#macros" title="Permalink to this headline">¶</a></h2>
  237. <p>These macros trade safety for speed and they don’t check pointers.</p>
  238. <dl class="c function">
  239. <dt class="sig sig-object c" id="c.PyByteArray_AS_STRING">
  240. <span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">PyByteArray_AS_STRING</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">bytearray</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_AS_STRING" title="Permalink to this definition">¶</a><br /></dt>
  241. <dd><p>Similar to <a class="reference internal" href="#c.PyByteArray_AsString" title="PyByteArray_AsString"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyByteArray_AsString()</span></code></a>, but without error checking.</p>
  242. </dd></dl>
  243. <dl class="c function">
  244. <dt class="sig sig-object c" id="c.PyByteArray_GET_SIZE">
  245. <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><span class="n"><span class="pre">Py_ssize_t</span></span></a><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">PyByteArray_GET_SIZE</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">bytearray</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_GET_SIZE" title="Permalink to this definition">¶</a><br /></dt>
  246. <dd><p>Similar to <a class="reference internal" href="#c.PyByteArray_Size" title="PyByteArray_Size"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyByteArray_Size()</span></code></a>, but without error checking.</p>
  247. </dd></dl>
  248. </section>
  249. </section>
  250. <div class="clearer"></div>
  251. </div>
  252. </div>
  253. </div>
  254. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  255. <div class="sphinxsidebarwrapper">
  256. <div>
  257. <h3><a href="../contents.html">Table of Contents</a></h3>
  258. <ul>
  259. <li><a class="reference internal" href="#">Byte Array Objects</a><ul>
  260. <li><a class="reference internal" href="#type-check-macros">Type check macros</a></li>
  261. <li><a class="reference internal" href="#direct-api-functions">Direct API functions</a></li>
  262. <li><a class="reference internal" href="#macros">Macros</a></li>
  263. </ul>
  264. </li>
  265. </ul>
  266. </div>
  267. <div>
  268. <h4>Previous topic</h4>
  269. <p class="topless"><a href="bytes.html"
  270. title="previous chapter">Bytes Objects</a></p>
  271. </div>
  272. <div>
  273. <h4>Next topic</h4>
  274. <p class="topless"><a href="unicode.html"
  275. title="next chapter">Unicode Objects and Codecs</a></p>
  276. </div>
  277. <div role="note" aria-label="source link">
  278. <h3>This Page</h3>
  279. <ul class="this-page-menu">
  280. <li><a href="../bugs.html">Report a Bug</a></li>
  281. <li>
  282. <a href="https://github.com/python/cpython/blob/main/Doc/c-api/bytearray.rst"
  283. rel="nofollow">Show Source
  284. </a>
  285. </li>
  286. </ul>
  287. </div>
  288. </div>
  289. </div>
  290. <div class="clearer"></div>
  291. </div>
  292. <div class="related" role="navigation" aria-label="related navigation">
  293. <h3>Navigation</h3>
  294. <ul>
  295. <li class="right" style="margin-right: 10px">
  296. <a href="../genindex.html" title="General Index"
  297. >index</a></li>
  298. <li class="right" >
  299. <a href="../py-modindex.html" title="Python Module Index"
  300. >modules</a> |</li>
  301. <li class="right" >
  302. <a href="unicode.html" title="Unicode Objects and Codecs"
  303. >next</a> |</li>
  304. <li class="right" >
  305. <a href="bytes.html" title="Bytes Objects"
  306. >previous</a> |</li>
  307. <li><img src="../_static/py.svg" alt="python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  308. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  309. <li class="switchers">
  310. <div class="language_switcher_placeholder"></div>
  311. <div class="version_switcher_placeholder"></div>
  312. </li>
  313. <li>
  314. </li>
  315. <li id="cpython-language-and-version">
  316. <a href="../index.html">3.12.0 Documentation</a> &#187;
  317. </li>
  318. <li class="nav-item nav-item-1"><a href="index.html" >Python/C API Reference Manual</a> &#187;</li>
  319. <li class="nav-item nav-item-2"><a href="concrete.html" >Concrete Objects Layer</a> &#187;</li>
  320. <li class="nav-item nav-item-this"><a href="">Byte Array Objects</a></li>
  321. <li class="right">
  322. <div class="inline-search" role="search">
  323. <form class="inline-search" action="../search.html" method="get">
  324. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
  325. <input type="submit" value="Go" />
  326. </form>
  327. </div>
  328. |
  329. </li>
  330. <li class="right">
  331. <label class="theme-selector-label">
  332. Theme
  333. <select class="theme-selector" oninput="activateTheme(this.value)">
  334. <option value="auto" selected>Auto</option>
  335. <option value="light">Light</option>
  336. <option value="dark">Dark</option>
  337. </select>
  338. </label> |</li>
  339. </ul>
  340. </div>
  341. <div class="footer">
  342. &copy; <a href="../copyright.html">Copyright</a> 2001-2023, Python Software Foundation.
  343. <br />
  344. This page is licensed under the Python Software Foundation License Version 2.
  345. <br />
  346. Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
  347. <br />
  348. See <a href="/license.html">History and License</a> for more information.<br />
  349. <br />
  350. The Python Software Foundation is a non-profit corporation.
  351. <a href="https://www.python.org/psf/donations/">Please donate.</a>
  352. <br />
  353. <br />
  354. Last updated on Oct 02, 2023.
  355. <a href="/bugs.html">Found a bug</a>?
  356. <br />
  357. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.5.0.
  358. </div>
  359. </body>
  360. </html>