Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
c0799e3a
Kaydet (Commit)
c0799e3a
authored
Eyl 21, 2014
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #22423: Fixed debugging output of the GROUPREF_EXISTS opcode in the re
module.
üst
91943460
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
24 deletions
+53
-24
sre_parse.py
Lib/sre_parse.py
+27
-18
test_re.py
Lib/test/test_re.py
+23
-6
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/sre_parse.py
Dosyayı görüntüle @
c0799e3a
...
...
@@ -94,33 +94,42 @@ class SubPattern:
self
.
data
=
data
self
.
width
=
None
def
dump
(
self
,
level
=
0
):
nl
=
1
seqtypes
=
type
(()),
type
([])
seqtypes
=
(
tuple
,
list
)
for
op
,
av
in
self
.
data
:
print
level
*
" "
+
op
,
;
nl
=
0
if
op
==
"in"
:
print
level
*
" "
+
op
,
if
op
==
IN
:
# member sublanguage
print
;
nl
=
1
print
for
op
,
a
in
av
:
print
(
level
+
1
)
*
" "
+
op
,
a
elif
op
==
"branch"
:
print
;
nl
=
1
i
=
0
for
a
in
av
[
1
]:
if
i
>
0
:
elif
op
==
BRANCH
:
print
for
i
,
a
in
enumerate
(
av
[
1
]):
if
i
:
print
level
*
" "
+
"or"
a
.
dump
(
level
+
1
);
nl
=
1
i
=
i
+
1
elif
type
(
av
)
in
seqtypes
:
a
.
dump
(
level
+
1
)
elif
op
==
GROUPREF_EXISTS
:
condgroup
,
item_yes
,
item_no
=
av
print
condgroup
item_yes
.
dump
(
level
+
1
)
if
item_no
:
print
level
*
" "
+
"else"
item_no
.
dump
(
level
+
1
)
elif
isinstance
(
av
,
seqtypes
):
nl
=
0
for
a
in
av
:
if
isinstance
(
a
,
SubPattern
):
if
not
nl
:
print
a
.
dump
(
level
+
1
);
nl
=
1
if
not
nl
:
print
a
.
dump
(
level
+
1
)
nl
=
1
else
:
print
a
,
;
nl
=
0
print
a
,
nl
=
0
if
not
nl
:
print
else
:
print
av
,
;
nl
=
0
if
not
nl
:
print
print
av
def
__repr__
(
self
):
return
repr
(
self
.
data
)
def
__len__
(
self
):
...
...
Lib/test/test_re.py
Dosyayı görüntüle @
c0799e3a
...
...
@@ -930,16 +930,33 @@ class ReTests(unittest.TestCase):
self
.
assertEqual
(
m
.
group
(
2
),
"y"
)
def
test_debug_flag
(
self
):
pat
=
r'(\.)(?:[ch]|py)(?(1)$|: )'
with
captured_stdout
()
as
out
:
re
.
compile
(
'foo'
,
re
.
DEBUG
)
self
.
assertEqual
(
out
.
getvalue
()
.
splitlines
(),
[
'literal 102'
,
'literal 111'
,
'literal 111'
])
re
.
compile
(
pat
,
re
.
DEBUG
)
dump
=
'''
\
subpattern 1
literal 46
subpattern None
branch
in
literal 99
literal 104
or
literal 112
literal 121
subpattern None
groupref_exists 1
at at_end
else
literal 58
literal 32
'''
self
.
assertEqual
(
out
.
getvalue
(),
dump
)
# Debug output is output again even a second time (bypassing
# the cache -- issue #20426).
with
captured_stdout
()
as
out
:
re
.
compile
(
'foo'
,
re
.
DEBUG
)
self
.
assertEqual
(
out
.
getvalue
()
.
splitlines
(),
[
'literal 102'
,
'literal 111'
,
'literal 111'
])
re
.
compile
(
pat
,
re
.
DEBUG
)
self
.
assertEqual
(
out
.
getvalue
(),
dump
)
def
test_keyword_parameters
(
self
):
# Issue #20283: Accepting the string keyword parameter.
...
...
Misc/NEWS
Dosyayı görüntüle @
c0799e3a
...
...
@@ -22,6 +22,9 @@ Core and Builtins
Library
-------
-
Issue
#
22423
:
Fixed
debugging
output
of
the
GROUPREF_EXISTS
opcode
in
the
re
module
.
-
Issue
#
22423
:
Unhandled
exception
in
thread
no
longer
causes
unhandled
AttributeError
when
sys
.
stderr
is
None
.
...
...
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