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

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 Objects/bytearrayobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,7 @@ bytearray_dealloc(PyByteArrayObject *self)
/* -------------------------------------------------------------------- */
/* Methods */

#define STRINGLIB_IS_UNICODE 0
#define FASTSEARCH fastsearch
#define STRINGLIB(F) stringlib_##F
#define STRINGLIB_CHAR char
Expand Down
1 change: 1 addition & 0 deletions 1 Objects/bytesobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,7 @@ PyBytes_AsStringAndSize(PyObject *obj,
#define STRINGLIB_GET_EMPTY() bytes_get_empty()

#include "stringlib/stringdefs.h"
#define STRINGLIB_MUTABLE 0

#include "stringlib/fastsearch.h"
#include "stringlib/count.h"
Expand Down
1 change: 1 addition & 0 deletions 1 Objects/stringlib/asciilib.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define STRINGLIB_NEW(STR,LEN) _PyUnicode_FromASCII((const char*)(STR),(LEN))
#define STRINGLIB_CHECK PyUnicode_Check
#define STRINGLIB_CHECK_EXACT PyUnicode_CheckExact
#define STRINGLIB_MUTABLE 0

#define STRINGLIB_TOSTR PyObject_Str
#define STRINGLIB_TOASCII PyObject_ASCII
2 changes: 1 addition & 1 deletion 2 Objects/stringlib/join.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ STRINGLIB(bytes_join)(PyObject *sep, PyObject *iterable)
Py_DECREF(seq);
return STRINGLIB_NEW(NULL, 0);
}
#ifndef STRINGLIB_MUTABLE
#if !STRINGLIB_MUTABLE
if (seqlen == 1) {
item = PySequence_Fast_GET_ITEM(seq, 0);
if (STRINGLIB_CHECK_EXACT(item)) {
Expand Down
14 changes: 7 additions & 7 deletions 14 Objects/stringlib/split.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ STRINGLIB(split_whitespace)(PyObject* str_obj,
j = i; i++;
while (i < str_len && !STRINGLIB_ISSPACE(str[i]))
i++;
#ifndef STRINGLIB_MUTABLE
#if !STRINGLIB_MUTABLE
if (j == 0 && i == str_len && STRINGLIB_CHECK_EXACT(str_obj)) {
/* No whitespace in str_obj, so just use it as list[0] */
Py_INCREF(str_obj);
Expand Down Expand Up @@ -122,7 +122,7 @@ STRINGLIB(split_char)(PyObject* str_obj,
}
}
}
#ifndef STRINGLIB_MUTABLE
#if !STRINGLIB_MUTABLE
if (count == 0 && STRINGLIB_CHECK_EXACT(str_obj)) {
/* ch not in str_obj, so just use str_obj as list[0] */
Py_INCREF(str_obj);
Expand Down Expand Up @@ -170,7 +170,7 @@ STRINGLIB(split)(PyObject* str_obj,
SPLIT_ADD(str, i, j);
i = j + sep_len;
}
#ifndef STRINGLIB_MUTABLE
#if !STRINGLIB_MUTABLE
if (count == 0 && STRINGLIB_CHECK_EXACT(str_obj)) {
/* No match in str_obj, so just use it as list[0] */
Py_INCREF(str_obj);
Expand Down Expand Up @@ -209,7 +209,7 @@ STRINGLIB(rsplit_whitespace)(PyObject* str_obj,
j = i; i--;
while (i >= 0 && !STRINGLIB_ISSPACE(str[i]))
i--;
#ifndef STRINGLIB_MUTABLE
#if !STRINGLIB_MUTABLE
if (j == str_len - 1 && i < 0 && STRINGLIB_CHECK_EXACT(str_obj)) {
/* No whitespace in str_obj, so just use it as list[0] */
Py_INCREF(str_obj);
Expand Down Expand Up @@ -262,7 +262,7 @@ STRINGLIB(rsplit_char)(PyObject* str_obj,
}
}
}
#ifndef STRINGLIB_MUTABLE
#if !STRINGLIB_MUTABLE
if (count == 0 && STRINGLIB_CHECK_EXACT(str_obj)) {
/* ch not in str_obj, so just use str_obj as list[0] */
Py_INCREF(str_obj);
Expand Down Expand Up @@ -311,7 +311,7 @@ STRINGLIB(rsplit)(PyObject* str_obj,
SPLIT_ADD(str, pos + sep_len, j);
j = pos;
}
#ifndef STRINGLIB_MUTABLE
#if !STRINGLIB_MUTABLE
if (count == 0 && STRINGLIB_CHECK_EXACT(str_obj)) {
/* No match in str_obj, so just use it as list[0] */
Py_INCREF(str_obj);
Expand Down Expand Up @@ -370,7 +370,7 @@ STRINGLIB(splitlines)(PyObject* str_obj,
if (keepends)
eol = i;
}
#ifndef STRINGLIB_MUTABLE
#if !STRINGLIB_MUTABLE
if (j == 0 && eol == str_len && STRINGLIB_CHECK_EXACT(str_obj)) {
/* No linebreak in str_obj, so just use it as list[0] */
if (PyList_Append(list, str_obj))
Expand Down
1 change: 1 addition & 0 deletions 1 Objects/stringlib/ucs1lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define STRINGLIB_NEW _PyUnicode_FromUCS1
#define STRINGLIB_CHECK PyUnicode_Check
#define STRINGLIB_CHECK_EXACT PyUnicode_CheckExact
#define STRINGLIB_MUTABLE 0

#define STRINGLIB_TOSTR PyObject_Str
#define STRINGLIB_TOASCII PyObject_ASCII
1 change: 1 addition & 0 deletions 1 Objects/stringlib/ucs2lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define STRINGLIB_NEW _PyUnicode_FromUCS2
#define STRINGLIB_CHECK PyUnicode_Check
#define STRINGLIB_CHECK_EXACT PyUnicode_CheckExact
#define STRINGLIB_MUTABLE 0

#define STRINGLIB_TOSTR PyObject_Str
#define STRINGLIB_TOASCII PyObject_ASCII
1 change: 1 addition & 0 deletions 1 Objects/stringlib/ucs4lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define STRINGLIB_NEW _PyUnicode_FromUCS4
#define STRINGLIB_CHECK PyUnicode_Check
#define STRINGLIB_CHECK_EXACT PyUnicode_CheckExact
#define STRINGLIB_MUTABLE 0

#define STRINGLIB_TOSTR PyObject_Str
#define STRINGLIB_TOASCII PyObject_ASCII
Expand Down
18 changes: 9 additions & 9 deletions 18 Objects/stringlib/undef.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#undef FASTSEARCH
#undef STRINGLIB
#undef STRINGLIB_SIZEOF_CHAR
#undef STRINGLIB_MAX_CHAR
#undef STRINGLIB_CHAR
#undef STRINGLIB_STR
#undef STRINGLIB_LEN
#undef STRINGLIB_NEW
#undef FASTSEARCH
#undef STRINGLIB
#undef STRINGLIB_SIZEOF_CHAR
#undef STRINGLIB_MAX_CHAR
#undef STRINGLIB_CHAR
#undef STRINGLIB_STR
#undef STRINGLIB_LEN
#undef STRINGLIB_NEW
#undef STRINGLIB_IS_UNICODE

#undef STRINGLIB_MUTABLE
1 change: 1 addition & 0 deletions 1 Objects/stringlib/unicodedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#define STRINGLIB_NEW PyUnicode_FromUnicode
#define STRINGLIB_CHECK PyUnicode_Check
#define STRINGLIB_CHECK_EXACT PyUnicode_CheckExact
#define STRINGLIB_MUTABLE 0

#define STRINGLIB_TOSTR PyObject_Str
#define STRINGLIB_TOASCII PyObject_ASCII
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.