Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
f47e3ac7
Commit
f47e3ac7
authored
Mar 15, 2011
by
Brett Cannon
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
b8daeda5
72d46933
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
15 deletions
+38
-15
.hgignore
.hgignore
+1
-0
Doc/library/email.message.rst
Doc/library/email.message.rst
+16
-9
Lib/test/test_peepholer.py
Lib/test/test_peepholer.py
+14
-1
Misc/python-wing4.wpr
Misc/python-wing4.wpr
+5
-4
Python/peephole.c
Python/peephole.c
+2
-1
No files found.
.hgignore
View file @
f47e3ac7
...
...
@@ -50,6 +50,7 @@ libpython*.a
*~
Lib/lib2to3/*.pickle
Lib/test/data/*
Misc/*.wpu
PC/python_nt*.h
PC/pythonnt_rc*.h
PC/*.obj
...
...
Doc/library/email.message.rst
View file @
f47e3ac7
...
...
@@ -139,15 +139,22 @@ Here are the methods of the :class:`Message` class:
string naming a character set, or ``None``. If it is a string, it will
be converted to a :class:`~email.charset.Charset` instance. If *charset*
is ``None``, the ``charset`` parameter will be removed from the
:mailheader:`Content-Type` header. Anything else will generate a
:exc:`TypeError`.
The message will be assumed to be of type :mimetype:`text/\*` encoded with
*charset.input_charset*. It will be converted to *charset.output_charset*
and encoded properly, if needed, when generating the plain text
representation of the message. MIME headers (:mailheader:`MIME-Version`,
:mailheader:`Content-Type`, :mailheader:`Content-Transfer-Encoding`) will
be added as needed.
:mailheader:`Content-Type` header (the message will not be otherwise
modified). Anything else will generate a :exc:`TypeError`.
If there is no existing :mailheader:`MIME-Version` header one will be
added. If there is no existing :mailheader:`Content-Type` header, one
will be added with a value of :mimetype:`text/plain`. Whether the
:mailheader:`Content-Type` header already exists or not, its ``charset``
parameter will be set to *charset.output_charset*. If
*charset.input_charset* and *charset.output_charset* differ, the payload
will be re-encoded to the *output_charset*. If there is no existing
:mailheader:`Content-Transfer-Encoding` header, then the payload will be
transfer-encoded, if needed, using the specified
:class:`~email.charset.Charset`, and a header with the appropriate value
will be added. If a :mailheader:`Content-Transfer-Encoding` header
already exists, the payload is assumed to already be correctly encoded
using that :mailheader:`Content-Transfer-Encoding` and is not modified.
.. method:: get_charset()
...
...
Lib/test/test_peepholer.py
View file @
f47e3ac7
...
...
@@ -19,6 +19,7 @@ def disassemble(func):
def
dis_single
(
line
):
return
disassemble
(
compile
(
line
,
''
,
'single'
))
class
TestTranforms
(
unittest
.
TestCase
):
def
test_unot
(
self
):
...
...
@@ -294,11 +295,23 @@ class TestTranforms(unittest.TestCase):
self
.
assertNotIn
(
'BINARY_'
,
asm
,
e
)
self
.
assertNotIn
(
'BUILD_'
,
asm
,
e
)
class
TestBuglets
(
unittest
.
TestCase
):
def
test_bug_11510
(
self
):
# folded constant set optimization was commingled with the tuple
# unpacking optimization which would fail if the set had duplicate
# elements so that the set length was unexpected
def
f
():
x
,
y
=
{
1
,
1
}
return
x
,
y
with
self
.
assertRaises
(
ValueError
):
f
()
def
test_main
(
verbose
=
None
):
import
sys
from
test
import
support
test_classes
=
(
TestTranforms
,)
test_classes
=
(
TestTranforms
,
TestBuglets
)
support
.
run_unittest
(
*
test_classes
)
# verify reference counting
...
...
Misc/python-wing4.wpr
View file @
f47e3ac7
...
...
@@ -5,11 +5,12 @@
##################################################################
[project attributes]
proj.directory-list = [{'dirloc': loc('..'),
'excludes': [u'Lib/unittest/test/__pycache__',
u'Lib/__pycache__',
u'Doc/build',
'excludes': [u'.hg',
u'Lib/unittest/__pycache__',
u'build'],
u'Lib/unittest/test/__pycache__',
u'Lib/__pycache__',
u'build',
u'Doc/build'],
'filter': '*',
'include_hidden': False,
'recursive': True,
...
...
Python/peephole.c
View file @
f47e3ac7
...
...
@@ -535,7 +535,8 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names,
}
if
(
codestr
[
i
+
3
]
!=
UNPACK_SEQUENCE
||
!
ISBASICBLOCK
(
blocks
,
i
,
6
)
||
j
!=
GETARG
(
codestr
,
i
+
3
))
j
!=
GETARG
(
codestr
,
i
+
3
)
||
opcode
==
BUILD_SET
)
continue
;
if
(
j
==
1
)
{
memset
(
codestr
+
i
,
NOP
,
6
);
...
...
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