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
d66e94d0
Commit
d66e94d0
authored
Feb 04, 2008
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport r59862 (issue #712900): make long regexp matches interruptable
by signals.
parent
912ba543
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
Misc/NEWS
Misc/NEWS
+2
-0
Modules/_sre.c
Modules/_sre.c
+8
-0
No files found.
Misc/NEWS
View file @
d66e94d0
...
...
@@ -212,6 +212,8 @@ Library
Extension
Modules
-----------------
-
Backport
r59862
(
issue
#
712900
):
make
long
regexp
matches
interruptable
.
-
#
1940
:
make
it
possible
to
use
curses
.
filter
()
before
curses
.
initscr
()
as
the
documentation
says
.
...
...
Modules/_sre.c
View file @
d66e94d0
...
...
@@ -99,6 +99,7 @@ static char copyright[] =
#define SRE_ERROR_STATE -2
/* illegal state */
#define SRE_ERROR_RECURSION_LIMIT -3
/* runaway recursion */
#define SRE_ERROR_MEMORY -9
/* out of memory */
#define SRE_ERROR_INTERRUPTED -10
/* signal handler raised exception */
#if defined(VERBOSE)
#define TRACE(v) printf v
...
...
@@ -809,6 +810,7 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern)
Py_ssize_t
alloc_pos
,
ctx_pos
=
-
1
;
Py_ssize_t
i
,
ret
=
0
;
Py_ssize_t
jump
;
unsigned
int
sigcount
=
0
;
SRE_MATCH_CONTEXT
*
ctx
;
SRE_MATCH_CONTEXT
*
nextctx
;
...
...
@@ -837,6 +839,9 @@ entrance:
}
for
(;;)
{
++
sigcount
;
if
((
0
==
(
sigcount
&
0xfff
))
&&
PyErr_CheckSignals
())
RETURN_ERROR
(
SRE_ERROR_INTERRUPTED
);
switch
(
*
ctx
->
pattern
++
)
{
...
...
@@ -1834,6 +1839,9 @@ pattern_error(int status)
case
SRE_ERROR_MEMORY
:
PyErr_NoMemory
();
break
;
case
SRE_ERROR_INTERRUPTED
:
/* An exception has already been raised, so let it fly */
break
;
default:
/* other error codes indicate compiler/engine bugs */
PyErr_SetString
(
...
...
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