URL: http://github.com/python/cpython/commit/593bb30e82eded7f2ec02f7d1aa49742e6962113
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b03c2c5 commit 593bb30Copy full SHA for 593bb30
Objects/bytes_methods.c
@@ -361,23 +361,9 @@ and the rest lower-cased.");
361
void
362
_Py_bytes_capitalize(char *result, const char *s, Py_ssize_t len)
363
{
364
- Py_ssize_t i;
365
-
366
- if (0 < len) {
367
- int c = Py_CHARMASK(*s++);
368
- if (Py_ISLOWER(c))
369
- *result = Py_TOUPPER(c);
370
- else
371
- *result = c;
372
- result++;
373
- }
374
- for (i = 1; i < len; i++) {
375
376
- if (Py_ISUPPER(c))
377
- *result = Py_TOLOWER(c);
378
379
380
+ if (len > 0) {
+ *result = Py_TOUPPER(*s);
+ _Py_bytes_lower(result + 1, s + 1, len - 1);
381
}
382
383
0 commit comments