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
c5b75db5
Kaydet (Commit)
c5b75db5
authored
Ock 29, 2013
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #12004: Fix an internal error in PyZipFile when writing an invalid
Python file. Patch by Ben Morgan.
üst
afb1cb55
45c4375e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
2 deletions
+30
-2
test_zipfile.py
Lib/test/test_zipfile.py
+25
-1
zipfile.py
Lib/zipfile.py
+1
-1
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_zipfile.py
Dosyayı görüntüle @
c5b75db5
...
@@ -13,7 +13,9 @@ from tempfile import TemporaryFile
...
@@ -13,7 +13,9 @@ from tempfile import TemporaryFile
from
random
import
randint
,
random
from
random
import
randint
,
random
from
unittest
import
skipUnless
from
unittest
import
skipUnless
from
test.support
import
TESTFN
,
run_unittest
,
findfile
,
unlink
,
requires_zlib
,
requires_bz2
,
requires_lzma
from
test.support
import
(
TESTFN
,
run_unittest
,
findfile
,
unlink
,
requires_zlib
,
requires_bz2
,
requires_lzma
,
captured_stdout
)
TESTFN2
=
TESTFN
+
"2"
TESTFN2
=
TESTFN
+
"2"
TESTFNDIR
=
TESTFN
+
"d"
TESTFNDIR
=
TESTFN
+
"d"
...
@@ -854,6 +856,28 @@ class PyZipFileTests(unittest.TestCase):
...
@@ -854,6 +856,28 @@ class PyZipFileTests(unittest.TestCase):
self
.
assertRaises
(
RuntimeError
,
zipfp
.
writepy
,
TESTFN
)
self
.
assertRaises
(
RuntimeError
,
zipfp
.
writepy
,
TESTFN
)
os
.
remove
(
TESTFN
)
os
.
remove
(
TESTFN
)
def
test_write_pyfile_bad_syntax
(
self
):
os
.
mkdir
(
TESTFN2
)
try
:
with
open
(
os
.
path
.
join
(
TESTFN2
,
"mod1.py"
),
"w"
)
as
fp
:
fp
.
write
(
"Bad syntax in python file
\n
"
)
with
TemporaryFile
()
as
t
,
zipfile
.
PyZipFile
(
t
,
"w"
)
as
zipfp
:
# syntax errors are printed to stdout
with
captured_stdout
()
as
s
:
zipfp
.
writepy
(
os
.
path
.
join
(
TESTFN2
,
"mod1.py"
))
self
.
assertIn
(
"SyntaxError"
,
s
.
getvalue
())
# as it will not have compiled the python file, it will
# include the .py file not .pyc or .pyo
names
=
zipfp
.
namelist
()
self
.
assertIn
(
'mod1.py'
,
names
)
self
.
assertNotIn
(
'mod1.pyc'
,
names
)
self
.
assertNotIn
(
'mod1.pyo'
,
names
)
finally
:
shutil
.
rmtree
(
TESTFN2
)
class
OtherTests
(
unittest
.
TestCase
):
class
OtherTests
(
unittest
.
TestCase
):
zips_with_bad_crc
=
{
zips_with_bad_crc
=
{
...
...
Lib/zipfile.py
Dosyayı görüntüle @
c5b75db5
...
@@ -1604,7 +1604,7 @@ class PyZipFile(ZipFile):
...
@@ -1604,7 +1604,7 @@ class PyZipFile(ZipFile):
print
(
"Compiling"
,
file
)
print
(
"Compiling"
,
file
)
try
:
try
:
py_compile
.
compile
(
file
,
doraise
=
True
,
optimize
=
optimize
)
py_compile
.
compile
(
file
,
doraise
=
True
,
optimize
=
optimize
)
except
py_compile
.
PyCompileError
as
err
or
:
except
py_compile
.
PyCompileError
as
err
:
print
(
err
.
msg
)
print
(
err
.
msg
)
return
False
return
False
return
True
return
True
...
...
Misc/ACKS
Dosyayı görüntüle @
c5b75db5
...
@@ -818,6 +818,7 @@ Skip Montanaro
...
@@ -818,6 +818,7 @@ Skip Montanaro
Peter Moody
Peter Moody
Paul Moore
Paul Moore
Ross Moore
Ross Moore
Ben Morgan
Derek Morr
Derek Morr
James A Morrison
James A Morrison
Derek McTavish Mounce
Derek McTavish Mounce
...
...
Misc/NEWS
Dosyayı görüntüle @
c5b75db5
...
@@ -164,6 +164,9 @@ Core and Builtins
...
@@ -164,6 +164,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #12004: Fix an internal error in PyZipFile when writing an invalid
Python file. Patch by Ben Morgan.
- Issue #1602133: on Mac OS X a shared library build (``--enable-shared``)
- Issue #1602133: on Mac OS X a shared library build (``--enable-shared``)
now fills the ``os.environ`` variable correctly.
now fills the ``os.environ`` variable correctly.
...
...
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