Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdbe21a1

Browse files
Deploy preview for PR 1153 🛫
1 parent02b3e4f commitdbe21a1

File tree

573 files changed

+712
-585
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

573 files changed

+712
-585
lines changed

‎pr-preview/pr-1153/_sources/c-api/conversion.rst.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The return value (*rv*) for these functions should be interpreted as follows:
4141
``rv + 1`` bytes would have been needed to succeed. ``str[size-1]`` is ``'\0'``
4242
in this case.
4343
44-
* When ``rv < 0``,"something bad happened." ``str[size-1]`` is ``'\0'`` in
44+
* When ``rv < 0``,the output conversion failed and ``str[size-1]`` is ``'\0'`` in
4545
this case too, but the rest of *str* is undefined. The exact cause of the error
4646
depends on the underlying platform.
4747

‎pr-preview/pr-1153/_sources/c-api/dict.rst.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Dictionary Objects
5050
5151
..c:function::intPyDict_Contains(PyObject *p, PyObject *key)
5252
53-
Determine if dictionary *p* contains *key*. If an item in *p*ismatches
53+
Determine if dictionary *p* contains *key*. If an item in *p* matches
5454
*key*, return ``1``, otherwise return ``0``. On error, return ``-1``.
5555
This is equivalent to the Python expression ``key in p``.
5656
@@ -198,7 +198,7 @@ Dictionary Objects
198198
.. c:function:: int PyDict_Pop(PyObject *p, PyObject *key, PyObject **result)
199199
200200
Remove *key* from dictionary *p* and optionally return the removed value.
201-
Do not raise:exc:`KeyError` if the key missing.
201+
Do not raise:exc:`KeyError` if the keyismissing.
202202
203203
- If the key is present, set *\*result* to a new reference to the removed
204204
value if *result* is not ``NULL``, and return ``1``.
@@ -207,7 +207,7 @@ Dictionary Objects
207207
- On error, raise an exception and return ``-1``.
208208
209209
Similar to:meth:`dict.pop`, but without the default value and
210-
not raising:exc:`KeyError` if the key missing.
210+
not raising:exc:`KeyError` if the keyismissing.
211211
212212
..versionadded::3.13
213213

‎pr-preview/pr-1153/_sources/library/pyexpat.rst.txt‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ The :mod:`xml.parsers.expat` module contains two functions:
7272
*encoding* [1]_ is given it will override the implicit or explicit encoding of the
7373
document.
7474

75+
.. _xmlparser-non-root:
76+
77+
Parsers created through:func:`!ParserCreate` are called "root" parsers,
78+
in the sense that they do not have any parent parser attached. Non-root
79+
parsers are created by:meth:`parser.ExternalEntityParserCreate
80+
<xmlparser.ExternalEntityParserCreate>`.
81+
7582
Expat can optionally do XML namespace processing for you, enabled by providing a
7683
value for *namespace_separator*. The value must be a one-character string; a
7784
:exc:`ValueError` will be raised if the string has an illegal length (``None``
@@ -231,6 +238,55 @@ XMLParser Objects
231238
..versionadded::3.13
232239

233240

241+
:class:`!xmlparser` objects have the following methods to mitigate some
242+
common XML vulnerabilities.
243+
244+
..method::xmlparser.SetAllocTrackerActivationThreshold(threshold, /)
245+
246+
Sets the number of allocated bytes of dynamic memory needed to activate
247+
protection against disproportionate use of RAM.
248+
249+
By default, parser objects have an allocation activation threshold of 64 MiB,
250+
or equivalently 67,108,864 bytes.
251+
252+
An:exc:`ExpatError` is raised if this method is called on a
253+
|xml-non-root-parser| parser.
254+
The corresponding:attr:`~ExpatError.lineno` and:attr:`~ExpatError.offset`
255+
should not be used as they may have no special meaning.
256+
257+
..versionadded::next
258+
259+
..method::xmlparser.SetAllocTrackerMaximumAmplification(max_factor, /)
260+
261+
Sets the maximum amplification factor between direct input and bytes
262+
of dynamic memory allocated.
263+
264+
The amplification factor is calculated as ``allocated / direct``
265+
while parsing, where ``direct`` is the number of bytes read from
266+
the primary document in parsing and ``allocated`` is the number
267+
of bytes of dynamic memory allocated in the parser hierarchy.
268+
269+
The *max_factor* value must be a non-NaN:class:`float` value greater than
270+
or equal to 1.0. Amplification factors greater than 100.0 can be observed
271+
near the start of parsing even with benign files in practice. In particular,
272+
the activation threshold should be carefully chosen to avoid false positives.
273+
274+
By default, parser objects have a maximum amplification factor of 100.0.
275+
276+
An:exc:`ExpatError` is raised if this method is called on a
277+
|xml-non-root-parser| parser or if *max_factor* is outside the valid range.
278+
The corresponding:attr:`~ExpatError.lineno` and:attr:`~ExpatError.offset`
279+
should not be used as they may have no special meaning.
280+
281+
..note::
282+
283+
The maximum amplification factor is only considered if the threshold
284+
that can be adjusted by:meth:`.SetAllocTrackerActivationThreshold`
285+
is exceeded.
286+
287+
..versionadded::next
288+
289+
234290
:class:`xmlparser` objects have the following attributes:
235291

236292

@@ -954,3 +1010,4 @@ The ``errors`` module has the following attributes:
9541010
not. See https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl
9551011
and https://www.iana.org/assignments/character-sets/character-sets.xhtml.
9561012
1013+
.. |xml-non-root-parser|replace:::ref:`non-root<xmlparser-non-root>`

‎pr-preview/pr-1153/about.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ <h3>導航</h3>
314314
<ahref="https://www.python.org/psf/donations/">敬請捐贈。</a>
315315
<br>
316316
<br>
317-
最後更新於 11月01, 2025 (00:21 UTC)。
317+
最後更新於 11月03, 2025 (00:22 UTC)。
318318

319319
<ahref="/bugs.html">發現 bug</a>
320320

‎pr-preview/pr-1153/bugs.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ <h2>說明文件的錯誤<a class="headerlink" href="#documentation-bugs" title=
229229
</section>
230230
<sectionid="getting-started-contributing-to-python-yourself">
231231
<spanid="contributing-to-python"></span><h2>開始讓自己貢獻 Python<aclass="headerlink"href="#getting-started-contributing-to-python-yourself"title="連結到這個標頭"></a></h2>
232-
<p>除了只是回報你所發現的錯誤之外,同樣也歡迎你提交修正它們的修補程式 (patch)。你可以在<aclass="reference external"href="https://devguide.python.org/">Python 開發者指南</a>中找到如何開始修補 Python 的更多資訊。如果你有任何問題,<aclass="reference external"href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">核心導師郵寄清單</a>是一個友善的地方,你可以在那裡得到,關於 Python 修正錯誤的過程中,所有問題的答案。</p>
232+
<p>除了只是回報你所發現的錯誤之外,同樣也歡迎你提交修正它們的修補程式 (patch)。你可以在<aclass="reference external"href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">Python 開發者指南</a>中找到如何開始修補 Python 的更多資訊。如果你有任何問題,<aclass="reference external"href="https://devguide.python.org/">核心導師郵寄清單</a>是一個友善的地方,你可以在那裡得到,關於 Python 修正錯誤的過程中,所有問題的答案。</p>
233233
</section>
234234
</section>
235235

@@ -351,7 +351,7 @@ <h3>導航</h3>
351351
<ahref="https://www.python.org/psf/donations/">敬請捐贈。</a>
352352
<br>
353353
<br>
354-
最後更新於 11月01, 2025 (00:21 UTC)。
354+
最後更新於 11月03, 2025 (00:22 UTC)。
355355

356356
<ahref="/bugs.html">發現 bug</a>
357357

‎pr-preview/pr-1153/c-api/abstract.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ <h3>導航</h3>
323323
<ahref="https://www.python.org/psf/donations/">敬請捐贈。</a>
324324
<br>
325325
<br>
326-
最後更新於 11月01, 2025 (00:21 UTC)。
326+
最後更新於 11月03, 2025 (00:22 UTC)。
327327

328328
<ahref="/bugs.html">發現 bug</a>
329329

‎pr-preview/pr-1153/c-api/allocation.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ <h3>導航</h3>
432432
<ahref="https://www.python.org/psf/donations/">敬請捐贈。</a>
433433
<br>
434434
<br>
435-
最後更新於 11月01, 2025 (00:21 UTC)。
435+
最後更新於 11月03, 2025 (00:22 UTC)。
436436

437437
<ahref="/bugs.html">發現 bug</a>
438438

‎pr-preview/pr-1153/c-api/apiabiversion.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ <h3>導航</h3>
471471
<ahref="https://www.python.org/psf/donations/">敬請捐贈。</a>
472472
<br>
473473
<br>
474-
最後更新於 11月01, 2025 (00:21 UTC)。
474+
最後更新於 11月03, 2025 (00:22 UTC)。
475475

476476
<ahref="/bugs.html">發現 bug</a>
477477

‎pr-preview/pr-1153/c-api/arg.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ <h3>導航</h3>
954954
<ahref="https://www.python.org/psf/donations/">敬請捐贈。</a>
955955
<br>
956956
<br>
957-
最後更新於 11月01, 2025 (00:21 UTC)。
957+
最後更新於 11月03, 2025 (00:22 UTC)。
958958

959959
<ahref="/bugs.html">發現 bug</a>
960960

‎pr-preview/pr-1153/c-api/bool.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ <h3>導航</h3>
334334
<ahref="https://www.python.org/psf/donations/">敬請捐贈。</a>
335335
<br>
336336
<br>
337-
最後更新於 11月01, 2025 (00:21 UTC)。
337+
最後更新於 11月03, 2025 (00:22 UTC)。
338338

339339
<ahref="/bugs.html">發現 bug</a>
340340

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp