Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
0d2f16a6
Commit
0d2f16a6
authored
Jan 11, 2012
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove some usage of Py_UNICODE_TOUPPER/LOWER
parent
04fd196b
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
21 additions
and
27 deletions
+21
-27
Objects/stringlib/asciilib.h
Objects/stringlib/asciilib.h
+0
-2
Objects/stringlib/stringdefs.h
Objects/stringlib/stringdefs.h
+0
-2
Objects/stringlib/ucs1lib.h
Objects/stringlib/ucs1lib.h
+0
-2
Objects/stringlib/ucs2lib.h
Objects/stringlib/ucs2lib.h
+0
-2
Objects/stringlib/ucs4lib.h
Objects/stringlib/ucs4lib.h
+0
-2
Objects/stringlib/unicodedefs.h
Objects/stringlib/unicodedefs.h
+0
-2
Python/_warnings.c
Python/_warnings.c
+5
-4
Python/formatter_unicode.c
Python/formatter_unicode.c
+16
-11
No files found.
Objects/stringlib/asciilib.h
View file @
0d2f16a6
...
...
@@ -15,8 +15,6 @@
#define STRINGLIB_ISLINEBREAK BLOOM_LINEBREAK
#define STRINGLIB_ISDECIMAL Py_UNICODE_ISDECIMAL
#define STRINGLIB_TODECIMAL Py_UNICODE_TODECIMAL
#define STRINGLIB_TOUPPER Py_UNICODE_TOUPPER
#define STRINGLIB_TOLOWER Py_UNICODE_TOLOWER
#define STRINGLIB_STR PyUnicode_1BYTE_DATA
#define STRINGLIB_LEN PyUnicode_GET_LENGTH
#define STRINGLIB_NEW unicode_fromascii
...
...
Objects/stringlib/stringdefs.h
View file @
0d2f16a6
...
...
@@ -18,8 +18,6 @@
#define STRINGLIB_ISLINEBREAK(x) ((x == '\n') || (x == '\r'))
#define STRINGLIB_ISDECIMAL(x) ((x >= '0') && (x <= '9'))
#define STRINGLIB_TODECIMAL(x) (STRINGLIB_ISDECIMAL(x) ? (x - '0') : -1)
#define STRINGLIB_TOUPPER Py_TOUPPER
#define STRINGLIB_TOLOWER Py_TOLOWER
#define STRINGLIB_STR PyBytes_AS_STRING
#define STRINGLIB_LEN PyBytes_GET_SIZE
#define STRINGLIB_NEW PyBytes_FromStringAndSize
...
...
Objects/stringlib/ucs1lib.h
View file @
0d2f16a6
...
...
@@ -15,8 +15,6 @@
#define STRINGLIB_ISLINEBREAK BLOOM_LINEBREAK
#define STRINGLIB_ISDECIMAL Py_UNICODE_ISDECIMAL
#define STRINGLIB_TODECIMAL Py_UNICODE_TODECIMAL
#define STRINGLIB_TOUPPER Py_UNICODE_TOUPPER
#define STRINGLIB_TOLOWER Py_UNICODE_TOLOWER
#define STRINGLIB_STR PyUnicode_1BYTE_DATA
#define STRINGLIB_LEN PyUnicode_GET_LENGTH
#define STRINGLIB_NEW _PyUnicode_FromUCS1
...
...
Objects/stringlib/ucs2lib.h
View file @
0d2f16a6
...
...
@@ -15,8 +15,6 @@
#define STRINGLIB_ISLINEBREAK BLOOM_LINEBREAK
#define STRINGLIB_ISDECIMAL Py_UNICODE_ISDECIMAL
#define STRINGLIB_TODECIMAL Py_UNICODE_TODECIMAL
#define STRINGLIB_TOUPPER Py_UNICODE_TOUPPER
#define STRINGLIB_TOLOWER Py_UNICODE_TOLOWER
#define STRINGLIB_STR PyUnicode_2BYTE_DATA
#define STRINGLIB_LEN PyUnicode_GET_LENGTH
#define STRINGLIB_NEW _PyUnicode_FromUCS2
...
...
Objects/stringlib/ucs4lib.h
View file @
0d2f16a6
...
...
@@ -15,8 +15,6 @@
#define STRINGLIB_ISLINEBREAK BLOOM_LINEBREAK
#define STRINGLIB_ISDECIMAL Py_UNICODE_ISDECIMAL
#define STRINGLIB_TODECIMAL Py_UNICODE_TODECIMAL
#define STRINGLIB_TOUPPER Py_UNICODE_TOUPPER
#define STRINGLIB_TOLOWER Py_UNICODE_TOLOWER
#define STRINGLIB_STR PyUnicode_4BYTE_DATA
#define STRINGLIB_LEN PyUnicode_GET_LENGTH
#define STRINGLIB_NEW _PyUnicode_FromUCS4
...
...
Objects/stringlib/unicodedefs.h
View file @
0d2f16a6
...
...
@@ -18,8 +18,6 @@
#define STRINGLIB_ISLINEBREAK BLOOM_LINEBREAK
#define STRINGLIB_ISDECIMAL Py_UNICODE_ISDECIMAL
#define STRINGLIB_TODECIMAL Py_UNICODE_TODECIMAL
#define STRINGLIB_TOUPPER Py_UNICODE_TOUPPER
#define STRINGLIB_TOLOWER Py_UNICODE_TOLOWER
#define STRINGLIB_STR PyUnicode_AS_UNICODE
#define STRINGLIB_LEN PyUnicode_GET_SIZE
#define STRINGLIB_NEW PyUnicode_FromUnicode
...
...
Python/_warnings.c
View file @
0d2f16a6
...
...
@@ -510,13 +510,14 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno,
kind
=
PyUnicode_KIND
(
*
filename
);
data
=
PyUnicode_DATA
(
*
filename
);
#define ascii_lower(c) ((c <= 127) ? Py_TOLOWER(c) : 0)
/* if filename.lower().endswith((".pyc", ".pyo")): */
if
(
len
>=
4
&&
PyUnicode_READ
(
kind
,
data
,
len
-
4
)
==
'.'
&&
Py_UNICODE_TOLOWER
(
PyUnicode_READ
(
kind
,
data
,
len
-
3
))
==
'p'
&&
Py_UNICODE_TOLOWER
(
PyUnicode_READ
(
kind
,
data
,
len
-
2
))
==
'y'
&&
(
Py_UNICODE_TOLOWER
(
PyUnicode_READ
(
kind
,
data
,
len
-
1
))
==
'c'
||
Py_UNICODE_TOLOWER
(
PyUnicode_READ
(
kind
,
data
,
len
-
1
))
==
'o'
))
ascii_lower
(
PyUnicode_READ
(
kind
,
data
,
len
-
3
))
==
'p'
&&
ascii_lower
(
PyUnicode_READ
(
kind
,
data
,
len
-
2
))
==
'y'
&&
(
ascii_lower
(
PyUnicode_READ
(
kind
,
data
,
len
-
1
))
==
'c'
||
ascii_lower
(
PyUnicode_READ
(
kind
,
data
,
len
-
1
))
==
'o'
))
{
*
filename
=
PyUnicode_Substring
(
*
filename
,
0
,
PyUnicode_GET_LENGTH
(
*
filename
)
-
1
);
...
...
Python/formatter_unicode.c
View file @
0d2f16a6
...
...
@@ -561,13 +561,14 @@ fill_number(PyObject *out, Py_ssize_t pos, const NumberFieldWidths *spec,
return
-
1
;
if
(
toupper
)
{
Py_ssize_t
t
;
/* XXX if the upper-case prefix is wider than the target
buffer, the caller should have allocated a wider string,
but currently doesn't. */
for
(
t
=
0
;
t
<
spec
->
n_prefix
;
++
t
)
PyUnicode_WRITE
(
kind
,
data
,
pos
+
t
,
Py_UNICODE_TOUPPER
(
PyUnicode_READ
(
kind
,
data
,
pos
+
t
)));
for
(
t
=
0
;
t
<
spec
->
n_prefix
;
t
++
)
{
Py_UCS4
c
=
PyUnicode_READ
(
kind
,
data
,
pos
+
t
);
if
(
c
>
127
)
{
PyErr_SetString
(
PyExc_SystemError
,
"prefix not ASCII"
);
return
-
1
;
}
PyUnicode_WRITE
(
kind
,
data
,
pos
+
t
,
Py_TOUPPER
(
c
));
}
}
pos
+=
spec
->
n_prefix
;
}
...
...
@@ -607,10 +608,14 @@ fill_number(PyObject *out, Py_ssize_t pos, const NumberFieldWidths *spec,
}
if
(
toupper
)
{
Py_ssize_t
t
;
for
(
t
=
0
;
t
<
spec
->
n_grouped_digits
;
++
t
)
PyUnicode_WRITE
(
kind
,
data
,
pos
+
t
,
Py_UNICODE_TOUPPER
(
PyUnicode_READ
(
kind
,
data
,
pos
+
t
)));
for
(
t
=
0
;
t
<
spec
->
n_grouped_digits
;
t
++
)
{
Py_UCS4
c
=
PyUnicode_READ
(
kind
,
data
,
pos
+
t
);
if
(
c
>
127
)
{
PyErr_SetString
(
PyExc_SystemError
,
"non-ascii grouped digit"
);
return
-
1
;
}
PyUnicode_WRITE
(
kind
,
data
,
pos
+
t
,
Py_TOUPPER
(
c
));
}
}
pos
+=
spec
->
n_grouped_digits
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment