Commit ccac5408 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Reenable PyString_GET_SIZE

parent dc1f1d6c
......@@ -112,10 +112,8 @@ PyAPI_FUNC(int) _PyString_CheckInterned(PyObject *) PYSTON_NOEXCEPT;
// length of the unicode string, not the length of the bytes it encodes to in the default
// encoding.
// So, set up a different function for those callers to use.
PyAPI_FUNC(Py_ssize_t) _PyString_SizeMacro(PyObject *) PYSTON_NOEXCEPT;
#define PyString_GET_SIZE(op) _PyString_SizeMacro((PyObject*)op)
//#define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval)
//#define PyString_GET_SIZE(op) Py_SIZE(op)
#define PyString_GET_SIZE(op) Py_SIZE(op)
/* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*,
x must be an iterable object. */
......
......@@ -2348,16 +2348,6 @@ extern "C" Py_ssize_t PyString_Size(PyObject* op) noexcept {
return len;
}
extern "C" Py_ssize_t _PyString_SizeMacro(PyObject* op) noexcept {
if (PyString_Check(op))
return static_cast<BoxedString*>(op)->size();
if (PyUnicode_Check(op))
return Py_SIZE(op);
RELEASE_ASSERT(0, "Need to verify the behavior of PyString_GET_SIZE on %s objects", op->cls->tp_name);
}
extern "C" int _PyString_Resize(PyObject** pv, Py_ssize_t newsize) noexcept {
// This is only allowed to be called when there is only one user of the string (ie a refcount of 1 in CPython)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment