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
d13518f2
Commit
d13518f2
authored
Mar 02, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #342 from undingen/virtualenv_fixes
Smaller changes to get more of virtualenv running
parents
1df3a954
e985c320
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
6 deletions
+11
-6
from_cpython/Objects/unicodeobject.c
from_cpython/Objects/unicodeobject.c
+2
-2
src/runtime/str.cpp
src/runtime/str.cpp
+7
-4
test/tests/unicode_test.py
test/tests/unicode_test.py
+2
-0
No files found.
from_cpython/Objects/unicodeobject.c
View file @
d13518f2
...
...
@@ -1247,7 +1247,7 @@ PyObject *PyUnicode_Decode(const char *s,
encoding
=
PyUnicode_GetDefaultEncoding
();
/* Shortcuts for common default encodings */
if
(
strcmp
(
encoding
,
"utf-8"
)
==
0
)
if
(
strcmp
(
encoding
,
"utf-8"
)
==
0
||
strcmp
(
encoding
,
"UTF-8"
)
==
0
)
// Pyston change: added "UTF-8"
return
PyUnicode_DecodeUTF8
(
s
,
size
,
errors
);
else
if
(
strcmp
(
encoding
,
"latin-1"
)
==
0
)
return
PyUnicode_DecodeLatin1
(
s
,
size
,
errors
);
...
...
@@ -1359,7 +1359,7 @@ PyObject *PyUnicode_AsEncodedString(PyObject *unicode,
/* Shortcuts for common default encodings */
if
(
errors
==
NULL
)
{
if
(
strcmp
(
encoding
,
"utf-8"
)
==
0
)
if
(
strcmp
(
encoding
,
"utf-8"
)
==
0
||
strcmp
(
encoding
,
"UTF-8"
)
==
0
)
// Pyston change: added "UTF-8"
return
PyUnicode_AsUTF8String
(
unicode
);
else
if
(
strcmp
(
encoding
,
"latin-1"
)
==
0
)
return
PyUnicode_AsLatin1String
(
unicode
);
...
...
src/runtime/str.cpp
View file @
d13518f2
...
...
@@ -290,9 +290,15 @@ extern "C" PyObject* PyString_FromFormat(const char* format, ...) noexcept {
return
ret
;
}
extern
"C"
Box
edString
*
strAdd
(
BoxedString
*
lhs
,
Box
*
_rhs
)
{
extern
"C"
Box
*
strAdd
(
BoxedString
*
lhs
,
Box
*
_rhs
)
{
assert
(
lhs
->
cls
==
str_cls
);
if
(
_rhs
->
cls
==
unicode_cls
)
{
Box
*
rtn
=
PyUnicode_Concat
(
lhs
,
_rhs
);
checkAndThrowCAPIException
();
return
rtn
;
}
if
(
_rhs
->
cls
!=
str_cls
)
{
raiseExcHelper
(
TypeError
,
"cannot concatenate 'str' and '%s' objects"
,
getTypeName
(
_rhs
));
}
...
...
@@ -2093,9 +2099,6 @@ BoxedString* createUninitializedString(ssize_t n) {
}
char
*
getWriteableStringContents
(
BoxedString
*
s
)
{
if
(
s
->
s
.
size
()
==
0
)
return
NULL
;
// After doing some reading, I think this is ok:
// http://stackoverflow.com/questions/14290795/why-is-modifying-a-string-through-a-retrieved-pointer-to-its-data-not-allowed
// In C++11, std::string is required to store its data contiguously.
...
...
test/tests/unicode_test.py
View file @
d13518f2
...
...
@@ -27,6 +27,8 @@ print u'a' in c.__dict__
print
u''
==
''
print
''
==
u''
print
hash
(
u''
)
==
hash
(
''
)
print
"Hello "
+
u" World"
print
u"Hello "
+
" World"
try
:
hasattr
(
object
(),
u"
\
u0180
"
)
...
...
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