Skip to content

Commit 3ce4538

Browse files
committed
Add _PyUnicode_AsDefaultEncodedString to unicodeobject.h.
And remove all the extern decls in the middle of .c files. Apparently, it was excluded from the header file because it is intended for internal use by the interpreter. It's still intended for internal use and documented as such in the header file.
1 parent 5121e7d commit 3ce4538

5 files changed

Lines changed: 17 additions & 29 deletions

File tree

Include/unicodeobject.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,23 @@ extern DL_IMPORT(int) PyUnicode_AsWideChar(
386386

387387
/* --- Manage the default encoding ---------------------------------------- */
388388

389+
/* Return a Python string holding the default encoded value of the
390+
Unicode object.
391+
392+
The resulting string is cached in the Unicode object for subsequent
393+
usage by this function. The cached version is needed to implement
394+
the character buffer interface and will live (at least) as long as
395+
the Unicode object itself.
396+
397+
The refcount of the string is *not* incremented.
398+
399+
*** Exported for internal use by the interpreter only !!! ***
400+
401+
*/
402+
403+
extern DL_IMPORT(PyObject *) _PyUnicode_AsDefaultEncodedString(
404+
PyObject *, const char *);
405+
389406
/* Returns the currently active default encoding.
390407
391408
The default encoding is currently implemented as run-time settable

Objects/object.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,11 +1056,6 @@ PyObject_SetAttrString(PyObject *v, char *name, PyObject *w)
10561056
}
10571057
}
10581058

1059-
/* Internal API needed by PyObject_GetAttr(): */
1060-
extern
1061-
PyObject *_PyUnicode_AsDefaultEncodedString(PyObject *unicode,
1062-
const char *errors);
1063-
10641059
PyObject *
10651060
PyObject_GetAttr(PyObject *v, PyObject *name)
10661061
{

Objects/stringobject.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,6 @@ PyString_AsString(register PyObject *op)
333333
return ((PyStringObject *)op) -> ob_sval;
334334
}
335335

336-
/* Internal API needed by PyString_AsStringAndSize(): */
337-
extern
338-
PyObject *_PyUnicode_AsDefaultEncodedString(PyObject *unicode,
339-
const char *errors);
340-
341336
int
342337
PyString_AsStringAndSize(register PyObject *obj,
343338
register char **s,

Objects/unicodeobject.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -566,20 +566,6 @@ PyObject *PyUnicode_AsEncodedString(PyObject *unicode,
566566
return NULL;
567567
}
568568

569-
/* Return a Python string holding the default encoded value of the
570-
Unicode object.
571-
572-
The resulting string is cached in the Unicode object for subsequent
573-
usage by this function. The cached version is needed to implement
574-
the character buffer interface and will live (at least) as long as
575-
the Unicode object itself.
576-
577-
The refcount of the string is *not* incremented.
578-
579-
*** Exported for internal use by the interpreter only !!! ***
580-
581-
*/
582-
583569
PyObject *_PyUnicode_AsDefaultEncodedString(PyObject *unicode,
584570
const char *errors)
585571
{

Python/getargs.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,6 @@ convertitem(PyObject *arg, char **p_format, va_list *p_va, int *levels,
359359

360360

361361

362-
/* Internal API needed by convertsimple() and a helper macro. */
363-
extern
364-
PyObject *_PyUnicode_AsDefaultEncodedString(PyObject *unicode,
365-
const char *errors);
366-
367362
#define UNICODE_DEFAULT_ENCODING(arg) \
368363
_PyUnicode_AsDefaultEncodedString(arg, NULL)
369364

0 commit comments

Comments
 (0)