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
ed657556
Kaydet (Commit)
ed657556
authored
Tem 10, 2006
tarafından
Neal Norwitz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Bug #1512814, Fix incorrect lineno's when code at module scope
started after line 256.
üst
28746aba
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
test_compile.py
Lib/test/test_compile.py
+10
-0
NEWS
Misc/NEWS
+3
-0
compile.c
Python/compile.c
+9
-1
No files found.
Lib/test/test_compile.py
Dosyayı görüntüle @
ed657556
...
...
@@ -166,6 +166,16 @@ if 1:
pass"""
compile
(
s
,
"<string>"
,
"exec"
)
# This test is probably specific to CPython and may not generalize
# to other implementations. We are trying to ensure that when
# the first line of code starts after 256, correct line numbers
# in tracebacks are still produced.
def
test_leading_newlines
(
self
):
s256
=
""
.
join
([
"
\n
"
]
*
256
+
[
"spam"
])
co
=
compile
(
s256
,
'fn'
,
'exec'
)
self
.
assertEqual
(
co
.
co_firstlineno
,
257
)
self
.
assertEqual
(
co
.
co_lnotab
,
''
)
def
test_literals_with_leading_zeroes
(
self
):
for
arg
in
[
"077787"
,
"0xj"
,
"0x."
,
"0e"
,
"090000000000000"
,
"080000000000000"
,
"000000000000009"
,
"000000000000008"
]:
...
...
Misc/NEWS
Dosyayı görüntüle @
ed657556
...
...
@@ -33,6 +33,9 @@ Core and builtins
- On 64 bit systems, int literals that use less than 64 bits are
now ints rather than longs.
- Bug #1512814, Fix incorrect lineno'
s
when
code
at
module
scope
started
after
line
256.
Library
-------
...
...
Python/compile.c
Dosyayı görüntüle @
ed657556
...
...
@@ -1776,7 +1776,8 @@ compiler_mod(struct compiler *c, mod_ty mod)
if
(
!
module
)
return
NULL
;
}
if
(
!
compiler_enter_scope
(
c
,
module
,
mod
,
1
))
/* Use 0 for firstlineno initially, will fixup in assemble(). */
if
(
!
compiler_enter_scope
(
c
,
module
,
mod
,
0
))
return
NULL
;
switch
(
mod
->
kind
)
{
case
Module_kind
:
...
...
@@ -4446,6 +4447,13 @@ assemble(struct compiler *c, int addNone)
entryblock
=
b
;
}
/* Set firstlineno if it wasn't explicitly set. */
if
(
!
c
->
u
->
u_firstlineno
)
{
if
(
entryblock
&&
entryblock
->
b_instr
)
c
->
u
->
u_firstlineno
=
entryblock
->
b_instr
->
i_lineno
;
else
c
->
u
->
u_firstlineno
=
1
;
}
if
(
!
assemble_init
(
&
a
,
nblocks
,
c
->
u
->
u_firstlineno
))
goto
error
;
dfs
(
c
,
entryblock
,
&
a
);
...
...
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