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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
40ad34a0
Commit
40ad34a0
authored
Feb 15, 2019
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix buffer format parsing code to allow the digit '9' in numbers.
Closes GH-2845.
parent
46a91040
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
Cython/Utility/Buffer.c
Cython/Utility/Buffer.c
+1
-1
tests/buffers/buffmt.pyx
tests/buffers/buffmt.pyx
+14
-1
No files found.
Cython/Utility/Buffer.c
View file @
40ad34a0
...
@@ -273,7 +273,7 @@ static int __Pyx_BufFmt_ParseNumber(const char** ts) {
...
@@ -273,7 +273,7 @@ static int __Pyx_BufFmt_ParseNumber(const char** ts) {
return
-
1
;
return
-
1
;
}
else
{
}
else
{
count
=
*
t
++
-
'0'
;
count
=
*
t
++
-
'0'
;
while
(
*
t
>=
'0'
&&
*
t
<
'9'
)
{
while
(
*
t
>=
'0'
&&
*
t
<
=
'9'
)
{
count
*=
10
;
count
*=
10
;
count
+=
*
t
++
-
'0'
;
count
+=
*
t
++
-
'0'
;
}
}
...
...
tests/buffers/buffmt.pyx
View file @
40ad34a0
...
@@ -37,7 +37,7 @@ if int_align != 4 or sizeof(int) != 4:
...
@@ -37,7 +37,7 @@ if int_align != 4 or sizeof(int) != 4:
cdef
class
MockBuffer
:
cdef
class
MockBuffer
:
cdef
Py_ssize_t
zero
cdef
Py_ssize_t
zero
cdef
Py_ssize_t
minusone
cdef
Py_ssize_t
minusone
cdef
object
format
cdef
bytes
format
cdef
object
itemsize
cdef
object
itemsize
def
__init__
(
self
,
format
,
itemsize
):
def
__init__
(
self
,
format
,
itemsize
):
...
@@ -117,6 +117,9 @@ ctypedef struct Char3Int:
...
@@ -117,6 +117,9 @@ ctypedef struct Char3Int:
int
c
int
c
int
d
int
d
ctypedef
struct
LongString
:
char
[
90198
]
c
cdef
struct
CharIntCFloat
:
cdef
struct
CharIntCFloat
:
char
a
char
a
int
b
int
b
...
@@ -180,6 +183,16 @@ def char3int(fmt):
...
@@ -180,6 +183,16 @@ def char3int(fmt):
cdef
object
obj
=
MockBuffer
(
fmt
,
sizeof
(
Char3Int
))
cdef
object
obj
=
MockBuffer
(
fmt
,
sizeof
(
Char3Int
))
cdef
object
[
Char3Int
,
ndim
=
1
]
buf
=
obj
cdef
object
[
Char3Int
,
ndim
=
1
]
buf
=
obj
@
testcase
def
long_string
(
fmt
):
"""
>>> long_string("90198s")
"""
cdef
object
obj
=
MockBuffer
(
fmt
,
sizeof
(
LongString
))
cdef
object
[
LongString
,
ndim
=
1
]
buf
=
obj
@
testcase
@
testcase
def
unpacked_struct
(
fmt
):
def
unpacked_struct
(
fmt
):
"""
"""
...
...
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