Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
ab9ca875
Commit
ab9ca875
authored
Aug 30, 2012
by
scoder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #147 from cgohlke/patch-1
Fix "PyErr_Format + PY_FORMAT_SSIZE_T likely broken in Win64"
parents
dfdfe69a
0a5cec7c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
16 additions
and
11 deletions
+16
-11
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+1
-1
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+2
-2
Cython/Utility/Buffer.c
Cython/Utility/Buffer.c
+2
-2
Cython/Utility/FunctionArguments.c
Cython/Utility/FunctionArguments.c
+1
-2
Cython/Utility/MemoryView_C.c
Cython/Utility/MemoryView_C.c
+2
-2
Cython/Utility/ModuleSetupCode.c
Cython/Utility/ModuleSetupCode.c
+6
-0
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+2
-2
No files found.
Cython/Compiler/ExprNodes.py
View file @
ab9ca875
...
@@ -3547,7 +3547,7 @@ class SliceIndexNode(ExprNode):
...
@@ -3547,7 +3547,7 @@ class SliceIndexNode(ExprNode):
check
=
stop
check
=
stop
if
check
:
if
check
:
code
.
putln
(
"if (unlikely((%s) != %d)) {"
%
(
check
,
target_size
))
code
.
putln
(
"if (unlikely((%s) != %d)) {"
%
(
check
,
target_size
))
code
.
putln
(
'PyErr_Format(PyExc_ValueError, "Assignment to slice of wrong length, expected %%"
PY_FORMAT_SIZE_T "d, got %%" PY_FORMAT_
SIZE_T "d", (Py_ssize_t)%d, (Py_ssize_t)(%s));'
%
(
code
.
putln
(
'PyErr_Format(PyExc_ValueError, "Assignment to slice of wrong length, expected %%"
CYTHON_FORMAT_SSIZE_T "d, got %%" CYTHON_FORMAT_S
SIZE_T "d", (Py_ssize_t)%d, (Py_ssize_t)(%s));'
%
(
target_size
,
check
))
target_size
,
check
))
code
.
putln
(
code
.
error_goto
(
self
.
pos
))
code
.
putln
(
code
.
error_goto
(
self
.
pos
))
code
.
putln
(
"}"
)
code
.
putln
(
"}"
)
...
...
Cython/Compiler/PyrexTypes.py
View file @
ab9ca875
...
@@ -1596,7 +1596,7 @@ static CYTHON_INLINE Py_UCS4 __Pyx_PyObject_AsPy_UCS4(PyObject* x) {
...
@@ -1596,7 +1596,7 @@ static CYTHON_INLINE Py_UCS4 __Pyx_PyObject_AsPy_UCS4(PyObject* x) {
#endif
#endif
PyErr_Format(PyExc_ValueError,
PyErr_Format(PyExc_ValueError,
"only single character unicode strings can be converted to Py_UCS4, "
"only single character unicode strings can be converted to Py_UCS4, "
"got length %"
PY_FORMAT_
SIZE_T "d", length);
"got length %"
CYTHON_FORMAT_S
SIZE_T "d", length);
return (Py_UCS4)-1;
return (Py_UCS4)-1;
}
}
ival = __Pyx_PyInt_AsLong(x);
ival = __Pyx_PyInt_AsLong(x);
...
@@ -1651,7 +1651,7 @@ static CYTHON_INLINE Py_UNICODE __Pyx_PyObject_AsPy_UNICODE(PyObject* x) {
...
@@ -1651,7 +1651,7 @@ static CYTHON_INLINE Py_UNICODE __Pyx_PyObject_AsPy_UNICODE(PyObject* x) {
if (unlikely(__Pyx_PyUnicode_GET_LENGTH(x) != 1)) {
if (unlikely(__Pyx_PyUnicode_GET_LENGTH(x) != 1)) {
PyErr_Format(PyExc_ValueError,
PyErr_Format(PyExc_ValueError,
"only single character unicode strings can be converted to Py_UNICODE, "
"only single character unicode strings can be converted to Py_UNICODE, "
"got length %"
PY_FORMAT_
SIZE_T "d", __Pyx_PyUnicode_GET_LENGTH(x));
"got length %"
CYTHON_FORMAT_S
SIZE_T "d", __Pyx_PyUnicode_GET_LENGTH(x));
return (Py_UNICODE)-1;
return (Py_UNICODE)-1;
}
}
#if CYTHON_PEP393_ENABLED
#if CYTHON_PEP393_ENABLED
...
...
Cython/Utility/Buffer.c
View file @
ab9ca875
...
@@ -544,7 +544,7 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
...
@@ -544,7 +544,7 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
offset
=
ctx
->
head
->
parent_offset
+
field
->
offset
;
offset
=
ctx
->
head
->
parent_offset
+
field
->
offset
;
if
(
ctx
->
fmt_offset
!=
offset
)
{
if
(
ctx
->
fmt_offset
!=
offset
)
{
PyErr_Format
(
PyExc_ValueError
,
PyErr_Format
(
PyExc_ValueError
,
"Buffer dtype mismatch; next field is at offset %"
PY_FORMAT_SIZE_T
"d but %"
PY_FORMAT_
SIZE_T
"d expected"
,
"Buffer dtype mismatch; next field is at offset %"
CYTHON_FORMAT_SSIZE_T
"d but %"
CYTHON_FORMAT_S
SIZE_T
"d expected"
,
(
Py_ssize_t
)
ctx
->
fmt_offset
,
(
Py_ssize_t
)
offset
);
(
Py_ssize_t
)
ctx
->
fmt_offset
,
(
Py_ssize_t
)
offset
);
return
-
1
;
return
-
1
;
}
}
...
@@ -809,7 +809,7 @@ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
...
@@ -809,7 +809,7 @@ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
}
}
if
((
unsigned
)
buf
->
itemsize
!=
dtype
->
size
)
{
if
((
unsigned
)
buf
->
itemsize
!=
dtype
->
size
)
{
PyErr_Format
(
PyExc_ValueError
,
PyErr_Format
(
PyExc_ValueError
,
"Item size of buffer (%"
PY_FORMAT_SIZE_T
"d byte%s) does not match size of '%s' (%"
PY_FORMAT_
SIZE_T
"d byte%s)"
,
"Item size of buffer (%"
CYTHON_FORMAT_SSIZE_T
"d byte%s) does not match size of '%s' (%"
CYTHON_FORMAT_S
SIZE_T
"d byte%s)"
,
buf
->
itemsize
,
(
buf
->
itemsize
>
1
)
?
"s"
:
""
,
buf
->
itemsize
,
(
buf
->
itemsize
>
1
)
?
"s"
:
""
,
dtype
->
name
,
(
Py_ssize_t
)
dtype
->
size
,
(
dtype
->
size
>
1
)
?
"s"
:
""
);
dtype
->
name
,
(
Py_ssize_t
)
dtype
->
size
,
(
dtype
->
size
>
1
)
?
"s"
:
""
);
goto
fail
;
goto
fail
;
...
...
Cython/Utility/FunctionArguments.c
View file @
ab9ca875
//////////////////// ArgTypeTest.proto ////////////////////
//////////////////// ArgTypeTest.proto ////////////////////
static
int
__Pyx_ArgTypeTest
(
PyObject
*
obj
,
PyTypeObject
*
type
,
int
none_allowed
,
static
int
__Pyx_ArgTypeTest
(
PyObject
*
obj
,
PyTypeObject
*
type
,
int
none_allowed
,
...
@@ -58,7 +57,7 @@ static void __Pyx_RaiseArgtupleInvalid(
...
@@ -58,7 +57,7 @@ static void __Pyx_RaiseArgtupleInvalid(
more_or_less
=
"exactly"
;
more_or_less
=
"exactly"
;
}
}
PyErr_Format
(
PyExc_TypeError
,
PyErr_Format
(
PyExc_TypeError
,
"%s() takes %s %"
PY_FORMAT_SIZE_T
"d positional argument%s (%"
PY_FORMAT_
SIZE_T
"d given)"
,
"%s() takes %s %"
CYTHON_FORMAT_SSIZE_T
"d positional argument%s (%"
CYTHON_FORMAT_S
SIZE_T
"d given)"
,
func_name
,
more_or_less
,
num_expected
,
func_name
,
more_or_less
,
num_expected
,
(
num_expected
==
1
)
?
""
:
"s"
,
num_found
);
(
num_expected
==
1
)
?
""
:
"s"
,
num_found
);
}
}
...
...
Cython/Utility/MemoryView_C.c
View file @
ab9ca875
...
@@ -197,8 +197,8 @@ static int __Pyx_ValidateAndInit_memviewslice(
...
@@ -197,8 +197,8 @@ static int __Pyx_ValidateAndInit_memviewslice(
if
((
unsigned
)
buf
->
itemsize
!=
dtype
->
size
)
{
if
((
unsigned
)
buf
->
itemsize
!=
dtype
->
size
)
{
PyErr_Format
(
PyExc_ValueError
,
PyErr_Format
(
PyExc_ValueError
,
"Item size of buffer (%"
PY_FORMAT_
SIZE_T
"u byte%s) "
"Item size of buffer (%"
CYTHON_FORMAT_S
SIZE_T
"u byte%s) "
"does not match size of '%s' (%"
PY_FORMAT_
SIZE_T
"u byte%s)"
,
"does not match size of '%s' (%"
CYTHON_FORMAT_S
SIZE_T
"u byte%s)"
,
buf
->
itemsize
,
buf
->
itemsize
,
(
buf
->
itemsize
>
1
)
?
"s"
:
""
,
(
buf
->
itemsize
>
1
)
?
"s"
:
""
,
dtype
->
name
,
dtype
->
name
,
...
...
Cython/Utility/ModuleSetupCode.c
View file @
ab9ca875
...
@@ -244,6 +244,12 @@
...
@@ -244,6 +244,12 @@
#define __Pyx_DOCSTR(n) (n)
#define __Pyx_DOCSTR(n) (n)
#endif
#endif
#if defined(_WIN64) && defined(_MSC_VER)
#define CYTHON_FORMAT_SSIZE_T "z"
#else
#define CYTHON_FORMAT_SSIZE_T PY_FORMAT_SIZE_T
#endif
/////////////// ForceInitThreads.proto ///////////////
/////////////// ForceInitThreads.proto ///////////////
#ifndef __PYX_FORCE_INIT_THREADS
#ifndef __PYX_FORCE_INIT_THREADS
...
...
Cython/Utility/ObjectHandling.c
View file @
ab9ca875
...
@@ -16,7 +16,7 @@ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
...
@@ -16,7 +16,7 @@ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
static
CYTHON_INLINE
void
__Pyx_RaiseTooManyValuesError
(
Py_ssize_t
expected
)
{
static
CYTHON_INLINE
void
__Pyx_RaiseTooManyValuesError
(
Py_ssize_t
expected
)
{
PyErr_Format
(
PyExc_ValueError
,
PyErr_Format
(
PyExc_ValueError
,
"too many values to unpack (expected %"
PY_FORMAT_
SIZE_T
"d)"
,
expected
);
"too many values to unpack (expected %"
CYTHON_FORMAT_S
SIZE_T
"d)"
,
expected
);
}
}
/////////////// RaiseNeedMoreValuesToUnpack.proto ///////////////
/////////////// RaiseNeedMoreValuesToUnpack.proto ///////////////
...
@@ -27,7 +27,7 @@ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
...
@@ -27,7 +27,7 @@ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
static
CYTHON_INLINE
void
__Pyx_RaiseNeedMoreValuesError
(
Py_ssize_t
index
)
{
static
CYTHON_INLINE
void
__Pyx_RaiseNeedMoreValuesError
(
Py_ssize_t
index
)
{
PyErr_Format
(
PyExc_ValueError
,
PyErr_Format
(
PyExc_ValueError
,
"need more than %"
PY_FORMAT_
SIZE_T
"d value%s to unpack"
,
"need more than %"
CYTHON_FORMAT_S
SIZE_T
"d value%s to unpack"
,
index
,
(
index
==
1
)
?
""
:
"s"
);
index
,
(
index
==
1
)
?
""
:
"s"
);
}
}
...
...
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