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
6466a526
Kaydet (Commit)
6466a526
authored
Mar 15, 2011
tarafından
Gregory P. Smith
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge update
üst
5aaa498b
ffdbbcaf
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
85 additions
and
16 deletions
+85
-16
init.rst
Doc/c-api/init.rst
+3
-2
email.message.rst
Doc/library/email.message.rst
+4
-3
smtplib.rst
Doc/library/smtplib.rst
+14
-0
3.2.rst
Doc/whatsnew/3.2.rst
+4
-0
message.py
Lib/email/message.py
+2
-3
smtplib.py
Lib/smtplib.py
+13
-0
test_smtplib.py
Lib/test/test_smtplib.py
+36
-2
NEWS
Misc/NEWS
+3
-0
ChangeLog
Modules/_ctypes/libffi/ChangeLog
+2
-2
dlmalloc.c
Modules/_ctypes/libffi/src/dlmalloc.c
+2
-2
ffi_darwin.c
Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c
+1
-1
ppc-ffi_darwin.c
Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c
+1
-1
No files found.
Doc/c-api/init.rst
Dosyayı görüntüle @
6466a526
...
...
@@ -537,10 +537,11 @@ code, or when embedding the Python interpreter:
operations such as ``PyEval_ReleaseThread(tstate)``. It is not needed before
calling :c:func:`PyEval_SaveThread` or :c:func:`PyEval_RestoreThread`.
.. index:: single: Py_Initialize()
This is a no-op when called for a second time.
.. versionchanged:: 3.2
This function cannot be called before :c:func:`Py_Initialize()` anymore.
.. index:: module: _thread
.. note::
...
...
Doc/library/email.message.rst
Dosyayı görüntüle @
6466a526
...
...
@@ -46,15 +46,16 @@ Here are the methods of the :class:`Message` class:
be generated or modified).
Note that this method is provided as a convenience and may not always
format the message the way you want. For example, by default it mangles
lines that begin with ``From``. For more flexibility, instantiate a
format the message the way you want. For example, by default it does
not do the mangling of lines that begin with ``From`` that is
required by the unix mbox format. For more flexibility, instantiate a
:class:`~email.generator.Generator` instance and use its :meth:`flatten`
method directly. For example::
from io import StringIO
from email.generator import Generator
fp = StringIO()
g = Generator(fp, mangle_from_=
Fals
e, maxheaderlen=60)
g = Generator(fp, mangle_from_=
Tru
e, maxheaderlen=60)
g.flatten(msg)
text = fp.getvalue()
...
...
Doc/library/smtplib.rst
Dosyayı görüntüle @
6466a526
...
...
@@ -34,6 +34,20 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
For normal use, you should only require the initialization/connect,
:meth:`sendmail`, and :meth:`quit` methods. An example is included below.
The :class:`SMTP` class supports the :keyword:`with` statement. When used
like this, the SMTP ``QUIT`` command is issued automatically when the
:keyword:`with` statement exits. E.g.::
>>> from smtplib import SMTP
>>> with SMTP("domain.org") as smtp:
... smtp.noop()
...
(250, b'Ok')
>>>
.. versionadded:: 3.3
Support for the :keyword:`with` statement was added.
.. class:: SMTP_SSL(host='', port=0, local_hostname=None, keyfile=None, certfile=None[, timeout])
...
...
Doc/whatsnew/3.2.rst
Dosyayı görüntüle @
6466a526
...
...
@@ -2698,3 +2698,7 @@ require changes to your code:
a new function, :func:`asyncore.handle_accepted`, was added to replace it.
(Contributed by Giampaolo Rodola in :issue:`6706`.)
* Due to the new :term:`GIL` implementation, :c:func:`PyEval_InitThreads()`
cannot be called before :c:func:`Py_Initialize()` anymore.
Lib/email/message.py
Dosyayı görüntüle @
6466a526
...
...
@@ -157,8 +157,7 @@ class Message:
header.
This is a convenience method and may not generate the message exactly
as you intend because by default it mangles lines that begin with
"From ". For more flexibility, use the flatten() method of a
as you intend. For more flexibility, use the flatten() method of a
Generator instance.
"""
from
email.generator
import
Generator
...
...
@@ -242,7 +241,7 @@ class Message:
raise
TypeError
(
'Expected list, got
%
s'
%
type
(
self
.
_payload
))
payload
=
self
.
_payload
cte
=
self
.
get
(
'content-transfer-encoding'
,
''
)
.
lower
()
# payload
can be bytes here, (I wonder if that is actually a bug?)
# payload
may be bytes here.
if
isinstance
(
payload
,
str
):
if
_has_surrogates
(
payload
):
bpayload
=
payload
.
encode
(
'ascii'
,
'surrogateescape'
)
...
...
Lib/smtplib.py
Dosyayı görüntüle @
6466a526
...
...
@@ -269,6 +269,19 @@ class SMTP:
pass
self
.
local_hostname
=
'[
%
s]'
%
addr
def
__enter__
(
self
):
return
self
def
__exit__
(
self
,
*
args
):
try
:
code
,
message
=
self
.
docmd
(
"QUIT"
)
if
code
!=
221
:
raise
SMTPResponseException
(
code
,
message
)
except
SMTPServerDisconnected
:
pass
finally
:
self
.
close
()
def
set_debuglevel
(
self
,
debuglevel
):
"""Set the debug output level.
...
...
Lib/test/test_smtplib.py
Dosyayı görüntüle @
6466a526
...
...
@@ -424,6 +424,9 @@ sim_lists = {'list-1':['Mr.A@somewhere.com','Mrs.C@somewhereesle.com'],
# Simulated SMTP channel & server
class
SimSMTPChannel
(
smtpd
.
SMTPChannel
):
# For testing failures in QUIT when using the context manager API.
quit_response
=
None
def
__init__
(
self
,
extra_features
,
*
args
,
**
kw
):
self
.
_extrafeatures
=
''
.
join
(
[
"250-{0}
\r\n
"
.
format
(
x
)
for
x
in
extra_features
])
...
...
@@ -475,19 +478,31 @@ class SimSMTPChannel(smtpd.SMTPChannel):
else
:
self
.
push
(
'550 No access for you!'
)
def
smtp_QUIT
(
self
,
arg
):
# args is ignored
if
self
.
quit_response
is
None
:
super
(
SimSMTPChannel
,
self
)
.
smtp_QUIT
(
arg
)
else
:
self
.
push
(
self
.
quit_response
)
self
.
close_when_done
()
def
handle_error
(
self
):
raise
class
SimSMTPServer
(
smtpd
.
SMTPServer
):
# For testing failures in QUIT when using the context manager API.
quit_response
=
None
def
__init__
(
self
,
*
args
,
**
kw
):
self
.
_extra_features
=
[]
smtpd
.
SMTPServer
.
__init__
(
self
,
*
args
,
**
kw
)
def
handle_accepted
(
self
,
conn
,
addr
):
self
.
_SMTPchannel
=
SimSMTPChannel
(
self
.
_extra_features
,
self
,
conn
,
addr
)
self
.
_SMTPchannel
=
SimSMTPChannel
(
self
.
_extra_features
,
self
,
conn
,
addr
)
self
.
_SMTPchannel
.
quit_response
=
self
.
quit_response
def
process_message
(
self
,
peer
,
mailfrom
,
rcpttos
,
data
):
pass
...
...
@@ -620,6 +635,25 @@ class SMTPSimTests(unittest.TestCase):
self
.
assertIn
(
sim_auth_credentials
[
'cram-md5'
],
str
(
err
))
smtp
.
close
()
def
test_with_statement
(
self
):
with
smtplib
.
SMTP
(
HOST
,
self
.
port
)
as
smtp
:
code
,
message
=
smtp
.
noop
()
self
.
assertEqual
(
code
,
250
)
self
.
assertRaises
(
smtplib
.
SMTPServerDisconnected
,
smtp
.
send
,
b
'foo'
)
with
smtplib
.
SMTP
(
HOST
,
self
.
port
)
as
smtp
:
smtp
.
close
()
self
.
assertRaises
(
smtplib
.
SMTPServerDisconnected
,
smtp
.
send
,
b
'foo'
)
def
test_with_statement_QUIT_failure
(
self
):
self
.
serv
.
quit_response
=
'421 QUIT FAILED'
with
self
.
assertRaises
(
smtplib
.
SMTPResponseException
)
as
error
:
with
smtplib
.
SMTP
(
HOST
,
self
.
port
)
as
smtp
:
smtp
.
noop
()
self
.
assertEqual
(
error
.
exception
.
smtp_code
,
421
)
self
.
assertEqual
(
error
.
exception
.
smtp_error
,
b
'QUIT FAILED'
)
# We don't need to clean up self.serv.quit_response because a new
# server is always instantiated in the setUp().
#TODO: add tests for correct AUTH method fallback now that the
#test infrastructure can support it.
...
...
Misc/NEWS
Dosyayı görüntüle @
6466a526
...
...
@@ -68,6 +68,9 @@ Core and Builtins
Library
-------
-
Issue
#
11289
:
`
smtp
.
SMTP
`
class
becomes
a
context
manager
so
it
can
be
used
in
a
`
with
`
statement
.
Contributed
by
Giampaolo
Rodola
.
-
Issue
#
11554
:
Fixed
support
for
Japanese
codecs
;
previously
the
body
output
encoding
was
not
done
if
euc
-
jp
or
shift
-
jis
was
specified
as
the
charset
.
...
...
Modules/_ctypes/libffi/ChangeLog
Dosyayı görüntüle @
6466a526
...
...
@@ -3084,7 +3084,7 @@
2003-09-18 Kaz Kojima <kkojima@gcc.gnu.org>
* src/sh/ffi.c (ffi_prep_args): Take account into the alignment
* src/sh/ffi.c (ffi_prep_args): Take account into the align
e
ment
for the register size.
(ffi_closure_helper_SYSV): Handle the structure return value
address correctly.
...
...
@@ -3344,7 +3344,7 @@
2003-02-06 Andreas Tobler <a.tobler@schweiz.ch>
* libffi/src/powerpc/darwin_closure.S:
Fix alignment bug, allocate 8 bytes for the result.
Fix align
e
ment bug, allocate 8 bytes for the result.
* libffi/src/powerpc/aix_closure.S:
Likewise.
* libffi/src/powerpc/ffi_darwin.c:
...
...
Modules/_ctypes/libffi/src/dlmalloc.c
Dosyayı görüntüle @
6466a526
...
...
@@ -1326,7 +1326,7 @@ static void* win32direct_mmap(size_t size) {
return
(
ptr
!=
0
)
?
ptr
:
MFAIL
;
}
/* This function supports releasing coales
c
ed segments */
/* This function supports releasing coalesed segments */
static
int
win32munmap
(
void
*
ptr
,
size_t
size
)
{
MEMORY_BASIC_INFORMATION
minfo
;
char
*
cptr
=
ptr
;
...
...
@@ -1362,7 +1362,7 @@ static int win32munmap(void* ptr, size_t size) {
#define CALL_MORECORE(S) MFAIL
#endif
/* HAVE_MORECORE */
/* mstate bit set if contiguous morecore disabled or failed */
/* mstate bit set if conti
n
guous morecore disabled or failed */
#define USE_NONCONTIGUOUS_BIT (4U)
/* segment bit set in create_mspace_with_base */
...
...
Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c
Dosyayı görüntüle @
6466a526
...
...
@@ -592,7 +592,7 @@ typedef struct aix_fd_struct {
+---------------------------------------+ 160
| result area 8 |
+---------------------------------------+ 168
| align
ment to the next multiple of 16
|
| align
ement to the next multiple of 16
|
SP current --> +---------------------------------------+ 176 <- parent frame
| back chain to caller 4 |
+---------------------------------------+ 180
...
...
Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c
Dosyayı görüntüle @
6466a526
...
...
@@ -650,7 +650,7 @@ ffi_call(
+---------------------------------------+ 160
| result area 8 |
+---------------------------------------+ 168
| align
ment to the next multiple of 16
|
| align
ement to the next multiple of 16
|
SP current --> +---------------------------------------+ 176 <- parent frame
| back chain to caller 4 |
+---------------------------------------+ 180
...
...
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