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
0dee9c1b
Kaydet (Commit)
0dee9c1b
authored
Mar 17, 2010
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
prevent lambda functions from having docstrings #8164
üst
78c1871d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
0 deletions
+11
-0
test_compile.py
Lib/test/test_compile.py
+4
-0
NEWS
Misc/NEWS
+2
-0
compile.c
Python/compile.c
+5
-0
No files found.
Lib/test/test_compile.py
Dosyayı görüntüle @
0dee9c1b
...
...
@@ -353,6 +353,10 @@ if 1:
f1
,
f2
=
f
()
self
.
assertNotEqual
(
id
(
f1
.
func_code
),
id
(
f2
.
func_code
))
def
test_lambda_doc
(
self
):
l
=
lambda
:
"foo"
self
.
assertIsNone
(
l
.
__doc__
)
def
test_unicode_encoding
(
self
):
code
=
u"# -*- coding: utf-8 -*-
\n
pass
\n
"
self
.
assertRaises
(
SyntaxError
,
compile
,
code
,
"tmp"
,
"exec"
)
...
...
Misc/NEWS
Dosyayı görüntüle @
0dee9c1b
...
...
@@ -12,6 +12,8 @@ What's New in Python 2.7 beta 1?
Core and Builtins
-----------------
- Issue #8164: Don't allow lambda functions to have a docstring.
- Issue #3137: Don't ignore errors at startup, especially a keyboard interrupt
(SIGINT). If an error occurs while importing the site module, the error is
printed and Python exits. Initialize the GIL before importing the site
...
...
Python/compile.c
Dosyayı görüntüle @
0dee9c1b
...
...
@@ -1518,6 +1518,11 @@ compiler_lambda(struct compiler *c, expr_ty e)
/* unpack nested arguments */
compiler_arguments
(
c
,
args
);
/* Make None the first constant, so the lambda can't have a
docstring. */
if
(
compiler_add_o
(
c
,
c
->
u
->
u_consts
,
Py_None
)
<
0
)
return
0
;
c
->
u
->
u_argcount
=
asdl_seq_LEN
(
args
->
args
);
VISIT_IN_SCOPE
(
c
,
expr
,
e
->
v
.
Lambda
.
body
);
...
...
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