gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

444 lines
27KB

  1. <!DOCTYPE html>
  2. <html lang="en" data-content_root="../">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <meta property="og:title" content="atexit — Exit handlers" />
  7. <meta property="og:type" content="website" />
  8. <meta property="og:url" content="https://docs.python.org/3/library/atexit.html" />
  9. <meta property="og:site_name" content="Python documentation" />
  10. <meta property="og:description" content="The atexit module defines functions to register and unregister cleanup functions. Functions thus registered are automatically executed upon normal interpreter termination. atexit runs these functio..." />
  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="The atexit module defines functions to register and unregister cleanup functions. Functions thus registered are automatically executed upon normal interpreter termination. atexit runs these functio..." />
  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>atexit — Exit handlers &#8212; Python 3.12.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
  18. <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=80d5e7a1" />
  19. <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=bb723527" />
  20. <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=b20cc3f5" />
  21. <script src="../_static/documentation_options.js?v=2c828074"></script>
  22. <script src="../_static/doctools.js?v=888ff710"></script>
  23. <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
  24. <script src="../_static/sidebar.js"></script>
  25. <link rel="search" type="application/opensearchdescription+xml"
  26. title="Search within Python 3.12.3 documentation"
  27. href="../_static/opensearch.xml"/>
  28. <link rel="author" title="About these documents" href="../about.html" />
  29. <link rel="index" title="Index" href="../genindex.html" />
  30. <link rel="search" title="Search" href="../search.html" />
  31. <link rel="copyright" title="Copyright" href="../copyright.html" />
  32. <link rel="next" title="traceback — Print or retrieve a stack traceback" href="traceback.html" />
  33. <link rel="prev" title="abc — Abstract Base Classes" href="abc.html" />
  34. <link rel="canonical" href="https://docs.python.org/3/library/atexit.html" />
  35. <style>
  36. @media only screen {
  37. table.full-width-table {
  38. width: 100%;
  39. }
  40. }
  41. </style>
  42. <link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
  43. <link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
  44. <script type="text/javascript" src="../_static/copybutton.js"></script>
  45. <script type="text/javascript" src="../_static/menu.js"></script>
  46. <script type="text/javascript" src="../_static/search-focus.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="Python 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="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">atexit</span></code> — Exit handlers</a><ul>
  86. <li><a class="reference internal" href="#atexit-example"><code class="xref py py-mod docutils literal notranslate"><span class="pre">atexit</span></code> Example</a></li>
  87. </ul>
  88. </li>
  89. </ul>
  90. </div>
  91. <div>
  92. <h4>Previous topic</h4>
  93. <p class="topless"><a href="abc.html"
  94. title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">abc</span></code> — Abstract Base Classes</a></p>
  95. </div>
  96. <div>
  97. <h4>Next topic</h4>
  98. <p class="topless"><a href="traceback.html"
  99. title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">traceback</span></code> — Print or retrieve a stack traceback</a></p>
  100. </div>
  101. <div role="note" aria-label="source link">
  102. <h3>This Page</h3>
  103. <ul class="this-page-menu">
  104. <li><a href="../bugs.html">Report a Bug</a></li>
  105. <li>
  106. <a href="https://github.com/python/cpython/blob/main/Doc/library/atexit.rst"
  107. rel="nofollow">Show Source
  108. </a>
  109. </li>
  110. </ul>
  111. </div>
  112. </nav>
  113. </div>
  114. </div>
  115. <div class="related" role="navigation" aria-label="related navigation">
  116. <h3>Navigation</h3>
  117. <ul>
  118. <li class="right" style="margin-right: 10px">
  119. <a href="../genindex.html" title="General Index"
  120. accesskey="I">index</a></li>
  121. <li class="right" >
  122. <a href="../py-modindex.html" title="Python Module Index"
  123. >modules</a> |</li>
  124. <li class="right" >
  125. <a href="traceback.html" title="traceback — Print or retrieve a stack traceback"
  126. accesskey="N">next</a> |</li>
  127. <li class="right" >
  128. <a href="abc.html" title="abc — Abstract Base Classes"
  129. accesskey="P">previous</a> |</li>
  130. <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  131. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  132. <li class="switchers">
  133. <div class="language_switcher_placeholder"></div>
  134. <div class="version_switcher_placeholder"></div>
  135. </li>
  136. <li>
  137. </li>
  138. <li id="cpython-language-and-version">
  139. <a href="../index.html">3.12.3 Documentation</a> &#187;
  140. </li>
  141. <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
  142. <li class="nav-item nav-item-2"><a href="python.html" accesskey="U">Python Runtime Services</a> &#187;</li>
  143. <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">atexit</span></code> — Exit handlers</a></li>
  144. <li class="right">
  145. <div class="inline-search" role="search">
  146. <form class="inline-search" action="../search.html" method="get">
  147. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
  148. <input type="submit" value="Go" />
  149. </form>
  150. </div>
  151. |
  152. </li>
  153. <li class="right">
  154. <label class="theme-selector-label">
  155. Theme
  156. <select class="theme-selector" oninput="activateTheme(this.value)">
  157. <option value="auto" selected>Auto</option>
  158. <option value="light">Light</option>
  159. <option value="dark">Dark</option>
  160. </select>
  161. </label> |</li>
  162. </ul>
  163. </div>
  164. <div class="document">
  165. <div class="documentwrapper">
  166. <div class="bodywrapper">
  167. <div class="body" role="main">
  168. <section id="module-atexit">
  169. <span id="atexit-exit-handlers"></span><h1><a class="reference internal" href="#module-atexit" title="atexit: Register and execute cleanup functions."><code class="xref py py-mod docutils literal notranslate"><span class="pre">atexit</span></code></a> — Exit handlers<a class="headerlink" href="#module-atexit" title="Link to this heading">¶</a></h1>
  170. <hr class="docutils" />
  171. <p>The <a class="reference internal" href="#module-atexit" title="atexit: Register and execute cleanup functions."><code class="xref py py-mod docutils literal notranslate"><span class="pre">atexit</span></code></a> module defines functions to register and unregister cleanup
  172. functions. Functions thus registered are automatically executed upon normal
  173. interpreter termination. <a class="reference internal" href="#module-atexit" title="atexit: Register and execute cleanup functions."><code class="xref py py-mod docutils literal notranslate"><span class="pre">atexit</span></code></a> runs these functions in the <em>reverse</em>
  174. order in which they were registered; if you register <code class="docutils literal notranslate"><span class="pre">A</span></code>, <code class="docutils literal notranslate"><span class="pre">B</span></code>, and <code class="docutils literal notranslate"><span class="pre">C</span></code>,
  175. at interpreter termination time they will be run in the order <code class="docutils literal notranslate"><span class="pre">C</span></code>, <code class="docutils literal notranslate"><span class="pre">B</span></code>,
  176. <code class="docutils literal notranslate"><span class="pre">A</span></code>.</p>
  177. <p><strong>Note:</strong> The functions registered via this module are not called when the
  178. program is killed by a signal not handled by Python, when a Python fatal
  179. internal error is detected, or when <a class="reference internal" href="os.html#os._exit" title="os._exit"><code class="xref py py-func docutils literal notranslate"><span class="pre">os._exit()</span></code></a> is called.</p>
  180. <p><strong>Note:</strong> The effect of registering or unregistering functions from within
  181. a cleanup function is undefined.</p>
  182. <div class="versionchanged">
  183. <p><span class="versionmodified changed">Changed in version 3.7: </span>When used with C-API subinterpreters, registered functions
  184. are local to the interpreter they were registered in.</p>
  185. </div>
  186. <dl class="py function">
  187. <dt class="sig sig-object py" id="atexit.register">
  188. <span class="sig-prename descclassname"><span class="pre">atexit.</span></span><span class="sig-name descname"><span class="pre">register</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#atexit.register" title="Link to this definition">¶</a></dt>
  189. <dd><p>Register <em>func</em> as a function to be executed at termination. Any optional
  190. arguments that are to be passed to <em>func</em> must be passed as arguments to
  191. <a class="reference internal" href="#atexit.register" title="atexit.register"><code class="xref py py-func docutils literal notranslate"><span class="pre">register()</span></code></a>. It is possible to register the same function and arguments
  192. more than once.</p>
  193. <p>At normal program termination (for instance, if <a class="reference internal" href="sys.html#sys.exit" title="sys.exit"><code class="xref py py-func docutils literal notranslate"><span class="pre">sys.exit()</span></code></a> is called or
  194. the main module’s execution completes), all functions registered are called in
  195. last in, first out order. The assumption is that lower level modules will
  196. normally be imported before higher level modules and thus must be cleaned up
  197. later.</p>
  198. <p>If an exception is raised during execution of the exit handlers, a traceback is
  199. printed (unless <a class="reference internal" href="exceptions.html#SystemExit" title="SystemExit"><code class="xref py py-exc docutils literal notranslate"><span class="pre">SystemExit</span></code></a> is raised) and the exception information is
  200. saved. After all exit handlers have had a chance to run, the last exception to
  201. be raised is re-raised.</p>
  202. <p>This function returns <em>func</em>, which makes it possible to use it as a
  203. decorator.</p>
  204. <div class="admonition warning">
  205. <p class="admonition-title">Warning</p>
  206. <p>Starting new threads or calling <a class="reference internal" href="os.html#os.fork" title="os.fork"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.fork()</span></code></a> from a registered
  207. function can lead to race condition between the main Python
  208. runtime thread freeing thread states while internal <a class="reference internal" href="threading.html#module-threading" title="threading: Thread-based parallelism."><code class="xref py py-mod docutils literal notranslate"><span class="pre">threading</span></code></a>
  209. routines or the new process try to use that state. This can lead to
  210. crashes rather than clean shutdown.</p>
  211. </div>
  212. <div class="versionchanged">
  213. <p><span class="versionmodified changed">Changed in version 3.12: </span>Attempts to start a new thread or <a class="reference internal" href="os.html#os.fork" title="os.fork"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.fork()</span></code></a> a new process
  214. in a registered function now leads to <a class="reference internal" href="exceptions.html#RuntimeError" title="RuntimeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">RuntimeError</span></code></a>.</p>
  215. </div>
  216. </dd></dl>
  217. <dl class="py function">
  218. <dt class="sig sig-object py" id="atexit.unregister">
  219. <span class="sig-prename descclassname"><span class="pre">atexit.</span></span><span class="sig-name descname"><span class="pre">unregister</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#atexit.unregister" title="Link to this definition">¶</a></dt>
  220. <dd><p>Remove <em>func</em> from the list of functions to be run at interpreter shutdown.
  221. <a class="reference internal" href="#atexit.unregister" title="atexit.unregister"><code class="xref py py-func docutils literal notranslate"><span class="pre">unregister()</span></code></a> silently does nothing if <em>func</em> was not previously
  222. registered. If <em>func</em> has been registered more than once, every occurrence
  223. of that function in the <a class="reference internal" href="#module-atexit" title="atexit: Register and execute cleanup functions."><code class="xref py py-mod docutils literal notranslate"><span class="pre">atexit</span></code></a> call stack will be removed. Equality
  224. comparisons (<code class="docutils literal notranslate"><span class="pre">==</span></code>) are used internally during unregistration, so function
  225. references do not need to have matching identities.</p>
  226. </dd></dl>
  227. <div class="admonition seealso">
  228. <p class="admonition-title">See also</p>
  229. <dl class="simple">
  230. <dt>Module <a class="reference internal" href="readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">readline</span></code></a></dt><dd><p>Useful example of <a class="reference internal" href="#module-atexit" title="atexit: Register and execute cleanup functions."><code class="xref py py-mod docutils literal notranslate"><span class="pre">atexit</span></code></a> to read and write <a class="reference internal" href="readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">readline</span></code></a> history
  231. files.</p>
  232. </dd>
  233. </dl>
  234. </div>
  235. <section id="atexit-example">
  236. <span id="id1"></span><h2><a class="reference internal" href="#module-atexit" title="atexit: Register and execute cleanup functions."><code class="xref py py-mod docutils literal notranslate"><span class="pre">atexit</span></code></a> Example<a class="headerlink" href="#atexit-example" title="Link to this heading">¶</a></h2>
  237. <p>The following simple example demonstrates how a module can initialize a counter
  238. from a file when it is imported and save the counter’s updated value
  239. automatically when the program terminates without relying on the application
  240. making an explicit call into this module at termination.</p>
  241. <div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">try</span><span class="p">:</span>
  242. <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s1">&#39;counterfile&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">infile</span><span class="p">:</span>
  243. <span class="n">_count</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">infile</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
  244. <span class="k">except</span> <span class="ne">FileNotFoundError</span><span class="p">:</span>
  245. <span class="n">_count</span> <span class="o">=</span> <span class="mi">0</span>
  246. <span class="k">def</span> <span class="nf">incrcounter</span><span class="p">(</span><span class="n">n</span><span class="p">):</span>
  247. <span class="k">global</span> <span class="n">_count</span>
  248. <span class="n">_count</span> <span class="o">=</span> <span class="n">_count</span> <span class="o">+</span> <span class="n">n</span>
  249. <span class="k">def</span> <span class="nf">savecounter</span><span class="p">():</span>
  250. <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s1">&#39;counterfile&#39;</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">outfile</span><span class="p">:</span>
  251. <span class="n">outfile</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s1">&#39;</span><span class="si">%d</span><span class="s1">&#39;</span> <span class="o">%</span> <span class="n">_count</span><span class="p">)</span>
  252. <span class="kn">import</span> <span class="nn">atexit</span>
  253. <span class="n">atexit</span><span class="o">.</span><span class="n">register</span><span class="p">(</span><span class="n">savecounter</span><span class="p">)</span>
  254. </pre></div>
  255. </div>
  256. <p>Positional and keyword arguments may also be passed to <a class="reference internal" href="#atexit.register" title="atexit.register"><code class="xref py py-func docutils literal notranslate"><span class="pre">register()</span></code></a> to be
  257. passed along to the registered function when it is called:</p>
  258. <div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">goodbye</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">adjective</span><span class="p">):</span>
  259. <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Goodbye </span><span class="si">%s</span><span class="s1">, it was </span><span class="si">%s</span><span class="s1"> to meet you.&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">adjective</span><span class="p">))</span>
  260. <span class="kn">import</span> <span class="nn">atexit</span>
  261. <span class="n">atexit</span><span class="o">.</span><span class="n">register</span><span class="p">(</span><span class="n">goodbye</span><span class="p">,</span> <span class="s1">&#39;Donny&#39;</span><span class="p">,</span> <span class="s1">&#39;nice&#39;</span><span class="p">)</span>
  262. <span class="c1"># or:</span>
  263. <span class="n">atexit</span><span class="o">.</span><span class="n">register</span><span class="p">(</span><span class="n">goodbye</span><span class="p">,</span> <span class="n">adjective</span><span class="o">=</span><span class="s1">&#39;nice&#39;</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s1">&#39;Donny&#39;</span><span class="p">)</span>
  264. </pre></div>
  265. </div>
  266. <p>Usage as a <a class="reference internal" href="../glossary.html#term-decorator"><span class="xref std std-term">decorator</span></a>:</p>
  267. <div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">atexit</span>
  268. <span class="nd">@atexit</span><span class="o">.</span><span class="n">register</span>
  269. <span class="k">def</span> <span class="nf">goodbye</span><span class="p">():</span>
  270. <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;You are now leaving the Python sector.&#39;</span><span class="p">)</span>
  271. </pre></div>
  272. </div>
  273. <p>This only works with functions that can be called without arguments.</p>
  274. </section>
  275. </section>
  276. <div class="clearer"></div>
  277. </div>
  278. </div>
  279. </div>
  280. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  281. <div class="sphinxsidebarwrapper">
  282. <div>
  283. <h3><a href="../contents.html">Table of Contents</a></h3>
  284. <ul>
  285. <li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">atexit</span></code> — Exit handlers</a><ul>
  286. <li><a class="reference internal" href="#atexit-example"><code class="xref py py-mod docutils literal notranslate"><span class="pre">atexit</span></code> Example</a></li>
  287. </ul>
  288. </li>
  289. </ul>
  290. </div>
  291. <div>
  292. <h4>Previous topic</h4>
  293. <p class="topless"><a href="abc.html"
  294. title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">abc</span></code> — Abstract Base Classes</a></p>
  295. </div>
  296. <div>
  297. <h4>Next topic</h4>
  298. <p class="topless"><a href="traceback.html"
  299. title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">traceback</span></code> — Print or retrieve a stack traceback</a></p>
  300. </div>
  301. <div role="note" aria-label="source link">
  302. <h3>This Page</h3>
  303. <ul class="this-page-menu">
  304. <li><a href="../bugs.html">Report a Bug</a></li>
  305. <li>
  306. <a href="https://github.com/python/cpython/blob/main/Doc/library/atexit.rst"
  307. rel="nofollow">Show Source
  308. </a>
  309. </li>
  310. </ul>
  311. </div>
  312. </div>
  313. <div id="sidebarbutton" title="Collapse sidebar">
  314. <span>«</span>
  315. </div>
  316. </div>
  317. <div class="clearer"></div>
  318. </div>
  319. <div class="related" role="navigation" aria-label="related navigation">
  320. <h3>Navigation</h3>
  321. <ul>
  322. <li class="right" style="margin-right: 10px">
  323. <a href="../genindex.html" title="General Index"
  324. >index</a></li>
  325. <li class="right" >
  326. <a href="../py-modindex.html" title="Python Module Index"
  327. >modules</a> |</li>
  328. <li class="right" >
  329. <a href="traceback.html" title="traceback — Print or retrieve a stack traceback"
  330. >next</a> |</li>
  331. <li class="right" >
  332. <a href="abc.html" title="abc — Abstract Base Classes"
  333. >previous</a> |</li>
  334. <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  335. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  336. <li class="switchers">
  337. <div class="language_switcher_placeholder"></div>
  338. <div class="version_switcher_placeholder"></div>
  339. </li>
  340. <li>
  341. </li>
  342. <li id="cpython-language-and-version">
  343. <a href="../index.html">3.12.3 Documentation</a> &#187;
  344. </li>
  345. <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
  346. <li class="nav-item nav-item-2"><a href="python.html" >Python Runtime Services</a> &#187;</li>
  347. <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">atexit</span></code> — Exit handlers</a></li>
  348. <li class="right">
  349. <div class="inline-search" role="search">
  350. <form class="inline-search" action="../search.html" method="get">
  351. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
  352. <input type="submit" value="Go" />
  353. </form>
  354. </div>
  355. |
  356. </li>
  357. <li class="right">
  358. <label class="theme-selector-label">
  359. Theme
  360. <select class="theme-selector" oninput="activateTheme(this.value)">
  361. <option value="auto" selected>Auto</option>
  362. <option value="light">Light</option>
  363. <option value="dark">Dark</option>
  364. </select>
  365. </label> |</li>
  366. </ul>
  367. </div>
  368. <div class="footer">
  369. &copy;
  370. <a href="../copyright.html">
  371. Copyright
  372. </a>
  373. 2001-2024, Python Software Foundation.
  374. <br />
  375. This page is licensed under the Python Software Foundation License Version 2.
  376. <br />
  377. Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
  378. <br />
  379. See <a href="/license.html">History and License</a> for more information.<br />
  380. <br />
  381. The Python Software Foundation is a non-profit corporation.
  382. <a href="https://www.python.org/psf/donations/">Please donate.</a>
  383. <br />
  384. <br />
  385. Last updated on Apr 09, 2024 (13:47 UTC).
  386. <a href="/bugs.html">Found a bug</a>?
  387. <br />
  388. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.
  389. </div>
  390. </body>
  391. </html>
上海开阖软件有限公司 沪ICP备12045867号-1