mirror of
https://github.com/python/cpython.git
synced 2025-09-27 18:59:43 +00:00
merge heads
This commit is contained in:
commit
cccfd9932d
27 changed files with 247 additions and 61 deletions
|
@ -458,7 +458,8 @@ define in order to be compatible with the Python codec registry.
|
||||||
|
|
||||||
.. method:: reset()
|
.. method:: reset()
|
||||||
|
|
||||||
Reset the encoder to the initial state.
|
Reset the encoder to the initial state. The output is discarded: call
|
||||||
|
``.encode('', final=True)`` to reset the encoder and to get the output.
|
||||||
|
|
||||||
|
|
||||||
.. method:: IncrementalEncoder.getstate()
|
.. method:: IncrementalEncoder.getstate()
|
||||||
|
|
|
@ -187,10 +187,9 @@ The :mod:`signal` module defines the following functions:
|
||||||
Send the signal *signum* to the thread *thread_id*, another thread in the same
|
Send the signal *signum* to the thread *thread_id*, another thread in the same
|
||||||
process as the caller. The signal is asynchronously directed to thread.
|
process as the caller. The signal is asynchronously directed to thread.
|
||||||
|
|
||||||
*thread_id* can be read from the :attr:`~threading.Thread.ident` attribute
|
Use :func:`threading.get_ident()` or the :attr:`~threading.Thread.ident`
|
||||||
of :attr:`threading.Thread`. For example,
|
attribute of :attr:`threading.Thread` to get a 'thread identifier' for
|
||||||
``threading.current_thread().ident`` gives the identifier of the current
|
*thread_id*.
|
||||||
thread.
|
|
||||||
|
|
||||||
If *signum* is 0, then no signal is sent, but error checking is still
|
If *signum* is 0, then no signal is sent, but error checking is still
|
||||||
performed; this can be used to check if a thread is still running.
|
performed; this can be used to check if a thread is still running.
|
||||||
|
|
|
@ -48,6 +48,17 @@ This module defines the following functions and objects:
|
||||||
returned.
|
returned.
|
||||||
|
|
||||||
|
|
||||||
|
.. function:: get_ident()
|
||||||
|
|
||||||
|
Return the 'thread identifier' of the current thread. This is a nonzero
|
||||||
|
integer. Its value has no direct meaning; it is intended as a magic cookie
|
||||||
|
to be used e.g. to index a dictionary of thread-specific data. Thread
|
||||||
|
identifiers may be recycled when a thread exits and another thread is
|
||||||
|
created.
|
||||||
|
|
||||||
|
.. versionadded:: 3.3
|
||||||
|
|
||||||
|
|
||||||
.. function:: enumerate()
|
.. function:: enumerate()
|
||||||
|
|
||||||
Return a list of all :class:`Thread` objects currently alive. The list
|
Return a list of all :class:`Thread` objects currently alive. The list
|
||||||
|
@ -332,10 +343,10 @@ impossible to detect the termination of alien threads.
|
||||||
.. attribute:: ident
|
.. attribute:: ident
|
||||||
|
|
||||||
The 'thread identifier' of this thread or ``None`` if the thread has not
|
The 'thread identifier' of this thread or ``None`` if the thread has not
|
||||||
been started. This is a nonzero integer. See the
|
been started. This is a nonzero integer. See the :func:`get_ident()`
|
||||||
:func:`thread.get_ident()` function. Thread identifiers may be recycled
|
function. Thread identifiers may be recycled when a thread exits and
|
||||||
when a thread exits and another thread is created. The identifier is
|
another thread is created. The identifier is available even after the
|
||||||
available even after the thread has exited.
|
thread has exited.
|
||||||
|
|
||||||
.. method:: is_alive()
|
.. method:: is_alive()
|
||||||
|
|
||||||
|
|
|
@ -41,10 +41,9 @@ except ImportError: #pragma: no cover
|
||||||
codecs = None
|
codecs = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import _thread as thread
|
|
||||||
import threading
|
import threading
|
||||||
except ImportError: #pragma: no cover
|
except ImportError: #pragma: no cover
|
||||||
thread = None
|
threading = None
|
||||||
|
|
||||||
__author__ = "Vinay Sajip <vinay_sajip@red-dove.com>"
|
__author__ = "Vinay Sajip <vinay_sajip@red-dove.com>"
|
||||||
__status__ = "production"
|
__status__ = "production"
|
||||||
|
@ -199,7 +198,7 @@ def _checkLevel(level):
|
||||||
#the lock would already have been acquired - so we need an RLock.
|
#the lock would already have been acquired - so we need an RLock.
|
||||||
#The same argument applies to Loggers and Manager.loggerDict.
|
#The same argument applies to Loggers and Manager.loggerDict.
|
||||||
#
|
#
|
||||||
if thread:
|
if threading:
|
||||||
_lock = threading.RLock()
|
_lock = threading.RLock()
|
||||||
else: #pragma: no cover
|
else: #pragma: no cover
|
||||||
_lock = None
|
_lock = None
|
||||||
|
@ -278,8 +277,8 @@ class LogRecord(object):
|
||||||
self.created = ct
|
self.created = ct
|
||||||
self.msecs = (ct - int(ct)) * 1000
|
self.msecs = (ct - int(ct)) * 1000
|
||||||
self.relativeCreated = (self.created - _startTime) * 1000
|
self.relativeCreated = (self.created - _startTime) * 1000
|
||||||
if logThreads and thread:
|
if logThreads and threading:
|
||||||
self.thread = thread.get_ident()
|
self.thread = threading.get_ident()
|
||||||
self.threadName = threading.current_thread().name
|
self.threadName = threading.current_thread().name
|
||||||
else: # pragma: no cover
|
else: # pragma: no cover
|
||||||
self.thread = None
|
self.thread = None
|
||||||
|
@ -773,7 +772,7 @@ class Handler(Filterer):
|
||||||
"""
|
"""
|
||||||
Acquire a thread lock for serializing access to the underlying I/O.
|
Acquire a thread lock for serializing access to the underlying I/O.
|
||||||
"""
|
"""
|
||||||
if thread:
|
if threading:
|
||||||
self.lock = threading.RLock()
|
self.lock = threading.RLock()
|
||||||
else: #pragma: no cover
|
else: #pragma: no cover
|
||||||
self.lock = None
|
self.lock = None
|
||||||
|
|
|
@ -376,7 +376,10 @@ def _remove_dist(dist, paths=sys.path):
|
||||||
|
|
||||||
|
|
||||||
def remove(project_name, paths=sys.path, auto_confirm=True):
|
def remove(project_name, paths=sys.path, auto_confirm=True):
|
||||||
"""Removes a single project from the installation"""
|
"""Removes a single project from the installation.
|
||||||
|
|
||||||
|
Returns True on success
|
||||||
|
"""
|
||||||
dist = get_distribution(project_name, use_egg_info=True, paths=paths)
|
dist = get_distribution(project_name, use_egg_info=True, paths=paths)
|
||||||
if dist is None:
|
if dist is None:
|
||||||
raise PackagingError('Distribution "%s" not found' % project_name)
|
raise PackagingError('Distribution "%s" not found' % project_name)
|
||||||
|
@ -384,13 +387,26 @@ def remove(project_name, paths=sys.path, auto_confirm=True):
|
||||||
rmdirs = []
|
rmdirs = []
|
||||||
rmfiles = []
|
rmfiles = []
|
||||||
tmp = tempfile.mkdtemp(prefix=project_name + '-uninstall')
|
tmp = tempfile.mkdtemp(prefix=project_name + '-uninstall')
|
||||||
|
|
||||||
|
def _move_file(source, target):
|
||||||
|
try:
|
||||||
|
os.rename(source, target)
|
||||||
|
except OSError as err:
|
||||||
|
return err
|
||||||
|
return None
|
||||||
|
|
||||||
|
success = True
|
||||||
|
error = None
|
||||||
try:
|
try:
|
||||||
for file_, md5, size in files:
|
for file_, md5, size in files:
|
||||||
if os.path.isfile(file_):
|
if os.path.isfile(file_):
|
||||||
dirname, filename = os.path.split(file_)
|
dirname, filename = os.path.split(file_)
|
||||||
tmpfile = os.path.join(tmp, filename)
|
tmpfile = os.path.join(tmp, filename)
|
||||||
try:
|
try:
|
||||||
os.rename(file_, tmpfile)
|
error = _move_file(file_, tmpfile)
|
||||||
|
if error is not None:
|
||||||
|
success = False
|
||||||
|
break
|
||||||
finally:
|
finally:
|
||||||
if not os.path.isfile(file_):
|
if not os.path.isfile(file_):
|
||||||
os.rename(tmpfile, file_)
|
os.rename(tmpfile, file_)
|
||||||
|
@ -401,6 +417,11 @@ def remove(project_name, paths=sys.path, auto_confirm=True):
|
||||||
finally:
|
finally:
|
||||||
shutil.rmtree(tmp)
|
shutil.rmtree(tmp)
|
||||||
|
|
||||||
|
if not success:
|
||||||
|
logger.info('%r cannot be removed.', project_name)
|
||||||
|
logger.info('Error: %s' % str(error))
|
||||||
|
return False
|
||||||
|
|
||||||
logger.info('Removing %r: ', project_name)
|
logger.info('Removing %r: ', project_name)
|
||||||
|
|
||||||
for file_ in rmfiles:
|
for file_ in rmfiles:
|
||||||
|
@ -447,6 +468,8 @@ def remove(project_name, paths=sys.path, auto_confirm=True):
|
||||||
logger.info('Success: removed %d files and %d dirs',
|
logger.info('Success: removed %d files and %d dirs',
|
||||||
file_count, dir_count)
|
file_count, dir_count)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def install(project):
|
def install(project):
|
||||||
logger.info('Getting information about %r...', project)
|
logger.info('Getting information about %r...', project)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
import stat
|
||||||
|
|
||||||
from packaging.database import disable_cache, enable_cache
|
from packaging.database import disable_cache, enable_cache
|
||||||
from packaging.run import main
|
from packaging.run import main
|
||||||
|
@ -80,12 +81,9 @@ class UninstallTestCase(support.TempdirManager,
|
||||||
if not dirname:
|
if not dirname:
|
||||||
dirname = self.make_dist(name, **kw)
|
dirname = self.make_dist(name, **kw)
|
||||||
os.chdir(dirname)
|
os.chdir(dirname)
|
||||||
old_out = sys.stdout
|
old_out = sys.stderr
|
||||||
sys.stderr = StringIO()
|
sys.stderr = StringIO()
|
||||||
try:
|
dist = self.run_setup('install_dist', '--prefix=' + self.root_dir)
|
||||||
dist = self.run_setup('install_dist', '--prefix=' + self.root_dir)
|
|
||||||
finally:
|
|
||||||
sys.sterr = old_out
|
|
||||||
install_lib = self.get_path(dist, 'purelib')
|
install_lib = self.get_path(dist, 'purelib')
|
||||||
return dist, install_lib
|
return dist, install_lib
|
||||||
|
|
||||||
|
@ -99,10 +97,30 @@ class UninstallTestCase(support.TempdirManager,
|
||||||
self.assertIsFile(install_lib, 'foo', '__init__.py')
|
self.assertIsFile(install_lib, 'foo', '__init__.py')
|
||||||
self.assertIsFile(install_lib, 'foo', 'sub', '__init__.py')
|
self.assertIsFile(install_lib, 'foo', 'sub', '__init__.py')
|
||||||
self.assertIsFile(install_lib, 'Foo-0.1.dist-info', 'RECORD')
|
self.assertIsFile(install_lib, 'Foo-0.1.dist-info', 'RECORD')
|
||||||
remove('Foo', paths=[install_lib])
|
self.assertTrue(remove('Foo', paths=[install_lib]))
|
||||||
self.assertIsNotFile(install_lib, 'foo', 'sub', '__init__.py')
|
self.assertIsNotFile(install_lib, 'foo', 'sub', '__init__.py')
|
||||||
self.assertIsNotFile(install_lib, 'Foo-0.1.dist-info', 'RECORD')
|
self.assertIsNotFile(install_lib, 'Foo-0.1.dist-info', 'RECORD')
|
||||||
|
|
||||||
|
@unittest.skipIf(sys.platform == 'win32', 'deactivated for now')
|
||||||
|
def test_remove_issue(self):
|
||||||
|
# makes sure if there are OSErrors (like permission denied)
|
||||||
|
# remove() stops and display a clean error
|
||||||
|
dist, install_lib = self.install_dist('Meh')
|
||||||
|
|
||||||
|
# breaking os.rename
|
||||||
|
old = os.rename
|
||||||
|
|
||||||
|
def _rename(source, target):
|
||||||
|
raise OSError()
|
||||||
|
|
||||||
|
os.rename = _rename
|
||||||
|
try:
|
||||||
|
self.assertFalse(remove('Meh', paths=[install_lib]))
|
||||||
|
finally:
|
||||||
|
os.rename = old
|
||||||
|
|
||||||
|
self.assertTrue(remove('Meh', paths=[install_lib]))
|
||||||
|
|
||||||
|
|
||||||
def test_suite():
|
def test_suite():
|
||||||
return unittest.makeSuite(UninstallTestCase)
|
return unittest.makeSuite(UninstallTestCase)
|
||||||
|
|
|
@ -5,7 +5,7 @@ __all__ = ["Repr", "repr", "recursive_repr"]
|
||||||
import builtins
|
import builtins
|
||||||
from itertools import islice
|
from itertools import islice
|
||||||
try:
|
try:
|
||||||
from _thread import get_ident
|
from threading import get_ident
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from _dummy_thread import get_ident
|
from _dummy_thread import get_ident
|
||||||
|
|
||||||
|
|
7
Lib/test/cjkencodings/iso2022_jp-utf8.txt
Normal file
7
Lib/test/cjkencodings/iso2022_jp-utf8.txt
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
Python の開発は、1990 年ごろから開始されています。
|
||||||
|
開発者の Guido van Rossum は教育用のプログラミング言語「ABC」の開発に参加していましたが、ABC は実用上の目的にはあまり適していませんでした。
|
||||||
|
このため、Guido はより実用的なプログラミング言語の開発を開始し、英国 BBS 放送のコメディ番組「モンティ パイソン」のファンである Guido はこの言語を「Python」と名づけました。
|
||||||
|
このような背景から生まれた Python の言語設計は、「シンプル」で「習得が容易」という目標に重点が置かれています。
|
||||||
|
多くのスクリプト系言語ではユーザの目先の利便性を優先して色々な機能を言語要素として取り入れる場合が多いのですが、Python ではそういった小細工が追加されることはあまりありません。
|
||||||
|
言語自体の機能は最小限に押さえ、必要な機能は拡張モジュールとして追加する、というのが Python のポリシーです。
|
||||||
|
|
7
Lib/test/cjkencodings/iso2022_jp.txt
Normal file
7
Lib/test/cjkencodings/iso2022_jp.txt
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
Python $B$N3+H/$O!"(B1990 $BG/$4$m$+$i3+;O$5$l$F$$$^$9!#(B
|
||||||
|
$B3+H/<T$N(B Guido van Rossum $B$O650iMQ$N%W%m%0%i%_%s%08@8l!V(BABC$B!W$N3+H/$K;22C$7$F$$$^$7$?$,!"(BABC $B$O<BMQ>e$NL\E*$K$O$"$^$jE,$7$F$$$^$;$s$G$7$?!#(B
|
||||||
|
$B$3$N$?$a!"(BGuido $B$O$h$j<BMQE*$J%W%m%0%i%_%s%08@8l$N3+H/$r3+;O$7!"1Q9q(B BBS $BJ|Aw$N%3%a%G%#HVAH!V%b%s%F%#(B $B%Q%$%=%s!W$N%U%!%s$G$"$k(B Guido $B$O$3$N8@8l$r!V(BPython$B!W$HL>$E$1$^$7$?!#(B
|
||||||
|
$B$3$N$h$&$JGX7J$+$i@8$^$l$?(B Python $B$N8@8l@_7W$O!"!V%7%s%W%k!W$G!V=,F@$,MF0W!W$H$$$&L\I8$K=EE@$,CV$+$l$F$$$^$9!#(B
|
||||||
|
$BB?$/$N%9%/%j%W%H7O8@8l$G$O%f!<%6$NL\@h$NMxJX@-$rM%@h$7$F?'!9$J5!G=$r8@8lMWAG$H$7$F<h$jF~$l$k>l9g$,B?$$$N$G$9$,!"(BPython $B$G$O$=$&$$$C$?>.:Y9)$,DI2C$5$l$k$3$H$O$"$^$j$"$j$^$;$s!#(B
|
||||||
|
$B8@8l<+BN$N5!G=$O:G>.8B$K2!$5$(!"I,MW$J5!G=$O3HD%%b%8%e!<%k$H$7$FDI2C$9$k!"$H$$$&$N$,(B Python $B$N%]%j%7!<$G$9!#(B
|
||||||
|
|
7
Lib/test/cjkencodings/iso2022_kr-utf8.txt
Normal file
7
Lib/test/cjkencodings/iso2022_kr-utf8.txt
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
◎ 파이썬(Python)은 배우기 쉽고, 강력한 프로그래밍 언어입니다. 파이썬은
|
||||||
|
효율적인 고수준 데이터 구조와 간단하지만 효율적인 객체지향프로그래밍을
|
||||||
|
지원합니다. 파이썬의 우아(優雅)한 문법과 동적 타이핑, 그리고 인터프리팅
|
||||||
|
환경은 파이썬을 스크립팅과 여러 분야에서와 대부분의 플랫폼에서의 빠른
|
||||||
|
애플리케이션 개발을 할 수 있는 이상적인 언어로 만들어줍니다.
|
||||||
|
|
||||||
|
☆첫가끝: 날아라 쓩~ 큼! 금없이 전니다. 그런거 다.
|
7
Lib/test/cjkencodings/iso2022_kr.txt
Normal file
7
Lib/test/cjkencodings/iso2022_kr.txt
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
$)C!] FD@L=c(Python)@: 9h?l1b =10m, 0-7BGQ GA7N1W7!9V >p>n@T4O4Y. FD@L=c@:
|
||||||
|
H?@2@{@N 0m<vAX 5%@LEM 18A6?M 0#4\GOAv88 H?@2@{@N 04C<AvGbGA7N1W7!9V@;
|
||||||
|
Av?xGU4O4Y. FD@L=c@G ?l>F(iPd:)GQ 9.9}0z 5?@{ E8@LGN, 1W8.0m @NEMGA8.FC
|
||||||
|
H/0f@: FD@L=c@; =:E)83FC0z ?)7/ :P>_?!<-?M 4k:N:P@G GC7'F{?!<-@G :|8%
|
||||||
|
>VGC8.DI@L<G 039_@; GR <v @V4B @L;s@{@N >p>n7N 885i>nA]4O4Y.
|
||||||
|
|
||||||
|
!YC90!3!: 3/>F6s >1~ E-! 1]>x@L @|4O4Y. 1W710E 4Y.
|
|
@ -4,7 +4,7 @@ Various tests for synchronization primitives.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from _thread import start_new_thread, get_ident, TIMEOUT_MAX
|
from _thread import start_new_thread, TIMEOUT_MAX
|
||||||
import threading
|
import threading
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class Bunch(object):
|
||||||
self.finished = []
|
self.finished = []
|
||||||
self._can_exit = not wait_before_exit
|
self._can_exit = not wait_before_exit
|
||||||
def task():
|
def task():
|
||||||
tid = get_ident()
|
tid = threading.get_ident()
|
||||||
self.started.append(tid)
|
self.started.append(tid)
|
||||||
try:
|
try:
|
||||||
f()
|
f()
|
||||||
|
|
|
@ -1023,10 +1023,6 @@ class saved_test_environment:
|
||||||
|
|
||||||
def runtest_inner(test, verbose, quiet, huntrleaks=False, debug=False):
|
def runtest_inner(test, verbose, quiet, huntrleaks=False, debug=False):
|
||||||
support.unload(test)
|
support.unload(test)
|
||||||
if verbose:
|
|
||||||
capture_stdout = None
|
|
||||||
else:
|
|
||||||
capture_stdout = io.StringIO()
|
|
||||||
|
|
||||||
test_time = 0.0
|
test_time = 0.0
|
||||||
refleak = False # True if the test leaked references.
|
refleak = False # True if the test leaked references.
|
||||||
|
|
|
@ -190,18 +190,17 @@ def test_main():
|
||||||
idents = []
|
idents = []
|
||||||
|
|
||||||
def callback():
|
def callback():
|
||||||
idents.append(_thread.get_ident())
|
idents.append(threading.get_ident())
|
||||||
|
|
||||||
_testcapi._test_thread_state(callback)
|
_testcapi._test_thread_state(callback)
|
||||||
a = b = callback
|
a = b = callback
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
# Check our main thread is in the list exactly 3 times.
|
# Check our main thread is in the list exactly 3 times.
|
||||||
if idents.count(_thread.get_ident()) != 3:
|
if idents.count(threading.get_ident()) != 3:
|
||||||
raise support.TestFailed(
|
raise support.TestFailed(
|
||||||
"Couldn't find main thread correctly in the list")
|
"Couldn't find main thread correctly in the list")
|
||||||
|
|
||||||
if threading:
|
if threading:
|
||||||
import _thread
|
|
||||||
import time
|
import time
|
||||||
TestThreadState()
|
TestThreadState()
|
||||||
t = threading.Thread(target=TestThreadState)
|
t = threading.Thread(target=TestThreadState)
|
||||||
|
|
46
Lib/test/test_codecencodings_iso2022.py
Normal file
46
Lib/test/test_codecencodings_iso2022.py
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
#
|
||||||
|
# Codec encoding tests for ISO 2022 encodings.
|
||||||
|
|
||||||
|
from test import support
|
||||||
|
from test import test_multibytecodec_support
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
COMMON_CODEC_TESTS = (
|
||||||
|
# invalid bytes
|
||||||
|
(b'ab\xFFcd', 'replace', 'ab\uFFFDcd'),
|
||||||
|
(b'ab\x1Bdef', 'replace', 'ab\x1Bdef'),
|
||||||
|
(b'ab\x1B$def', 'replace', 'ab\uFFFD'),
|
||||||
|
)
|
||||||
|
|
||||||
|
class Test_ISO2022_JP(test_multibytecodec_support.TestBase, unittest.TestCase):
|
||||||
|
encoding = 'iso2022_jp'
|
||||||
|
tstring = test_multibytecodec_support.load_teststring('iso2022_jp')
|
||||||
|
codectests = COMMON_CODEC_TESTS + (
|
||||||
|
(b'ab\x1BNdef', 'replace', 'ab\x1BNdef'),
|
||||||
|
)
|
||||||
|
|
||||||
|
class Test_ISO2022_JP2(test_multibytecodec_support.TestBase, unittest.TestCase):
|
||||||
|
encoding = 'iso2022_jp_2'
|
||||||
|
tstring = test_multibytecodec_support.load_teststring('iso2022_jp')
|
||||||
|
codectests = COMMON_CODEC_TESTS + (
|
||||||
|
(b'ab\x1BNdef', 'replace', 'abdef'),
|
||||||
|
)
|
||||||
|
|
||||||
|
class Test_ISO2022_KR(test_multibytecodec_support.TestBase, unittest.TestCase):
|
||||||
|
encoding = 'iso2022_kr'
|
||||||
|
tstring = test_multibytecodec_support.load_teststring('iso2022_kr')
|
||||||
|
codectests = COMMON_CODEC_TESTS + (
|
||||||
|
(b'ab\x1BNdef', 'replace', 'ab\x1BNdef'),
|
||||||
|
)
|
||||||
|
|
||||||
|
# iso2022_kr.txt cannot be used to test "chunk coding": the escape
|
||||||
|
# sequence is only written on the first line
|
||||||
|
def test_chunkcoding(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def test_main():
|
||||||
|
support.run_unittest(__name__)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
test_main()
|
|
@ -260,7 +260,8 @@ class TestStateful(unittest.TestCase):
|
||||||
text = '\u4E16\u4E16'
|
text = '\u4E16\u4E16'
|
||||||
encoding = 'iso-2022-jp'
|
encoding = 'iso-2022-jp'
|
||||||
expected = b'\x1b$B@$@$'
|
expected = b'\x1b$B@$@$'
|
||||||
expected_reset = b'\x1b$B@$@$\x1b(B'
|
reset = b'\x1b(B'
|
||||||
|
expected_reset = expected + reset
|
||||||
|
|
||||||
def test_encode(self):
|
def test_encode(self):
|
||||||
self.assertEqual(self.text.encode(self.encoding), self.expected_reset)
|
self.assertEqual(self.text.encode(self.encoding), self.expected_reset)
|
||||||
|
@ -271,6 +272,8 @@ class TestStateful(unittest.TestCase):
|
||||||
encoder.encode(char)
|
encoder.encode(char)
|
||||||
for char in self.text)
|
for char in self.text)
|
||||||
self.assertEqual(output, self.expected)
|
self.assertEqual(output, self.expected)
|
||||||
|
self.assertEqual(encoder.encode('', final=True), self.reset)
|
||||||
|
self.assertEqual(encoder.encode('', final=True), b'')
|
||||||
|
|
||||||
def test_incrementalencoder_final(self):
|
def test_incrementalencoder_final(self):
|
||||||
encoder = codecs.getincrementalencoder(self.encoding)()
|
encoder = codecs.getincrementalencoder(self.encoding)()
|
||||||
|
@ -279,12 +282,14 @@ class TestStateful(unittest.TestCase):
|
||||||
encoder.encode(char, index == last_index)
|
encoder.encode(char, index == last_index)
|
||||||
for index, char in enumerate(self.text))
|
for index, char in enumerate(self.text))
|
||||||
self.assertEqual(output, self.expected_reset)
|
self.assertEqual(output, self.expected_reset)
|
||||||
|
self.assertEqual(encoder.encode('', final=True), b'')
|
||||||
|
|
||||||
class TestHZStateful(TestStateful):
|
class TestHZStateful(TestStateful):
|
||||||
text = '\u804a\u804a'
|
text = '\u804a\u804a'
|
||||||
encoding = 'hz'
|
encoding = 'hz'
|
||||||
expected = b'~{ADAD'
|
expected = b'~{ADAD'
|
||||||
expected_reset = b'~{ADAD~}'
|
reset = b'~}'
|
||||||
|
expected_reset = expected + reset
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
support.run_unittest(__name__)
|
support.run_unittest(__name__)
|
||||||
|
|
|
@ -60,7 +60,9 @@ class TestBase:
|
||||||
self.assertTrue(type(result) is str, type(result))
|
self.assertTrue(type(result) is str, type(result))
|
||||||
else:
|
else:
|
||||||
self.assertTrue(type(result) is bytes, type(result))
|
self.assertTrue(type(result) is bytes, type(result))
|
||||||
self.assertEqual(result, expected)
|
self.assertEqual(result, expected,
|
||||||
|
'%a.decode(%r)=%a != %a'
|
||||||
|
% (source, self.encoding, result, expected))
|
||||||
else:
|
else:
|
||||||
self.assertRaises(UnicodeError, func, source, scheme)
|
self.assertRaises(UnicodeError, func, source, scheme)
|
||||||
|
|
||||||
|
|
|
@ -557,7 +557,7 @@ class PendingSignalsTests(unittest.TestCase):
|
||||||
|
|
||||||
def kill(self, signum):
|
def kill(self, signum):
|
||||||
if self.has_pthread_kill:
|
if self.has_pthread_kill:
|
||||||
tid = threading.current_thread().ident
|
tid = threading.get_ident()
|
||||||
signal.pthread_kill(tid, signum)
|
signal.pthread_kill(tid, signum)
|
||||||
else:
|
else:
|
||||||
pid = os.getpid()
|
pid = os.getpid()
|
||||||
|
@ -589,7 +589,7 @@ class PendingSignalsTests(unittest.TestCase):
|
||||||
'need signal.pthread_kill()')
|
'need signal.pthread_kill()')
|
||||||
def test_pthread_kill(self):
|
def test_pthread_kill(self):
|
||||||
signum = signal.SIGUSR1
|
signum = signal.SIGUSR1
|
||||||
current = threading.current_thread().ident
|
current = threading.get_ident()
|
||||||
|
|
||||||
old_handler = signal.signal(signum, self.handler)
|
old_handler = signal.signal(signum, self.handler)
|
||||||
self.addCleanup(signal.signal, signum, old_handler)
|
self.addCleanup(signal.signal, signum, old_handler)
|
||||||
|
|
|
@ -343,7 +343,7 @@ class SysModuleTest(unittest.TestCase):
|
||||||
# Test sys._current_frames() in a WITH_THREADS build.
|
# Test sys._current_frames() in a WITH_THREADS build.
|
||||||
@test.support.reap_threads
|
@test.support.reap_threads
|
||||||
def current_frames_with_threads(self):
|
def current_frames_with_threads(self):
|
||||||
import threading, _thread
|
import threading
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
# Spawn a thread that blocks at a known place. Then the main
|
# Spawn a thread that blocks at a known place. Then the main
|
||||||
|
@ -357,7 +357,7 @@ class SysModuleTest(unittest.TestCase):
|
||||||
g456()
|
g456()
|
||||||
|
|
||||||
def g456():
|
def g456():
|
||||||
thread_info.append(_thread.get_ident())
|
thread_info.append(threading.get_ident())
|
||||||
entered_g.set()
|
entered_g.set()
|
||||||
leave_g.wait()
|
leave_g.wait()
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ class SysModuleTest(unittest.TestCase):
|
||||||
|
|
||||||
d = sys._current_frames()
|
d = sys._current_frames()
|
||||||
|
|
||||||
main_id = _thread.get_ident()
|
main_id = threading.get_ident()
|
||||||
self.assertIn(main_id, d)
|
self.assertIn(main_id, d)
|
||||||
self.assertIn(thread_id, d)
|
self.assertIn(thread_id, d)
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ def task(N, done, done_tasks, errors):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
errors.append(e.with_traceback(None))
|
errors.append(e.with_traceback(None))
|
||||||
finally:
|
finally:
|
||||||
done_tasks.append(thread.get_ident())
|
done_tasks.append(threading.get_ident())
|
||||||
finished = len(done_tasks) == N
|
finished = len(done_tasks) == N
|
||||||
if finished:
|
if finished:
|
||||||
done.set()
|
done.set()
|
||||||
|
|
|
@ -173,7 +173,7 @@ class ThreadTests(BaseTestCase):
|
||||||
exception = ctypes.py_object(AsyncExc)
|
exception = ctypes.py_object(AsyncExc)
|
||||||
|
|
||||||
# First check it works when setting the exception from the same thread.
|
# First check it works when setting the exception from the same thread.
|
||||||
tid = _thread.get_ident()
|
tid = threading.get_ident()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = set_async_exc(ctypes.c_long(tid), exception)
|
result = set_async_exc(ctypes.c_long(tid), exception)
|
||||||
|
@ -202,7 +202,7 @@ class ThreadTests(BaseTestCase):
|
||||||
|
|
||||||
class Worker(threading.Thread):
|
class Worker(threading.Thread):
|
||||||
def run(self):
|
def run(self):
|
||||||
self.id = _thread.get_ident()
|
self.id = threading.get_ident()
|
||||||
self.finished = False
|
self.finished = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -24,7 +24,7 @@ __all__ = ['active_count', 'Condition', 'current_thread', 'enumerate', 'Event',
|
||||||
# Rename some stuff so "from threading import *" is safe
|
# Rename some stuff so "from threading import *" is safe
|
||||||
_start_new_thread = _thread.start_new_thread
|
_start_new_thread = _thread.start_new_thread
|
||||||
_allocate_lock = _thread.allocate_lock
|
_allocate_lock = _thread.allocate_lock
|
||||||
_get_ident = _thread.get_ident
|
get_ident = _thread.get_ident
|
||||||
ThreadError = _thread.error
|
ThreadError = _thread.error
|
||||||
try:
|
try:
|
||||||
_CRLock = _thread.RLock
|
_CRLock = _thread.RLock
|
||||||
|
@ -52,7 +52,7 @@ if __debug__:
|
||||||
format = format % args
|
format = format % args
|
||||||
# Issue #4188: calling current_thread() can incur an infinite
|
# Issue #4188: calling current_thread() can incur an infinite
|
||||||
# recursion if it has to create a DummyThread on the fly.
|
# recursion if it has to create a DummyThread on the fly.
|
||||||
ident = _get_ident()
|
ident = get_ident()
|
||||||
try:
|
try:
|
||||||
name = _active[ident].name
|
name = _active[ident].name
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -110,7 +110,7 @@ class _RLock(_Verbose):
|
||||||
self.__class__.__name__, owner, self._count)
|
self.__class__.__name__, owner, self._count)
|
||||||
|
|
||||||
def acquire(self, blocking=True, timeout=-1):
|
def acquire(self, blocking=True, timeout=-1):
|
||||||
me = _get_ident()
|
me = get_ident()
|
||||||
if self._owner == me:
|
if self._owner == me:
|
||||||
self._count = self._count + 1
|
self._count = self._count + 1
|
||||||
if __debug__:
|
if __debug__:
|
||||||
|
@ -130,7 +130,7 @@ class _RLock(_Verbose):
|
||||||
__enter__ = acquire
|
__enter__ = acquire
|
||||||
|
|
||||||
def release(self):
|
def release(self):
|
||||||
if self._owner != _get_ident():
|
if self._owner != get_ident():
|
||||||
raise RuntimeError("cannot release un-acquired lock")
|
raise RuntimeError("cannot release un-acquired lock")
|
||||||
self._count = count = self._count - 1
|
self._count = count = self._count - 1
|
||||||
if not count:
|
if not count:
|
||||||
|
@ -166,7 +166,7 @@ class _RLock(_Verbose):
|
||||||
return (count, owner)
|
return (count, owner)
|
||||||
|
|
||||||
def _is_owned(self):
|
def _is_owned(self):
|
||||||
return self._owner == _get_ident()
|
return self._owner == get_ident()
|
||||||
|
|
||||||
_PyRLock = _RLock
|
_PyRLock = _RLock
|
||||||
|
|
||||||
|
@ -714,7 +714,7 @@ class Thread(_Verbose):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def _set_ident(self):
|
def _set_ident(self):
|
||||||
self._ident = _get_ident()
|
self._ident = get_ident()
|
||||||
|
|
||||||
def _bootstrap_inner(self):
|
def _bootstrap_inner(self):
|
||||||
try:
|
try:
|
||||||
|
@ -787,7 +787,7 @@ class Thread(_Verbose):
|
||||||
try:
|
try:
|
||||||
# We don't call self._delete() because it also
|
# We don't call self._delete() because it also
|
||||||
# grabs _active_limbo_lock.
|
# grabs _active_limbo_lock.
|
||||||
del _active[_get_ident()]
|
del _active[get_ident()]
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -823,7 +823,7 @@ class Thread(_Verbose):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with _active_limbo_lock:
|
with _active_limbo_lock:
|
||||||
del _active[_get_ident()]
|
del _active[get_ident()]
|
||||||
# There must not be any python code between the previous line
|
# There must not be any python code between the previous line
|
||||||
# and after the lock is released. Otherwise a tracing function
|
# and after the lock is released. Otherwise a tracing function
|
||||||
# could try to acquire the lock again in the same thread, (in
|
# could try to acquire the lock again in the same thread, (in
|
||||||
|
@ -1006,9 +1006,8 @@ class _DummyThread(Thread):
|
||||||
|
|
||||||
def current_thread():
|
def current_thread():
|
||||||
try:
|
try:
|
||||||
return _active[_get_ident()]
|
return _active[get_ident()]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
##print "current_thread(): no current thread for", _get_ident()
|
|
||||||
return _DummyThread()
|
return _DummyThread()
|
||||||
|
|
||||||
currentThread = current_thread
|
currentThread = current_thread
|
||||||
|
@ -1062,7 +1061,7 @@ def _after_fork():
|
||||||
if thread is current:
|
if thread is current:
|
||||||
# There is only one active thread. We reset the ident to
|
# There is only one active thread. We reset the ident to
|
||||||
# its new value since it can have changed.
|
# its new value since it can have changed.
|
||||||
ident = _get_ident()
|
ident = get_ident()
|
||||||
thread._ident = ident
|
thread._ident = ident
|
||||||
# Any condition variables hanging off of the active thread may
|
# Any condition variables hanging off of the active thread may
|
||||||
# be in an invalid state, so we reinitialize them.
|
# be in an invalid state, so we reinitialize them.
|
||||||
|
|
38
Misc/ACKS
38
Misc/ACKS
|
@ -12,7 +12,9 @@ PS: In the standard Python distribution, this file is encoded in UTF-8
|
||||||
and the list is in rough alphabetical order by last names.
|
and the list is in rough alphabetical order by last names.
|
||||||
|
|
||||||
David Abrahams
|
David Abrahams
|
||||||
|
Rajiv Abraham
|
||||||
Ron Adam
|
Ron Adam
|
||||||
|
Ali Afshar
|
||||||
Jim Ahlstrom
|
Jim Ahlstrom
|
||||||
Farhan Ahmad
|
Farhan Ahmad
|
||||||
Matthew Ahrens
|
Matthew Ahrens
|
||||||
|
@ -58,6 +60,7 @@ Richard Barran
|
||||||
Cesar Eduardo Barros
|
Cesar Eduardo Barros
|
||||||
Des Barry
|
Des Barry
|
||||||
Ulf Bartelt
|
Ulf Bartelt
|
||||||
|
Pior Bastida
|
||||||
Nick Bastin
|
Nick Bastin
|
||||||
Jeff Bauer
|
Jeff Bauer
|
||||||
Mike Bayer
|
Mike Bayer
|
||||||
|
@ -122,6 +125,7 @@ Michael Broghton
|
||||||
Daniel Brotsky
|
Daniel Brotsky
|
||||||
Jean Brouwers
|
Jean Brouwers
|
||||||
Gary S. Brown
|
Gary S. Brown
|
||||||
|
Titus Brown
|
||||||
Oleg Broytmann
|
Oleg Broytmann
|
||||||
Dave Brueck
|
Dave Brueck
|
||||||
Stan Bubrouski
|
Stan Bubrouski
|
||||||
|
@ -135,6 +139,7 @@ Alastair Burt
|
||||||
Tarn Weisner Burton
|
Tarn Weisner Burton
|
||||||
Lee Busby
|
Lee Busby
|
||||||
Ralph Butler
|
Ralph Butler
|
||||||
|
Nicolas Cadou
|
||||||
Jp Calderone
|
Jp Calderone
|
||||||
Daniel Calvelo
|
Daniel Calvelo
|
||||||
Tony Campbell
|
Tony Campbell
|
||||||
|
@ -153,6 +158,7 @@ Jeffrey Chang
|
||||||
Mitch Chapman
|
Mitch Chapman
|
||||||
Greg Chapman
|
Greg Chapman
|
||||||
Brad Chapman
|
Brad Chapman
|
||||||
|
Godefroid Chapelle
|
||||||
David Chaum
|
David Chaum
|
||||||
Nicolas Chauvat
|
Nicolas Chauvat
|
||||||
Jerry Chen
|
Jerry Chen
|
||||||
|
@ -176,6 +182,7 @@ Benjamin Collar
|
||||||
Jeffery Collins
|
Jeffery Collins
|
||||||
Robert Collins
|
Robert Collins
|
||||||
Paul Colomiets
|
Paul Colomiets
|
||||||
|
Christophe Combelles
|
||||||
Denver Coneybeare
|
Denver Coneybeare
|
||||||
Geremy Condra
|
Geremy Condra
|
||||||
Juan José Conti
|
Juan José Conti
|
||||||
|
@ -206,6 +213,7 @@ Andrew Dalke
|
||||||
Lars Damerow
|
Lars Damerow
|
||||||
Evan Dandrea
|
Evan Dandrea
|
||||||
Eric Daniel
|
Eric Daniel
|
||||||
|
Pierre-Yves David
|
||||||
Scott David Daniels
|
Scott David Daniels
|
||||||
Ben Darnell
|
Ben Darnell
|
||||||
Jonathan Dasteel
|
Jonathan Dasteel
|
||||||
|
@ -213,6 +221,7 @@ John DeGood
|
||||||
Ned Deily
|
Ned Deily
|
||||||
Vincent Delft
|
Vincent Delft
|
||||||
Arnaud Delobelle
|
Arnaud Delobelle
|
||||||
|
Konrad Delong
|
||||||
Erik Demaine
|
Erik Demaine
|
||||||
Roger Dev
|
Roger Dev
|
||||||
Raghuram Devarakonda
|
Raghuram Devarakonda
|
||||||
|
@ -226,6 +235,7 @@ Daniel Diniz
|
||||||
Humberto Diogenes
|
Humberto Diogenes
|
||||||
Yves Dionne
|
Yves Dionne
|
||||||
Daniel Dittmar
|
Daniel Dittmar
|
||||||
|
Josip Djolonga
|
||||||
Jaromir Dolecek
|
Jaromir Dolecek
|
||||||
Ismail Donmez
|
Ismail Donmez
|
||||||
Marcos Donolo
|
Marcos Donolo
|
||||||
|
@ -264,6 +274,7 @@ Jürgen A. Erhard
|
||||||
Michael Ernst
|
Michael Ernst
|
||||||
Ben Escoto
|
Ben Escoto
|
||||||
Andy Eskilsson
|
Andy Eskilsson
|
||||||
|
André Espaze
|
||||||
Stefan Esser
|
Stefan Esser
|
||||||
Stephen D Evans
|
Stephen D Evans
|
||||||
Carey Evans
|
Carey Evans
|
||||||
|
@ -277,8 +288,10 @@ Martijn Faassen
|
||||||
Clovis Fabricio
|
Clovis Fabricio
|
||||||
Andreas Faerber
|
Andreas Faerber
|
||||||
Bill Fancher
|
Bill Fancher
|
||||||
|
Andrew Francis
|
||||||
Troy J. Farrell
|
Troy J. Farrell
|
||||||
Mark Favas
|
Mark Favas
|
||||||
|
Boris Feld
|
||||||
Niels Ferguson
|
Niels Ferguson
|
||||||
Sebastian Fernandez
|
Sebastian Fernandez
|
||||||
Florian Festi
|
Florian Festi
|
||||||
|
@ -328,6 +341,7 @@ Dinu Gherman
|
||||||
Jonathan Giddy
|
Jonathan Giddy
|
||||||
Johannes Gijsbers
|
Johannes Gijsbers
|
||||||
Michael Gilfix
|
Michael Gilfix
|
||||||
|
Yannick Gingras
|
||||||
Christoph Gohlke
|
Christoph Gohlke
|
||||||
Tim Golden
|
Tim Golden
|
||||||
Chris Gonnerman
|
Chris Gonnerman
|
||||||
|
@ -351,6 +365,7 @@ Václav Haisman
|
||||||
Bob Halley
|
Bob Halley
|
||||||
Jesse Hallio
|
Jesse Hallio
|
||||||
Jun Hamano
|
Jun Hamano
|
||||||
|
Alexandre Hamelin
|
||||||
Mark Hammond
|
Mark Hammond
|
||||||
Manus Hand
|
Manus Hand
|
||||||
Milton L. Hankins
|
Milton L. Hankins
|
||||||
|
@ -382,6 +397,7 @@ Bernhard Herzog
|
||||||
Magnus L. Hetland
|
Magnus L. Hetland
|
||||||
Raymond Hettinger
|
Raymond Hettinger
|
||||||
Kevan Heydon
|
Kevan Heydon
|
||||||
|
Kelsey Hightower
|
||||||
Jason Hildebrand
|
Jason Hildebrand
|
||||||
Richie Hindle
|
Richie Hindle
|
||||||
Konrad Hinsen
|
Konrad Hinsen
|
||||||
|
@ -409,6 +425,7 @@ Jan Hosang
|
||||||
Ken Howard
|
Ken Howard
|
||||||
Brad Howes
|
Brad Howes
|
||||||
Chih-Hao Huang
|
Chih-Hao Huang
|
||||||
|
Christian Hudon
|
||||||
Lawrence Hudson
|
Lawrence Hudson
|
||||||
Michael Hudson
|
Michael Hudson
|
||||||
Jim Hugunin
|
Jim Hugunin
|
||||||
|
@ -436,6 +453,7 @@ Bertrand Janin
|
||||||
Geert Jansen
|
Geert Jansen
|
||||||
Jack Jansen
|
Jack Jansen
|
||||||
Bill Janssen
|
Bill Janssen
|
||||||
|
Julien Jehannet
|
||||||
Drew Jenkins
|
Drew Jenkins
|
||||||
Flemming Kjær Jensen
|
Flemming Kjær Jensen
|
||||||
MunSic Jeong
|
MunSic Jeong
|
||||||
|
@ -484,6 +502,7 @@ Reid Kleckner
|
||||||
Bastian Kleineidam
|
Bastian Kleineidam
|
||||||
Bob Kline
|
Bob Kline
|
||||||
Matthias Klose
|
Matthias Klose
|
||||||
|
Jeremy Kloth
|
||||||
Kim Knapp
|
Kim Knapp
|
||||||
Lenny Kneler
|
Lenny Kneler
|
||||||
Pat Knight
|
Pat Knight
|
||||||
|
@ -512,11 +531,13 @@ Tino Lange
|
||||||
Andrew Langmead
|
Andrew Langmead
|
||||||
Detlef Lannert
|
Detlef Lannert
|
||||||
Soren Larsen
|
Soren Larsen
|
||||||
|
Amos Latteier
|
||||||
Piers Lauder
|
Piers Lauder
|
||||||
Ben Laurie
|
Ben Laurie
|
||||||
Simon Law
|
Simon Law
|
||||||
Chris Lawrence
|
Chris Lawrence
|
||||||
Brian Leair
|
Brian Leair
|
||||||
|
Mathieu Leduc-Hamel
|
||||||
James Lee
|
James Lee
|
||||||
John J. Lee
|
John J. Lee
|
||||||
Inyeol Lee
|
Inyeol Lee
|
||||||
|
@ -532,6 +553,7 @@ Luke Kenneth Casson Leighton
|
||||||
Marc-Andre Lemburg
|
Marc-Andre Lemburg
|
||||||
John Lenton
|
John Lenton
|
||||||
Christopher Tur Lesniewski-Laas
|
Christopher Tur Lesniewski-Laas
|
||||||
|
Alain Leufroy
|
||||||
Mark Levinson
|
Mark Levinson
|
||||||
William Lewis
|
William Lewis
|
||||||
Xuanji Li
|
Xuanji Li
|
||||||
|
@ -576,6 +598,7 @@ Owen Martin
|
||||||
Sébastien Martini
|
Sébastien Martini
|
||||||
Roger Masse
|
Roger Masse
|
||||||
Nick Mathewson
|
Nick Mathewson
|
||||||
|
Simon Mathieu
|
||||||
Graham Matthews
|
Graham Matthews
|
||||||
Dieter Maurer
|
Dieter Maurer
|
||||||
Arnaud Mazin
|
Arnaud Mazin
|
||||||
|
@ -595,7 +618,9 @@ Lucas Prado Melo
|
||||||
Ezio Melotti
|
Ezio Melotti
|
||||||
Brian Merrell
|
Brian Merrell
|
||||||
Luke Mewburn
|
Luke Mewburn
|
||||||
|
Carl Meyer
|
||||||
Mike Meyer
|
Mike Meyer
|
||||||
|
Alexis Métaireau
|
||||||
Steven Miale
|
Steven Miale
|
||||||
Trent Mick
|
Trent Mick
|
||||||
Stan Mihai
|
Stan Mihai
|
||||||
|
@ -605,21 +630,26 @@ Chad Miller
|
||||||
Jason V. Miller
|
Jason V. Miller
|
||||||
Jay T. Miller
|
Jay T. Miller
|
||||||
Roman Milner
|
Roman Milner
|
||||||
|
Julien Miotte
|
||||||
Andrii V. Mishkovskyi
|
Andrii V. Mishkovskyi
|
||||||
Dustin J. Mitchell
|
Dustin J. Mitchell
|
||||||
Dom Mitchell
|
Dom Mitchell
|
||||||
|
Zubin Mithra
|
||||||
Doug Moen
|
Doug Moen
|
||||||
The Dragon De Monsyne
|
The Dragon De Monsyne
|
||||||
Skip Montanaro
|
Skip Montanaro
|
||||||
Paul Moore
|
Paul Moore
|
||||||
Derek Morr
|
Derek Morr
|
||||||
James A Morrison
|
James A Morrison
|
||||||
|
Derek McTavish Mounce
|
||||||
Pablo Mouzo
|
Pablo Mouzo
|
||||||
Mher Movsisyan
|
Mher Movsisyan
|
||||||
Sjoerd Mullender
|
Sjoerd Mullender
|
||||||
Sape Mullender
|
Sape Mullender
|
||||||
Michael Muller
|
Michael Muller
|
||||||
Neil Muller
|
Neil Muller
|
||||||
|
Michael Mulich
|
||||||
|
Louis Munro
|
||||||
R. David Murray
|
R. David Murray
|
||||||
Piotr Meyer
|
Piotr Meyer
|
||||||
John Nagle
|
John Nagle
|
||||||
|
@ -672,11 +702,14 @@ Peter Parente
|
||||||
Alexandre Parenteau
|
Alexandre Parenteau
|
||||||
Dan Parisien
|
Dan Parisien
|
||||||
Harri Pasanen
|
Harri Pasanen
|
||||||
|
Gaël Pasgrimaud
|
||||||
Randy Pausch
|
Randy Pausch
|
||||||
Samuele Pedroni
|
Samuele Pedroni
|
||||||
Marcel van der Peijl
|
Marcel van der Peijl
|
||||||
Steven Pemberton
|
Steven Pemberton
|
||||||
Santiago Peresón
|
Santiago Peresón
|
||||||
|
George Peristerakis
|
||||||
|
Mathieu Perreault
|
||||||
Mark Perrego
|
Mark Perrego
|
||||||
Trevor Perrin
|
Trevor Perrin
|
||||||
Gabriel de Perthuis
|
Gabriel de Perthuis
|
||||||
|
@ -685,6 +718,7 @@ Benjamin Peterson
|
||||||
Joe Peterson
|
Joe Peterson
|
||||||
Chris Petrilli
|
Chris Petrilli
|
||||||
Bjorn Pettersen
|
Bjorn Pettersen
|
||||||
|
Ronny Pfannschmidt
|
||||||
Geoff Philbrick
|
Geoff Philbrick
|
||||||
Gavrie Philipson
|
Gavrie Philipson
|
||||||
Adrian Phillips
|
Adrian Phillips
|
||||||
|
@ -731,6 +765,7 @@ Michael P. Reilly
|
||||||
Bernhard Reiter
|
Bernhard Reiter
|
||||||
Steven Reiz
|
Steven Reiz
|
||||||
Roeland Rengelink
|
Roeland Rengelink
|
||||||
|
Antoine Reversat
|
||||||
Tim Rice
|
Tim Rice
|
||||||
Francesco Ricciardi
|
Francesco Ricciardi
|
||||||
Jan Pieter Riegel
|
Jan Pieter Riegel
|
||||||
|
@ -745,11 +780,14 @@ Andy Robinson
|
||||||
Mark Roddy
|
Mark Roddy
|
||||||
Kevin Rodgers
|
Kevin Rodgers
|
||||||
Giampaolo Rodola
|
Giampaolo Rodola
|
||||||
|
Luis Rojas
|
||||||
Mike Romberg
|
Mike Romberg
|
||||||
Armin Ronacher
|
Armin Ronacher
|
||||||
Case Roole
|
Case Roole
|
||||||
Timothy Roscoe
|
Timothy Roscoe
|
||||||
|
Erik Rose
|
||||||
Jim Roskind
|
Jim Roskind
|
||||||
|
Brian Rosner
|
||||||
Just van Rossum
|
Just van Rossum
|
||||||
Hugo van Rossum
|
Hugo van Rossum
|
||||||
Saskia van Rossum
|
Saskia van Rossum
|
||||||
|
|
14
Misc/NEWS
14
Misc/NEWS
|
@ -10,6 +10,10 @@ What's New in Python 3.3 Alpha 1?
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #1195: my_fgets() now always clears errors before calling fgets(). Fix
|
||||||
|
the following case: sys.stdin.read() stopped with CTRL+d (end of file),
|
||||||
|
raw_input() interrupted by CTRL+c.
|
||||||
|
|
||||||
- Issue #12216: Allow unexpected EOF errors to happen on any line of the file.
|
- Issue #12216: Allow unexpected EOF errors to happen on any line of the file.
|
||||||
|
|
||||||
- Issue #12199: The TryExcept and TryFinally and AST nodes have been unified
|
- Issue #12199: The TryExcept and TryFinally and AST nodes have been unified
|
||||||
|
@ -177,6 +181,13 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #12028: Make threading._get_ident() public, rename it to
|
||||||
|
threading.get_ident() and document it. This function was already used using
|
||||||
|
_thread.get_ident().
|
||||||
|
|
||||||
|
- Issue #12171: IncrementalEncoder.reset() of CJK codecs (multibytecodec) calls
|
||||||
|
encreset() instead of decreset().
|
||||||
|
|
||||||
- Issue #12218: Removed wsgiref.egg-info.
|
- Issue #12218: Removed wsgiref.egg-info.
|
||||||
|
|
||||||
- Issue #12196: Add pipe2() to the os module.
|
- Issue #12196: Add pipe2() to the os module.
|
||||||
|
@ -774,6 +785,9 @@ Extension Modules
|
||||||
Tests
|
Tests
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
- Issue #12057: Add tests for ISO 2022 codecs (iso2022_jp, iso2022_jp_2,
|
||||||
|
iso2022_kr).
|
||||||
|
|
||||||
- Issue #12180: Fixed a few remaining errors in test_packaging when no
|
- Issue #12180: Fixed a few remaining errors in test_packaging when no
|
||||||
threading.
|
threading.
|
||||||
|
|
||||||
|
|
|
@ -901,11 +901,17 @@ mbiencoder_encode(MultibyteIncrementalEncoderObject *self,
|
||||||
static PyObject *
|
static PyObject *
|
||||||
mbiencoder_reset(MultibyteIncrementalEncoderObject *self)
|
mbiencoder_reset(MultibyteIncrementalEncoderObject *self)
|
||||||
{
|
{
|
||||||
if (self->codec->decreset != NULL &&
|
/* Longest output: 4 bytes (b'\x0F\x1F(B') with ISO 2022 */
|
||||||
self->codec->decreset(&self->state, self->codec->config) != 0)
|
unsigned char buffer[4], *outbuf;
|
||||||
return NULL;
|
Py_ssize_t r;
|
||||||
|
if (self->codec->encreset != NULL) {
|
||||||
|
outbuf = buffer;
|
||||||
|
r = self->codec->encreset(&self->state, self->codec->config,
|
||||||
|
&outbuf, sizeof(buffer));
|
||||||
|
if (r != 0)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
self->pendingsize = 0;
|
self->pendingsize = 0;
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -237,7 +237,8 @@ PyObject_AsCharBuffer(PyObject *obj,
|
||||||
pb = obj->ob_type->tp_as_buffer;
|
pb = obj->ob_type->tp_as_buffer;
|
||||||
if (pb == NULL || pb->bf_getbuffer == NULL) {
|
if (pb == NULL || pb->bf_getbuffer == NULL) {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
"expected an object with the buffer interface");
|
"expected bytes, bytearray "
|
||||||
|
"or buffer compatible object");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ((*pb->bf_getbuffer)(obj, &view, PyBUF_SIMPLE)) return -1;
|
if ((*pb->bf_getbuffer)(obj, &view, PyBUF_SIMPLE)) return -1;
|
||||||
|
|
|
@ -40,6 +40,7 @@ my_fgets(char *buf, int len, FILE *fp)
|
||||||
if (PyOS_InputHook != NULL)
|
if (PyOS_InputHook != NULL)
|
||||||
(void)(PyOS_InputHook)();
|
(void)(PyOS_InputHook)();
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
clearerr(fp);
|
||||||
p = fgets(buf, len, fp);
|
p = fgets(buf, len, fp);
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
return 0; /* No error */
|
return 0; /* No error */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue