Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Kirill Smelkov
cpython
Commits
7d9c6c7e
Commit
7d9c6c7e
authored
May 07, 2004
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix _sre.CODESIZE on 64-bit machines in UCS-4 mode. Fixes #931848.
Backported to 2.3.
parent
156c49ad
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
Lib/sre_compile.py
Lib/sre_compile.py
+5
-3
Lib/test/test_re.py
Lib/test/test_re.py
+9
-0
Modules/sre.h
Modules/sre.h
+1
-1
No files found.
Lib/sre_compile.py
View file @
7d9c6c7e
...
...
@@ -333,14 +333,16 @@ def _optimize_unicode(charset, fixup):
block
=
block
+
1
data
=
data
+
_mk_bitmap
(
chunk
)
header
=
[
block
]
if
MAXCODE
==
65535
:
if
_sre
.
CODESIZE
==
2
:
code
=
'H'
else
:
code
=
'
L
'
code
=
'
I
'
# Convert block indices to byte array of 256 bytes
mapping
=
array
.
array
(
'b'
,
mapping
).
tostring
()
# Convert byte array to word array
header
=
header
+
array
.
array
(
code
,
mapping
).
tolist
()
mapping
=
array
.
array
(
code
,
mapping
)
assert
mapping
.
itemsize
==
_sre
.
CODESIZE
header
=
header
+
mapping
.
tolist
()
data
[
0
:
0
]
=
header
return
[(
BIGCHARSET
,
data
)]
...
...
Lib/test/test_re.py
View file @
7d9c6c7e
...
...
@@ -497,6 +497,15 @@ class ReTests(unittest.TestCase):
self.assert_(re.compile('bug_926075') is not
re.compile(eval("u'bug_926075'")))
def test_bug_931848(self):
try:
unicode
except NameError:
pass
pattern = eval('u"
[
\
u002E
\
u3002
\
uFF0E
\
uFF61
]
"')
self.assertEqual(re.compile(pattern).split("
a
.
b
.
c
"),
['a','b','c'])
def run_re_tests():
from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR
if verbose:
...
...
Modules/sre.h
View file @
7d9c6c7e
...
...
@@ -16,7 +16,7 @@
/* size of a code word (must be unsigned short or larger, and
large enough to hold a Py_UNICODE character) */
#ifdef Py_UNICODE_WIDE
#define SRE_CODE
unsigned long
#define SRE_CODE
Py_UCS4
#else
#define SRE_CODE unsigned short
#endif
...
...
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