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
98fd5b4a
Commit
98fd5b4a
authored
Jul 05, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Py3 fixes
parent
0f0aca15
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+11
-3
Cython/Compiler/StringEncoding.py
Cython/Compiler/StringEncoding.py
+1
-1
No files found.
Cython/Compiler/Code.py
View file @
98fd5b4a
...
@@ -284,7 +284,8 @@ class PyObjectConst(object):
...
@@ -284,7 +284,8 @@ class PyObjectConst(object):
self
.
cname
=
cname
self
.
cname
=
cname
self
.
type
=
type
self
.
type
=
type
possible_identifier
=
re
.
compile
(
ur"(?![0-9])\
w+$
", re.U).match
possible_unicode_identifier
=
re
.
compile
(
ur"(?![0-9])\
w+$
", re.U).match
possible_bytes_identifier = re.compile(r"
(
?!
[
0
-
9
])
\
w
+
$
".encode('ASCII')).match
nice_identifier = re.compile('^[a-zA-Z0-0_]+$').match
nice_identifier = re.compile('^[a-zA-Z0-0_]+$').match
class StringConst(object):
class StringConst(object):
...
@@ -313,8 +314,15 @@ class StringConst(object):
...
@@ -313,8 +314,15 @@ class StringConst(object):
if py_strings is None:
if py_strings is None:
self.py_strings = {}
self.py_strings = {}
is_unicode = encoding is None
is_unicode = encoding is None
intern = bool(identifier or (
if identifier:
identifier is None and possible_identifier(text)))
intern = True
elif identifier is None:
if is_unicode:
intern = bool(possible_unicode_identifier(text))
else:
intern = bool(possible_bytes_identifier(text))
else:
intern = False
if intern:
if intern:
prefix = Naming.interned_str_prefix
prefix = Naming.interned_str_prefix
else:
else:
...
...
Cython/Compiler/StringEncoding.py
View file @
98fd5b4a
...
@@ -84,7 +84,7 @@ class BytesLiteral(_bytes):
...
@@ -84,7 +84,7 @@ class BytesLiteral(_bytes):
encoding
=
None
encoding
=
None
def
byteencode
(
self
):
def
byteencode
(
self
):
return
str
(
self
)
return
_bytes
(
self
)
def
utf8encode
(
self
):
def
utf8encode
(
self
):
assert
False
,
"this is not a unicode string: %r"
%
self
assert
False
,
"this is not a unicode string: %r"
%
self
...
...
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