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
f06e30af
Commit
f06e30af
authored
Nov 24, 2005
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
parent
9df23ea1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
5 deletions
+47
-5
Doc/api/utilities.tex
Doc/api/utilities.tex
+24
-2
Misc/NEWS
Misc/NEWS
+3
-0
Python/modsupport.c
Python/modsupport.c
+20
-3
No files found.
Doc/api/utilities.tex
View file @
f06e30af
...
...
@@ -836,14 +836,36 @@ PyArg_ParseTuple(args, "O|O:ref", &object, &callback)
Convert a plain C
\ctype
{
int
}
to a Python integer object.
\item
[\samp{b} (integer) {[char]
}
]
Same as
\samp
{
i
}
.
Convert a plain C
\ctype
{
char
}
to a Python integer object
.
\item
[\samp{h} (integer) {[short int]
}
]
Same as
\samp
{
i
}
.
Convert a plain C
\ctype
{
short int
}
to a Python integer object
.
\item
[\samp{l} (integer) {[long int]
}
]
Convert a C
\ctype
{
long int
}
to a Python integer object.
\item
[\samp{B} (integer) {[unsigned char]
}
]
Convert a C
\ctype
{
unsigned char
}
to a Python integer object.
\item
[\samp{H} (integer) {[unsigned short int]
}
]
Convert a C
\ctype
{
unsigned short int
}
to a Python integer object.
\item
[\samp{I} (integer/long) {[unsigned int]
}
]
Convert a C
\ctype
{
unsigned int
}
to a Python integer object
or a Python long integer object, if it is larger than
\code
{
sys.maxint
}
.
\item
[\samp{k} (integer/long) {[unsigned long]
}
]
Convert a C
\ctype
{
unsigned long
}
to a Python integer object
or a Python long integer object, if it is larger than
\code
{
sys.maxint
}
.
\item
[\samp{L} (long) {[PY_LONG_LONG]
}
]
Convert a C
\ctype
{
long long
}
to a Python long integer object. Only
available on platforms that support
\ctype
{
long long
}
.
\item
[\samp{K} (long) {[unsigned PY_LONG_LONG]
}
]
Convert a C
\ctype
{
unsigned long long
}
to a Python long integer object.
Only available on platforms that support
\ctype
{
unsigned long long
}
.
\item
[\samp{c} (string of length 1) {[char]
}
]
Convert a C
\ctype
{
int
}
representing a character to a Python
string of length 1.
...
...
Misc/NEWS
View file @
f06e30af
...
...
@@ -12,6 +12,9 @@ What's New in Python 2.5 alpha 1?
Core and builtins
-----------------
- Bug #1281408: Py_BuildValue now works correct even with unsigned longs
and long longs.
- SF Bug #1350188, "setdlopenflags" leads to crash upon "import"
It was possible dlerror() returns a NULL pointer, use a default error
message in this case.
...
...
Python/modsupport.c
View file @
f06e30af
...
...
@@ -303,18 +303,35 @@ do_mkvalue(char **p_format, va_list *p_va)
case
'H'
:
return
PyInt_FromLong
((
long
)
va_arg
(
*
p_va
,
unsigned
int
));
case
'I'
:
{
unsigned
int
n
;
n
=
va_arg
(
*
p_va
,
unsigned
int
);
if
(
n
>
PyInt_GetMax
())
return
PyLong_FromUnsignedLong
((
unsigned
long
)
n
);
else
return
PyInt_FromLong
(
n
);
}
case
'l'
:
return
PyInt_FromLong
(
(
long
)
va_arg
(
*
p_va
,
long
));
return
PyInt_FromLong
(
va_arg
(
*
p_va
,
long
));
case
'k'
:
return
PyInt_FromLong
((
long
)
va_arg
(
*
p_va
,
unsigned
long
));
{
unsigned
long
n
;
n
=
va_arg
(
*
p_va
,
unsigned
long
);
if
(
n
>
PyInt_GetMax
())
return
PyLong_FromUnsignedLong
(
n
);
else
return
PyInt_FromLong
(
n
);
}
#ifdef HAVE_LONG_LONG
case
'L'
:
return
PyLong_FromLongLong
((
PY_LONG_LONG
)
va_arg
(
*
p_va
,
PY_LONG_LONG
));
case
'K'
:
return
PyLong_FromLongLong
((
PY_LONG_LONG
)
va_arg
(
*
p_va
,
unsigned
PY_LONG_LONG
));
return
PyLong_From
Unsigned
LongLong
((
PY_LONG_LONG
)
va_arg
(
*
p_va
,
unsigned
PY_LONG_LONG
));
#endif
#ifdef Py_USING_UNICODE
case
'u'
:
...
...
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