You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pr-preview/pr-1231/builtins/functions.html
+15-5Lines changed: 15 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -608,8 +608,14 @@ <h3>導航</h3>
608
608
given by <aclass="reference internal" href="../using/cmdline.html#cmdoption-O"><codeclass="xref std std-option docutils literal notranslate"><spanclass="pre">-O</span></code></a> options. Explicit levels are <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code> (no optimization;
609
609
<codeclass="docutils literal notranslate"><spanclass="pre">__debug__</span></code> is true), <codeclass="docutils literal notranslate"><spanclass="pre">1</span></code> (asserts are removed, <codeclass="docutils literal notranslate"><spanclass="pre">__debug__</span></code> is false)
610
610
or <codeclass="docutils literal notranslate"><spanclass="pre">2</span></code> (docstrings are removed too).</p>
611
-
<p>This function raises <aclass="reference internal" href="exceptions.html#SyntaxError" title="SyntaxError"><codeclass="xref py py-exc docutils literal notranslate"><spanclass="pre">SyntaxError</span></code></a> or <aclass="reference internal" href="exceptions.html#ValueError" title="ValueError"><codeclass="xref py py-exc docutils literal notranslate"><spanclass="pre">ValueError</span></code></a> if the compiled
612
-
source is invalid.</p>
611
+
<p>This function raises <aclass="reference internal" href="exceptions.html#SyntaxError" title="SyntaxError"><codeclass="xref py py-exc docutils literal notranslate"><spanclass="pre">SyntaxError</span></code></a> if the compiled source is invalid,
612
+
including a <em>source</em> containing a null character or that cannot be decoded;
613
+
<aclass="reference internal" href="exceptions.html#ValueError" title="ValueError"><codeclass="xref py py-exc docutils literal notranslate"><spanclass="pre">ValueError</span></code></a> if <em>mode</em> or <em>flags</em> is invalid,
614
+
or if a string <em>source</em> contains surrogate characters;
615
+
<aclass="reference internal" href="exceptions.html#MemoryError" title="MemoryError"><codeclass="xref py py-exc docutils literal notranslate"><spanclass="pre">MemoryError</span></code></a> or <aclass="reference internal" href="exceptions.html#RecursionError" title="RecursionError"><codeclass="xref py py-exc docutils literal notranslate"><spanclass="pre">RecursionError</span></code></a> if <em>source</em> is too complex
616
+
to parse or compile,
617
+
for example an expression with many thousands of nested operators;
618
+
and <aclass="reference internal" href="exceptions.html#OverflowError" title="OverflowError"><codeclass="xref py py-exc docutils literal notranslate"><spanclass="pre">OverflowError</span></code></a> if <em>source</em> is too large.</p>
613
619
<p>If you want to parse Python code into its AST representation, see
<pclass="audit-hook"><p>Raises an <aclass="reference internal" href="../library/sys.html#auditing"><spanclass="std std-ref">auditing event</span></a><codeclass="docutils literal notranslate"><spanclass="pre">compile</span></code> with arguments
@@ -637,10 +643,14 @@ <h3>導航</h3>
637
643
<p><spanclass="versionmodified changed">在 3.5 版的變更: </span>Previously, <aclass="reference internal" href="exceptions.html#TypeError" title="TypeError"><codeclass="xref py py-exc docutils literal notranslate"><spanclass="pre">TypeError</span></code></a> was raised when null bytes were encountered
638
644
in <em>source</em>.</p>
639
645
</div>
640
-
<divclass="versionadded">
641
-
<p><spanclass="versionmodified added">在 3.8 版被加入: </span><codeclass="docutils literal notranslate"><spanclass="pre">ast.PyCF_ALLOW_TOP_LEVEL_AWAIT</span></code> can now be passed in flags to enable
646
+
<divclass="versionchanged">
647
+
<p><spanclass="versionmodified changed">在 3.8 版的變更: </span><codeclass="docutils literal notranslate"><spanclass="pre">ast.PyCF_ALLOW_TOP_LEVEL_AWAIT</span></code> can now be passed in flags to enable
642
648
support for top-level <codeclass="docutils literal notranslate"><spanclass="pre">await</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">async</span><spanclass="pre">for</span></code>, and <codeclass="docutils literal notranslate"><spanclass="pre">async</span><spanclass="pre">with</span></code>.</p>
643
649
</div>
650
+
<divclass="versionchanged">
651
+
<p><spanclass="versionmodified changed">在 3.12 版的變更: </span><aclass="reference internal" href="exceptions.html#SyntaxError" title="SyntaxError"><codeclass="xref py py-exc docutils literal notranslate"><spanclass="pre">SyntaxError</span></code></a> is raised instead of <aclass="reference internal" href="exceptions.html#ValueError" title="ValueError"><codeclass="xref py py-exc docutils literal notranslate"><spanclass="pre">ValueError</span></code></a> when null bytes
0 commit comments