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
f4780d03
Commit
f4780d03
authored
Aug 30, 2007
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #1753395.
parent
47cc2a00
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
16 deletions
+4
-16
Objects/typeobject.c
Objects/typeobject.c
+4
-16
No files found.
Objects/typeobject.c
View file @
f4780d03
...
...
@@ -1561,28 +1561,16 @@ static PyGetSetDef subtype_getsets_weakref_only[] = {
static
int
valid_identifier
(
PyObject
*
s
)
{
Py_UNICODE
*
p
;
Py_ssize_t
i
,
n
;
if
(
!
PyUnicode_Check
(
s
))
{
PyErr_Format
(
PyExc_TypeError
,
"__slots__ items must be strings, not '%.200s'"
,
Py_Type
(
s
)
->
tp_name
);
return
0
;
}
p
=
PyUnicode_AS_UNICODE
(
s
);
n
=
PyUnicode_GET_SIZE
(
s
);
/* We must reject an empty name. As a hack, we bump the
length to 1 so that the loop will balk on the trailing \0. */
if
(
n
==
0
)
n
=
1
;
for
(
i
=
0
;
i
<
n
;
i
++
,
p
++
)
{
if
(
*
p
>
127
||
(
!
(
i
==
0
?
isalpha
(
*
p
)
:
isalnum
(
*
p
))
&&
*
p
!=
'_'
))
{
PyErr_SetString
(
PyExc_TypeError
,
"__slots__ must be identifiers"
);
return
0
;
}
if
(
!
PyUnicode_IsIdentifier
(
s
))
{
PyErr_SetString
(
PyExc_TypeError
,
"__slots__ must be identifiers"
);
return
0
;
}
return
1
;
}
...
...
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