Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2e81c7e

Browse files
committed
bpo-18697 revert all code changes
1 parent 044d984 commit 2e81c7e

File tree

4 files changed

+675
-700
lines changed

4 files changed

+675
-700
lines changed

Include/cpython/unicodeobject.h

Lines changed: 41 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -556,13 +556,13 @@ PyAPI_FUNC(void) _PyUnicode_FastFill(
556556
Scan the string to find the maximum character. */
557557
PyAPI_FUNC(PyObject*) PyUnicode_FromKindAndData(
558558
int kind,
559-
const void *str,
559+
const void *buffer,
560560
Py_ssize_t size);
561561

562562
/* Create a new string from a buffer of ASCII characters.
563563
WARNING: Don't check if the string contains any non-ASCII character. */
564564
PyAPI_FUNC(PyObject*) _PyUnicode_FromASCII(
565-
const char *str,
565+
const char *buffer,
566566
Py_ssize_t size);
567567

568568
/* Compute the maximum character of the substring unicode[start:end].
@@ -629,7 +629,8 @@ typedef struct {
629629
* By default, the minimum buffer size is 0 character and overallocation is
630630
* disabled. Set min_length, min_char and overallocate attributes to control
631631
* the allocation of the buffer. */
632-
PyAPI_FUNC(void) _PyUnicodeWriter_Init(_PyUnicodeWriter *writer);
632+
PyAPI_FUNC(void)
633+
_PyUnicodeWriter_Init(_PyUnicodeWriter *writer);
633634

634635
/* Prepare the buffer to write 'length' characters
635636
with the specified maximum character.
@@ -645,11 +646,9 @@ PyAPI_FUNC(void) _PyUnicodeWriter_Init(_PyUnicodeWriter *writer);
645646

646647
/* Don't call this function directly, use the _PyUnicodeWriter_Prepare() macro
647648
instead. */
648-
PyAPI_FUNC(int) _PyUnicodeWriter_PrepareInternal(
649-
_PyUnicodeWriter *writer,
650-
Py_ssize_t length,
651-
Py_UCS4 maxchar
652-
);
649+
PyAPI_FUNC(int)
650+
_PyUnicodeWriter_PrepareInternal(_PyUnicodeWriter *writer,
651+
Py_ssize_t length, Py_UCS4 maxchar);
653652

654653
/* Prepare the buffer to have at least the kind KIND.
655654
For example, kind=PyUnicode_2BYTE_KIND ensures that the writer will
@@ -664,61 +663,58 @@ PyAPI_FUNC(int) _PyUnicodeWriter_PrepareInternal(
664663

665664
/* Don't call this function directly, use the _PyUnicodeWriter_PrepareKind()
666665
macro instead. */
667-
PyAPI_FUNC(int) _PyUnicodeWriter_PrepareKindInternal(
668-
_PyUnicodeWriter *writer,
669-
enum PyUnicode_Kind kind
670-
);
666+
PyAPI_FUNC(int)
667+
_PyUnicodeWriter_PrepareKindInternal(_PyUnicodeWriter *writer,
668+
enum PyUnicode_Kind kind);
671669

672670
/* Append a Unicode character.
673671
Return 0 on success, raise an exception and return -1 on error. */
674-
PyAPI_FUNC(int) _PyUnicodeWriter_WriteChar(
675-
_PyUnicodeWriter *writer,
672+
PyAPI_FUNC(int)
673+
_PyUnicodeWriter_WriteChar(_PyUnicodeWriter *writer,
676674
Py_UCS4 ch
677675
);
678676

679677
/* Append a Unicode string.
680678
Return 0 on success, raise an exception and return -1 on error. */
681-
PyAPI_FUNC(int) _PyUnicodeWriter_WriteStr(
682-
_PyUnicodeWriter *writer,
683-
PyObject *unicode /* Unicode string */
679+
PyAPI_FUNC(int)
680+
_PyUnicodeWriter_WriteStr(_PyUnicodeWriter *writer,
681+
PyObject *str /* Unicode string */
684682
);
685683

686684
/* Append a substring of a Unicode string.
687685
Return 0 on success, raise an exception and return -1 on error. */
688-
PyAPI_FUNC(int) _PyUnicodeWriter_WriteSubstring(
689-
_PyUnicodeWriter *writer,
690-
PyObject *unicode, /* Unicode string */
686+
PyAPI_FUNC(int)
687+
_PyUnicodeWriter_WriteSubstring(_PyUnicodeWriter *writer,
688+
PyObject *str, /* Unicode string */
691689
Py_ssize_t start,
692690
Py_ssize_t end
693691
);
694692

695693
/* Append an ASCII-encoded byte string.
696694
Return 0 on success, raise an exception and return -1 on error. */
697-
PyAPI_FUNC(int) _PyUnicodeWriter_WriteASCIIString(
698-
_PyUnicodeWriter *writer,
695+
PyAPI_FUNC(int)
696+
_PyUnicodeWriter_WriteASCIIString(_PyUnicodeWriter *writer,
699697
const char *str, /* ASCII-encoded byte string */
700698
Py_ssize_t len /* number of bytes, or -1 if unknown */
701699
);
702700

703701
/* Append a latin1-encoded byte string.
704702
Return 0 on success, raise an exception and return -1 on error. */
705-
PyAPI_FUNC(int) _PyUnicodeWriter_WriteLatin1String(
706-
_PyUnicodeWriter *writer,
703+
PyAPI_FUNC(int)
704+
_PyUnicodeWriter_WriteLatin1String(_PyUnicodeWriter *writer,
707705
const char *str, /* latin1-encoded byte string */
708706
Py_ssize_t len /* length in bytes */
709707
);
710708

711709
/* Get the value of the writer as a Unicode string. Clear the
712710
buffer of the writer. Raise an exception and return NULL
713711
on error. */
714-
PyAPI_FUNC(PyObject *) _PyUnicodeWriter_Finish(
715-
_PyUnicodeWriter *writer
716-
);
712+
PyAPI_FUNC(PyObject *)
713+
_PyUnicodeWriter_Finish(_PyUnicodeWriter *writer);
717714

718715
/* Deallocate memory of a writer (clear its internal buffer). */
719-
PyAPI_FUNC(void) _PyUnicodeWriter_Dealloc(
720-
_PyUnicodeWriter *writer
721-
);
716+
PyAPI_FUNC(void)
717+
_PyUnicodeWriter_Dealloc(_PyUnicodeWriter *writer);
722718

723719

724720
/* Format the object based on the format_spec, as defined in PEP 3101
@@ -728,13 +724,12 @@ PyAPI_FUNC(int) _PyUnicode_FormatAdvancedWriter(
728724
PyObject *obj,
729725
PyObject *format_spec,
730726
Py_ssize_t start,
731-
Py_ssize_t end
732-
);
727+
Py_ssize_t end);
733728

734729
/* --- wchar_t support for platforms which support it --------------------- */
735730

736731
#ifdef HAVE_WCHAR_H
737-
PyAPI_FUNC(void*) _PyUnicode_AsKind(PyObject *unicode, unsigned int kind);
732+
PyAPI_FUNC(void*) _PyUnicode_AsKind(PyObject *s, unsigned int kind);
738733
#endif
739734

740735
/* --- Manage the default encoding ---------------------------------------- */
@@ -761,8 +756,7 @@ PyAPI_FUNC(void*) _PyUnicode_AsKind(PyObject *unicode, unsigned int kind);
761756

762757
PyAPI_FUNC(const char *) PyUnicode_AsUTF8AndSize(
763758
PyObject *unicode,
764-
Py_ssize_t *size
765-
);
759+
Py_ssize_t *size);
766760

767761
#define _PyUnicode_AsStringAndSize PyUnicode_AsUTF8AndSize
768762

@@ -822,8 +816,7 @@ PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF7(
822816

823817
PyAPI_FUNC(PyObject*) _PyUnicode_AsUTF8String(
824818
PyObject *unicode,
825-
const char *errors
826-
);
819+
const char *errors);
827820

828821
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8(
829822
const Py_UNICODE *data, /* Unicode char buffer */
@@ -841,7 +834,7 @@ Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32(
841834
);
842835

843836
PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF32(
844-
PyObject *unicode, /* Unicode object */
837+
PyObject *object, /* Unicode object */
845838
const char *errors, /* error handling */
846839
int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */
847840
);
@@ -875,7 +868,7 @@ Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16(
875868
);
876869

877870
PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF16(
878-
PyObject *unicode, /* Unicode object */
871+
PyObject* unicode, /* Unicode object */
879872
const char *errors, /* error handling */
880873
int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */
881874
);
@@ -885,7 +878,7 @@ PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF16(
885878
/* Helper for PyUnicode_DecodeUnicodeEscape that detects invalid escape
886879
chars. */
887880
PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscape(
888-
const char *str, /* Unicode-Escape encoded string */
881+
const char *string, /* Unicode-Escape encoded string */
889882
Py_ssize_t length, /* size of string */
890883
const char *errors, /* error handling */
891884
const char **first_invalid_escape /* on return, points to first
@@ -959,7 +952,7 @@ PyAPI_FUNC(PyObject*) _PyUnicode_EncodeCharmap(
959952
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap(
960953
const Py_UNICODE *data, /* Unicode char buffer */
961954
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
962-
PyObject *mapping, /* Translate table */
955+
PyObject *table, /* Translate table */
963956
const char *errors /* error handling */
964957
);
965958

@@ -1012,7 +1005,7 @@ Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS(
10121005

10131006
/* Py_DEPRECATED(3.3) */
10141007
PyAPI_FUNC(PyObject*) PyUnicode_TransformDecimalToASCII(
1015-
Py_UNICODE *str, /* Unicode buffer */
1008+
Py_UNICODE *s, /* Unicode buffer */
10161009
Py_ssize_t length /* Number of Py_UNICODE chars to transform */
10171010
);
10181011

@@ -1047,8 +1040,8 @@ PyAPI_FUNC(int) _PyUnicode_EqualToASCIIId(
10471040
0 otherwise. The right argument must be ASCII-encoded string.
10481041
Any error occurs inside will be cleared before return. */
10491042
PyAPI_FUNC(int) _PyUnicode_EqualToASCIIString(
1050-
PyObject *unicode,
1051-
const char *str /* ASCII-encoded string */
1043+
PyObject *left,
1044+
const char *right /* ASCII-encoded string */
10521045
);
10531046

10541047
/* Externally visible for str.strip(unicode) */
@@ -1070,8 +1063,7 @@ PyAPI_FUNC(Py_ssize_t) _PyUnicode_InsertThousandsGrouping(
10701063
Py_ssize_t min_width,
10711064
const char *grouping,
10721065
PyObject *thousands_sep,
1073-
Py_UCS4 *maxchar
1074-
);
1066+
Py_UCS4 *maxchar);
10751067

10761068
/* === Characters Type APIs =============================================== */
10771069

@@ -1223,12 +1215,7 @@ Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strrchr(
12231215
Py_UNICODE c
12241216
);
12251217

1226-
PyAPI_FUNC(PyObject*) _PyUnicode_FormatLong(
1227-
PyObject *val,
1228-
int alt,
1229-
int prec,
1230-
int type
1231-
);
1218+
PyAPI_FUNC(PyObject*) _PyUnicode_FormatLong(PyObject *, int, int, int);
12321219

12331220
/* Create a copy of a unicode string ending with a nul character. Return NULL
12341221
and raise a MemoryError exception on memory allocation failure, otherwise
@@ -1239,16 +1226,13 @@ Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) PyUnicode_AsUnicodeCopy(
12391226
);
12401227

12411228
/* Return an interned Unicode object for an Identifier; may fail if there is no memory.*/
1242-
PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier *id);
1229+
PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier*);
12431230
/* Clear all static strings. */
12441231
PyAPI_FUNC(void) _PyUnicode_ClearStaticStrings(void);
12451232

12461233
/* Fast equality check when the inputs are known to be exact unicode types
12471234
and where the hash values are equal (i.e. a very probable match) */
1248-
PyAPI_FUNC(int) _PyUnicode_EQ(
1249-
PyObject *left,
1250-
PyObject *right
1251-
);
1235+
PyAPI_FUNC(int) _PyUnicode_EQ(PyObject *, PyObject *);
12521236

12531237
#ifdef __cplusplus
12541238
}

Include/internal/pycore_fileutils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ extern "C" {
1313
PyAPI_DATA(int) _Py_HasFileSystemDefaultEncodeErrors;
1414

1515
PyAPI_FUNC(int) _Py_DecodeUTF8Ex(
16-
const char *str,
17-
Py_ssize_t size,
16+
const char *arg,
17+
Py_ssize_t arglen,
1818
wchar_t **wstr,
1919
size_t *wlen,
2020
const char **reason,

0 commit comments

Comments
 (0)