Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Boxiang Sun
Pyston
Commits
06a07a2c
Commit
06a07a2c
authored
Jun 22, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #630 from kmod/gc_fixes
fix two minor bugs
parents
6c273fbe
5592f785
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
8 deletions
+21
-8
from_cpython/Include/stringobject.h
from_cpython/Include/stringobject.h
+8
-1
src/capi/codecs.cpp
src/capi/codecs.cpp
+3
-7
src/runtime/str.cpp
src/runtime/str.cpp
+10
-0
No files found.
from_cpython/Include/stringobject.h
View file @
06a07a2c
...
...
@@ -106,7 +106,14 @@ PyAPI_FUNC(int) _PyString_CheckInterned(PyObject *) PYSTON_NOEXCEPT;
/* Macro, trading safety for speed */
// Pyston changes: these aren't direct macros any more [they potentially could be though]
#define PyString_AS_STRING(op) PyString_AsString((PyObject*)op)
#define PyString_GET_SIZE(op) PyString_Size((PyObject*)op)
// Note: there are buggy extension modules (unicodedata.c) that rely on the fact that
// PyString_GET_SIZE does *not* have the same behavior as PyString_Size. In particular,
// you can get away with calling PyString_GET_SIZE on a unicode object and getting the
// length of the unicode string, not the length of the bytes it encodes to in the default
// encoding.
// So, set up a different function for those callers to use.
PyAPI_FUNC
(
Py_ssize_t
)
_PyString_SizeMacro
(
PyObject
*
)
PYSTON_NOEXCEPT
;
#define PyString_GET_SIZE(op) _PyString_SizeMacro((PyObject*)op)
//#define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval)
//#define PyString_GET_SIZE(op) Py_SIZE(op)
...
...
src/capi/codecs.cpp
View file @
06a07a2c
...
...
@@ -744,14 +744,10 @@ static int _PyCodecRegistry_Init(void) {
if
(
interp
->
codec_search_path
!=
NULL
)
return
0
;
interp
->
codec_search_path
=
PyList_New
(
0
);
interp
->
codec_search_cache
=
PyDict_New
();
interp
->
codec_error_registry
=
PyDict_New
();
// Pyston change: register roots
gc
::
registerPermanentRoot
(
interp
->
codec_search_path
);
gc
::
registerPermanentRoot
(
interp
->
codec_search_cache
);
gc
::
registerPermanentRoot
(
interp
->
codec_error_registry
);
interp
->
codec_search_path
=
PyGC_AddRoot
(
PyList_New
(
0
)
);
interp
->
codec_search_cache
=
PyGC_AddRoot
(
PyDict_New
()
);
interp
->
codec_error_registry
=
PyGC_AddRoot
(
PyDict_New
()
);
if
(
interp
->
codec_error_registry
)
{
for
(
i
=
0
;
i
<
sizeof
(
methods
)
/
sizeof
(
methods
[
0
]);
++
i
)
{
...
...
src/runtime/str.cpp
View file @
06a07a2c
...
...
@@ -2349,6 +2349,16 @@ extern "C" Py_ssize_t PyString_Size(PyObject* op) noexcept {
return
len
;
}
extern
"C"
Py_ssize_t
_PyString_SizeMacro
(
PyObject
*
op
)
noexcept
{
if
(
PyString_Check
(
op
))
return
static_cast
<
BoxedString
*>
(
op
)
->
size
();
if
(
PyUnicode_Check
(
op
))
return
Py_SIZE
(
op
);
RELEASE_ASSERT
(
0
,
"Need to verify the behavior of PyString_GET_SIZE on %s objects"
,
op
->
cls
->
tp_name
);
}
extern
"C"
int
_PyString_Resize
(
PyObject
**
pv
,
Py_ssize_t
newsize
)
noexcept
{
// This is only allowed to be called when there is only one user of the string (ie a refcount of 1 in CPython)
...
...
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