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
a369c5ab
Commit
a369c5ab
authored
Aug 25, 2007
by
Neal Norwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use unicode
parent
1978470c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
22 deletions
+37
-22
Objects/descrobject.c
Objects/descrobject.c
+8
-8
Objects/typeobject.c
Objects/typeobject.c
+25
-10
PC/winsound.c
PC/winsound.c
+1
-1
Python/future.c
Python/future.c
+1
-1
Python/pythonrun.c
Python/pythonrun.c
+2
-2
No files found.
Objects/descrobject.c
View file @
a369c5ab
...
...
@@ -316,7 +316,7 @@ method_get_doc(PyMethodDescrObject *descr, void *closure)
Py_INCREF
(
Py_None
);
return
Py_None
;
}
return
Py
String
_FromString
(
descr
->
d_method
->
ml_doc
);
return
Py
Unicode
_FromString
(
descr
->
d_method
->
ml_doc
);
}
static
PyMemberDef
descr_members
[]
=
{
...
...
@@ -337,7 +337,7 @@ member_get_doc(PyMemberDescrObject *descr, void *closure)
Py_INCREF
(
Py_None
);
return
Py_None
;
}
return
Py
String
_FromString
(
descr
->
d_member
->
doc
);
return
Py
Unicode
_FromString
(
descr
->
d_member
->
doc
);
}
static
PyGetSetDef
member_getset
[]
=
{
...
...
@@ -352,7 +352,7 @@ getset_get_doc(PyGetSetDescrObject *descr, void *closure)
Py_INCREF
(
Py_None
);
return
Py_None
;
}
return
Py
String
_FromString
(
descr
->
d_getset
->
doc
);
return
Py
Unicode
_FromString
(
descr
->
d_getset
->
doc
);
}
static
PyGetSetDef
getset_getset
[]
=
{
...
...
@@ -367,7 +367,7 @@ wrapperdescr_get_doc(PyWrapperDescrObject *descr, void *closure)
Py_INCREF
(
Py_None
);
return
Py_None
;
}
return
Py
String
_FromString
(
descr
->
d_base
->
doc
);
return
Py
Unicode
_FromString
(
descr
->
d_base
->
doc
);
}
static
PyGetSetDef
wrapperdescr_getset
[]
=
{
...
...
@@ -936,22 +936,22 @@ wrapper_objclass(wrapperobject *wp)
static
PyObject
*
wrapper_name
(
wrapperobject
*
wp
)
{
char
*
s
=
wp
->
descr
->
d_base
->
name
;
c
onst
c
har
*
s
=
wp
->
descr
->
d_base
->
name
;
return
Py
String
_FromString
(
s
);
return
Py
Unicode
_FromString
(
s
);
}
static
PyObject
*
wrapper_doc
(
wrapperobject
*
wp
)
{
char
*
s
=
wp
->
descr
->
d_base
->
doc
;
c
onst
c
har
*
s
=
wp
->
descr
->
d_base
->
doc
;
if
(
s
==
NULL
)
{
Py_INCREF
(
Py_None
);
return
Py_None
;
}
else
{
return
Py
String
_FromString
(
s
);
return
Py
Unicode
_FromString
(
s
);
}
}
...
...
Objects/typeobject.c
View file @
a369c5ab
...
...
@@ -343,7 +343,7 @@ type_get_doc(PyTypeObject *type, void *context)
{
PyObject
*
result
;
if
(
!
(
type
->
tp_flags
&
Py_TPFLAGS_HEAPTYPE
)
&&
type
->
tp_doc
!=
NULL
)
return
Py
String
_FromString
(
type
->
tp_doc
);
return
Py
Unicode
_FromString
(
type
->
tp_doc
);
result
=
PyDict_GetItemString
(
type
->
tp_dict
,
"__doc__"
);
if
(
result
==
NULL
)
{
result
=
Py_None
;
...
...
@@ -1918,15 +1918,30 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
*/
{
PyObject
*
doc
=
PyDict_GetItemString
(
dict
,
"__doc__"
);
if
(
doc
!=
NULL
&&
PyString_Check
(
doc
))
{
const
size_t
n
=
(
size_t
)
PyString_GET_SIZE
(
doc
);
char
*
tp_doc
=
(
char
*
)
PyObject_MALLOC
(
n
+
1
);
if
(
tp_doc
==
NULL
)
{
Py_DECREF
(
type
);
return
NULL
;
if
(
doc
!=
NULL
)
{
char
*
tp_doc
;
const
char
*
str
=
NULL
;
size_t
n
;
if
(
PyString_Check
(
doc
))
{
str
=
PyString_AS_STRING
(
doc
);
n
=
(
size_t
)
PyString_GET_SIZE
(
doc
);
}
else
if
(
PyUnicode_Check
(
doc
))
{
str
=
PyUnicode_AsString
(
doc
);
if
(
str
==
NULL
)
{
Py_DECREF
(
type
);
return
NULL
;
}
n
=
strlen
(
str
);
}
if
(
str
!=
NULL
)
{
tp_doc
=
(
char
*
)
PyObject_MALLOC
(
n
+
1
);
if
(
tp_doc
==
NULL
)
{
Py_DECREF
(
type
);
return
NULL
;
}
memcpy
(
tp_doc
,
str
,
n
+
1
);
type
->
tp_doc
=
tp_doc
;
}
memcpy
(
tp_doc
,
PyString_AS_STRING
(
doc
),
n
+
1
);
type
->
tp_doc
=
tp_doc
;
}
}
...
...
@@ -3485,7 +3500,7 @@ PyType_Ready(PyTypeObject *type)
*/
if
(
PyDict_GetItemString
(
type
->
tp_dict
,
"__doc__"
)
==
NULL
)
{
if
(
type
->
tp_doc
!=
NULL
)
{
PyObject
*
doc
=
Py
String
_FromString
(
type
->
tp_doc
);
PyObject
*
doc
=
Py
Unicode
_FromString
(
type
->
tp_doc
);
if
(
doc
==
NULL
)
goto
error
;
PyDict_SetItemString
(
type
->
tp_dict
,
"__doc__"
,
doc
);
...
...
PC/winsound.c
View file @
a369c5ab
...
...
@@ -202,7 +202,7 @@ static struct PyMethodDef sound_methods[] =
static
void
add_define
(
PyObject
*
dict
,
const
char
*
key
,
long
value
)
{
PyObject
*
k
=
Py
String
_FromString
(
key
);
PyObject
*
k
=
Py
Unicode
_FromString
(
key
);
PyObject
*
v
=
PyLong_FromLong
(
value
);
if
(
v
&&
k
)
{
...
...
Python/future.c
View file @
a369c5ab
...
...
@@ -20,7 +20,7 @@ future_check_features(PyFutureFeatures *ff, stmt_ty s, const char *filename)
names
=
s
->
v
.
ImportFrom
.
names
;
for
(
i
=
0
;
i
<
asdl_seq_LEN
(
names
);
i
++
)
{
alias_ty
name
=
(
alias_ty
)
asdl_seq_GET
(
names
,
i
);
const
char
*
feature
=
Py
String
_AsString
(
name
->
name
);
const
char
*
feature
=
Py
Unicode
_AsString
(
name
->
name
);
if
(
!
feature
)
return
0
;
if
(
strcmp
(
feature
,
FUTURE_NESTED_SCOPES
)
==
0
)
{
...
...
Python/pythonrun.c
View file @
a369c5ab
...
...
@@ -707,12 +707,12 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename, PyCompilerFlags *flag
}
v
=
PySys_GetObject
(
"ps1"
);
if
(
v
==
NULL
)
{
PySys_SetObject
(
"ps1"
,
v
=
Py
String
_FromString
(
">>> "
));
PySys_SetObject
(
"ps1"
,
v
=
Py
Unicode
_FromString
(
">>> "
));
Py_XDECREF
(
v
);
}
v
=
PySys_GetObject
(
"ps2"
);
if
(
v
==
NULL
)
{
PySys_SetObject
(
"ps2"
,
v
=
Py
String
_FromString
(
"... "
));
PySys_SetObject
(
"ps2"
,
v
=
Py
Unicode
_FromString
(
"... "
));
Py_XDECREF
(
v
);
}
for
(;;)
{
...
...
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