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

Commit5632e93

Browse files
[3.14]gh-133968: Add fast path to PyUnicodeWriter_WriteStr() (GH-133969) (#133971)
gh-133968: Add fast path to PyUnicodeWriter_WriteStr() (GH-133969)Don't call PyObject_Str() if the input type is str.(cherry picked from commitfe9f6e8)Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent69b4387 commit5632e93

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎Objects/unicodeobject.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13954,7 +13954,12 @@ _PyUnicodeWriter_WriteStr(_PyUnicodeWriter *writer, PyObject *str)
1395413954
int
1395513955
PyUnicodeWriter_WriteStr(PyUnicodeWriter*writer,PyObject*obj)
1395613956
{
13957-
if (Py_TYPE(obj)==&PyLong_Type) {
13957+
PyTypeObject*type=Py_TYPE(obj);
13958+
if (type==&PyUnicode_Type) {
13959+
return_PyUnicodeWriter_WriteStr((_PyUnicodeWriter*)writer,obj);
13960+
}
13961+
13962+
if (type==&PyLong_Type) {
1395813963
return_PyLong_FormatWriter((_PyUnicodeWriter*)writer,obj,10,0);
1395913964
}
1396013965

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp