Skip to content

gh-133968: Use private unicode writer for json #133832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 31, 2025
Prev Previous commit
Next Next commit
Use PyUnicodeWriter_WriteRepr
  • Loading branch information
nineteendo committed May 10, 2025
commit 72ae3d000cf69ccda477aa738f2ec0c67da4c8c1
3 changes: 1 addition & 2 deletions Modules/_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "Python.h"
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
#include "pycore_global_strings.h" // _Py_ID()
#include "pycore_long.h" // _PyLong_FormatWriter()
#include "pycore_pyerrors.h" // _PyErr_FormatNote
#include "pycore_runtime.h" // _PyRuntime
#include "pycore_unicodeobject.h" // _PyUnicode_CheckConsistency()
Expand Down Expand Up @@ -1485,7 +1484,7 @@ encoder_listencode_obj(PyEncoderObject *s, _PyUnicodeWriter *writer,
else if (PyLong_Check(obj)) {
if (PyLong_CheckExact(obj)) {
// Fast-path for exact integers
return _PyLong_FormatWriter(writer, obj, 10, 0);
return PyUnicodeWriter_WriteRepr((PyUnicodeWriter*)writer, obj);
}
PyObject *encoded = PyLong_Type.tp_repr(obj);
if (encoded == NULL)
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy