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
7eeb5b5e
Commit
7eeb5b5e
authored
Jun 07, 2010
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #8848: U / U# formats of Py_BuildValue() are just alias to s / s#
parent
fa68a618
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
9 additions
and
43 deletions
+9
-43
Doc/c-api/arg.rst
Doc/c-api/arg.rst
+2
-4
Modules/_ctypes/_ctypes.c
Modules/_ctypes/_ctypes.c
+1
-1
Objects/exceptions.c
Objects/exceptions.c
+2
-2
Python/Python-ast.c
Python/Python-ast.c
+1
-1
Python/errors.c
Python/errors.c
+1
-1
Python/modsupport.c
Python/modsupport.c
+1
-33
Python/sysmodule.c
Python/sysmodule.c
+1
-1
No files found.
Doc/c-api/arg.rst
View file @
7eeb5b5e
...
...
@@ -530,12 +530,10 @@ Building values
and ``None`` is returned.
``U`` (string) [char \*]
Convert a null-terminated C string to a Python unicode object. If the C string
pointer is *NULL*, ``None`` is used.
Same as ``s``.
``U#`` (string) [char \*, int]
Convert a C string and its length to a Python unicode object. If the C string
pointer is *NULL*, the length is ignored and ``None`` is returned.
Same as ``s#``.
``i`` (integer) [int]
Convert a plain C :ctype:`int` to a Python integer object.
...
...
Modules/_ctypes/_ctypes.c
View file @
7eeb5b5e
...
...
@@ -4467,7 +4467,7 @@ PyCArrayType_from_ctype(PyObject *itemtype, Py_ssize_t length)
#endif
result
=
PyObject_CallFunction
((
PyObject
*
)
&
PyCArrayType_Type
,
"
U
(O){s:n,s:O}"
,
"
s
(O){s:n,s:O}"
,
name
,
&
PyCArray_Type
,
"_length_"
,
...
...
Objects/exceptions.c
View file @
7eeb5b5e
...
...
@@ -1510,7 +1510,7 @@ PyUnicodeEncodeError_Create(
const
char
*
encoding
,
const
Py_UNICODE
*
object
,
Py_ssize_t
length
,
Py_ssize_t
start
,
Py_ssize_t
end
,
const
char
*
reason
)
{
return
PyObject_CallFunction
(
PyExc_UnicodeEncodeError
,
"
Uu#nnU
"
,
return
PyObject_CallFunction
(
PyExc_UnicodeEncodeError
,
"
su#nns
"
,
encoding
,
object
,
length
,
start
,
end
,
reason
);
}
...
...
@@ -1625,7 +1625,7 @@ PyUnicodeDecodeError_Create(
assert
(
length
<
INT_MAX
);
assert
(
start
<
INT_MAX
);
assert
(
end
<
INT_MAX
);
return
PyObject_CallFunction
(
PyExc_UnicodeDecodeError
,
"
Uy#nnU
"
,
return
PyObject_CallFunction
(
PyExc_UnicodeDecodeError
,
"
sy#nns
"
,
encoding
,
object
,
length
,
start
,
end
,
reason
);
}
...
...
Python/Python-ast.c
View file @
7eeb5b5e
...
...
@@ -527,7 +527,7 @@ static PyTypeObject* make_type(char *type, PyTypeObject* base, char**fields, int
}
PyTuple_SET_ITEM
(
fnames
,
i
,
field
);
}
result
=
PyObject_CallFunction
((
PyObject
*
)
&
PyType_Type
,
"
U
(O){sOss}"
,
result
=
PyObject_CallFunction
((
PyObject
*
)
&
PyType_Type
,
"
s
(O){sOss}"
,
type
,
base
,
"_fields"
,
fnames
,
"__module__"
,
"_ast"
);
Py_DECREF
(
fnames
);
return
(
PyTypeObject
*
)
result
;
...
...
Python/errors.c
View file @
7eeb5b5e
...
...
@@ -679,7 +679,7 @@ PyErr_NewException(const char *name, PyObject *base, PyObject *dict)
goto
failure
;
}
/* Create a real new-style class. */
result
=
PyObject_CallFunction
((
PyObject
*
)
&
PyType_Type
,
"
U
OO"
,
result
=
PyObject_CallFunction
((
PyObject
*
)
&
PyType_Type
,
"
s
OO"
,
dot
+
1
,
bases
,
dict
);
failure:
Py_XDECREF
(
bases
);
...
...
Python/modsupport.c
View file @
7eeb5b5e
...
...
@@ -302,39 +302,7 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
case
's'
:
case
'z'
:
{
PyObject
*
v
;
char
*
str
=
va_arg
(
*
p_va
,
char
*
);
Py_ssize_t
n
;
if
(
**
p_format
==
'#'
)
{
++*
p_format
;
if
(
flags
&
FLAG_SIZE_T
)
n
=
va_arg
(
*
p_va
,
Py_ssize_t
);
else
n
=
va_arg
(
*
p_va
,
int
);
}
else
n
=
-
1
;
if
(
str
==
NULL
)
{
v
=
Py_None
;
Py_INCREF
(
v
);
}
else
{
if
(
n
<
0
)
{
size_t
m
=
strlen
(
str
);
if
(
m
>
PY_SSIZE_T_MAX
)
{
PyErr_SetString
(
PyExc_OverflowError
,
"string too long for Python string"
);
return
NULL
;
}
n
=
(
Py_ssize_t
)
m
;
}
v
=
PyUnicode_FromStringAndSize
(
str
,
n
);
}
return
v
;
}
case
'U'
:
case
'U'
:
/* XXX deprecated alias */
{
PyObject
*
v
;
char
*
str
=
va_arg
(
*
p_va
,
char
*
);
...
...
Python/sysmodule.c
View file @
7eeb5b5e
...
...
@@ -1510,7 +1510,7 @@ _PySys_Init(void)
PyLong_FromLong
(
PY_VERSION_HEX
));
svnversion_init
();
SET_SYS_FROM_STRING
(
"subversion"
,
Py_BuildValue
(
"(
UUU
)"
,
"CPython"
,
branch
,
Py_BuildValue
(
"(
sss
)"
,
"CPython"
,
branch
,
svn_revision
));
SET_SYS_FROM_STRING
(
"dont_write_bytecode"
,
PyBool_FromLong
(
Py_DontWriteBytecodeFlag
));
...
...
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