summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Objects/bytes_methods.c
diff options
context:
space:
mode:
authorAlexSm <[email protected]>2024-02-16 11:51:30 +0100
committerGitHub <[email protected]>2024-02-16 11:51:30 +0100
commit506ecaee93b52cc12c2e2f97c3d42e3ca2a7f59e (patch)
treed096fb9eb988fbb0ca1ba970041773207ce3aa70 /contrib/tools/python3/src/Objects/bytes_methods.c
parent4749b9e5d260714490997e6f5ee1ee8c1c8fc46c (diff)
parentf200f72c9d7a89c1018e3dc6b46c49fe2ecf84fb (diff)
Merge pull request #1940 from dcherednik/importlib
Library import 14
Diffstat (limited to 'contrib/tools/python3/src/Objects/bytes_methods.c')
-rw-r--r--contrib/tools/python3/src/Objects/bytes_methods.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/contrib/tools/python3/src/Objects/bytes_methods.c b/contrib/tools/python3/src/Objects/bytes_methods.c
index 994fb8a73c6..33aa9c3db6e 100644
--- a/contrib/tools/python3/src/Objects/bytes_methods.c
+++ b/contrib/tools/python3/src/Objects/bytes_methods.c
@@ -258,9 +258,12 @@ _Py_bytes_istitle(const char *cptr, Py_ssize_t len)
const unsigned char *e;
int cased, previous_is_cased;
- /* Shortcut for single character strings */
- if (len == 1)
- return PyBool_FromLong(Py_ISUPPER(*p));
+ if (len == 1) {
+ if (Py_ISUPPER(*p)) {
+ Py_RETURN_TRUE;
+ }
+ Py_RETURN_FALSE;
+ }
/* Special case for empty strings */
if (len == 0)
@@ -431,6 +434,7 @@ _Py_bytes_maketrans(Py_buffer *frm, Py_buffer *to)
#define STRINGLIB(F) stringlib_##F
#define STRINGLIB_CHAR char
#define STRINGLIB_SIZEOF_CHAR 1
+#define STRINGLIB_FAST_MEMCHR memchr
#include "stringlib/fastsearch.h"
#include "stringlib/count.h"
@@ -773,7 +777,7 @@ _Py_bytes_tailmatch(const char *str, Py_ssize_t len,
{
Py_ssize_t start = 0;
Py_ssize_t end = PY_SSIZE_T_MAX;
- PyObject *subobj;
+ PyObject *subobj = NULL;
int result;
if (!stringlib_parse_args_finds(function_name, args, &subobj, &start, &end))