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
Xavier Thompson
cython
Commits
4575a2f2
Commit
4575a2f2
authored
6 years ago
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix exttype inheritance from builtin bytearray type.
Closes #2106.
parent
6704d23e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
0 deletions
+17
-0
CHANGES.rst
CHANGES.rst
+3
-0
Cython/Compiler/Builtin.py
Cython/Compiler/Builtin.py
+2
-0
tests/run/bytearraymethods.pyx
tests/run/bytearraymethods.pyx
+12
-0
No files found.
CHANGES.rst
View file @
4575a2f2
...
...
@@ -135,6 +135,9 @@ Bugs fixed
* Cython no longer creates useless and incorrect ``PyInstanceMethod`` wrappers for
methods in Python 3. Patch by Jeroen Demeyer. (Github issue #2105)
* The builtin ``bytearray`` type could not be used as base type of cdef classes.
(Github issue #2106)
Other changes
-------------
...
...
This diff is collapsed.
Click to expand it.
Cython/Compiler/Builtin.py
View file @
4575a2f2
...
...
@@ -391,6 +391,8 @@ def init_builtin_types():
utility
=
builtin_utility_code
.
get
(
name
)
if
name
==
'frozenset'
:
objstruct_cname
=
'PySetObject'
elif
name
==
'bytearray'
:
objstruct_cname
=
'PyByteArrayObject'
elif
name
==
'bool'
:
objstruct_cname
=
None
elif
name
==
'Exception'
:
...
...
This diff is collapsed.
Click to expand it.
tests/run/bytearraymethods.pyx
View file @
4575a2f2
...
...
@@ -275,3 +275,15 @@ def bytearray_append(bytearray b, signed char c, int i, object o):
b
.
append
(
i
)
b
.
append
(
o
)
return
b
cdef
class
BytearraySubtype
(
bytearray
):
"""
>>> b = BytearraySubtype(b'abc')
>>> b._append(ord('x'))
>>> b.append(ord('y'))
>>> print(b.decode('ascii'))
abcxy
"""
def
_append
(
self
,
x
):
self
.
append
(
x
)
This diff is collapsed.
Click to expand it.
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