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
816671c6
Commit
816671c6
authored
Mar 10, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patch for re.sub bug, by AMK.
parent
193338af
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
6 deletions
+7
-6
Modules/pcre.h
Modules/pcre.h
+3
-1
Modules/pcremodule.c
Modules/pcremodule.c
+1
-3
Modules/pypcre.c
Modules/pypcre.c
+3
-2
No files found.
Modules/pcre.h
View file @
816671c6
...
...
@@ -57,11 +57,13 @@ extern void (*pcre_free)(void *);
#ifdef FOR_PYTHON
extern
pcre
*
pcre_compile
(
const
char
*
,
int
,
const
char
**
,
int
*
,
PyObject
*
);
extern
int
pcre_exec
(
const
pcre
*
,
const
pcre_extra
*
,
const
char
*
,
int
,
int
,
int
,
int
*
,
int
);
#else
extern
pcre
*
pcre_compile
(
const
char
*
,
int
,
const
char
**
,
int
*
);
#endif
extern
int
pcre_exec
(
const
pcre
*
,
const
pcre_extra
*
,
const
char
*
,
int
,
int
,
int
*
,
int
);
#endif
extern
int
pcre_info
(
const
pcre
*
,
int
*
,
int
*
);
extern
pcre_extra
*
pcre_study
(
const
pcre
*
,
int
,
const
char
**
);
extern
const
char
*
pcre_version
(
void
);
...
...
Modules/pcremodule.c
View file @
816671c6
...
...
@@ -115,7 +115,7 @@ PyPcre_exec(self, args)
return
NULL
;
if
(
endpos
==
-
1
)
{
endpos
=
stringlen
;}
count
=
pcre_exec
(
self
->
regex
,
self
->
regex_extra
,
(
char
*
)
string
+
pos
,
endpos
-
pos
,
options
,
(
char
*
)
string
,
endpos
,
pos
,
options
,
offsets
,
sizeof
(
offsets
)
/
sizeof
(
int
)
);
/* If an error occurred during the match, and an exception was raised,
just return NULL and leave the exception alone. The most likely
...
...
@@ -143,8 +143,6 @@ PyPcre_exec(self, args)
/* If the group wasn't affected by the match, return -1, -1 */
if
(
start
<
0
||
count
<=
i
)
{
start
=
end
=-
1
;}
else
{
start
+=
pos
;
end
+=
pos
;}
v
=
Py_BuildValue
(
"ii"
,
start
,
end
);
if
(
v
==
NULL
)
{
Py_DECREF
(
list
);
return
NULL
;}
PyList_SetItem
(
list
,
i
,
v
);
...
...
Modules/pypcre.c
View file @
816671c6
...
...
@@ -4424,7 +4424,8 @@ Returns: > 0 => success; value is the number of elements filled in
int
pcre_exec
(
const
pcre
*
external_re
,
const
pcre_extra
*
external_extra
,
const
char
*
subject
,
int
length
,
int
options
,
int
*
offsets
,
int
offsetcount
)
const
char
*
subject
,
int
length
,
int
start_pos
,
int
options
,
int
*
offsets
,
int
offsetcount
)
{
/* The "volatile" directives are to make gcc -Wall stop complaining
that these variables can be clobbered by the longjmp. Hopefully
...
...
@@ -4433,7 +4434,7 @@ int resetcount, ocount;
int
first_char
=
-
1
;
match_data
match_block
;
const
uschar
*
start_bits
=
NULL
;
const
uschar
*
start_match
=
(
const
uschar
*
)
subject
;
const
uschar
*
start_match
=
(
const
uschar
*
)
subject
+
start_pos
;
const
uschar
*
end_subject
;
const
real_pcre
*
re
=
(
const
real_pcre
*
)
external_re
;
const
real_pcre_extra
*
extra
=
(
const
real_pcre_extra
*
)
external_extra
;
...
...
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