Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f5c7c2e

Browse files
committed
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62055-62058,62060-62066,62068-62074,62076-62079,62081-62083,62086-62089,62092-62094,62098,62101,62104,62106-62109,62115-62122,62124-62125,62127-62128,62130,62132,62134-62137,62139-62142,62144,62146-62148,62150-62152,62155-62161 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r62127 | trent.nelson | 2008-04-03 08:39:17 -0700 (Thu, 03 Apr 2008) | 1 line Remove the building of Berkeley DB step; _bsddb44.vcproj takes care of this for us now. ........ r62136 | amaury.forgeotdarc | 2008-04-03 16:07:55 -0700 (Thu, 03 Apr 2008) | 9 lines #1733757: the interpreter would hang on shutdown, if the function set by sys.settrace calls threading.currentThread. The correction somewhat improves the code, but it was close. Many thanks to the "with" construct, which turns python code into C calls. I wonder if it is not better to sys.settrace(None) just after running the __main__ module and before finalization. ........ r62141 | jeffrey.yasskin | 2008-04-03 21:51:19 -0700 (Thu, 03 Apr 2008) | 5 lines Doh! os.read() raises an OSError, not an IOError when it's interrupted. And fix some flakiness in test_itimer_prof, which could detect that the timer had reached 0 before the signal arrived announcing that fact. ........ r62142 | fred.drake | 2008-04-03 22:41:30 -0700 (Thu, 03 Apr 2008) | 4 lines - Issue #2385: distutils.core.run_script() makes __file__ available, so the controlled environment will more closely mirror the typical script environment. This supports setup.py scripts that refer to data files. ........ r62147 | fred.drake | 2008-04-04 04:31:14 -0700 (Fri, 04 Apr 2008) | 6 lines my previous change did what I said it should not: it changed the current directory to the directory in which the setup.py script lived (which made __file__ wrong) fixed, with test that the script is run in the current directory of the caller ........ r62148 | fred.drake | 2008-04-04 04:38:51 -0700 (Fri, 04 Apr 2008) | 2 lines stupid, stupid, stupid! ........ r62150 | jeffrey.yasskin | 2008-04-04 09:48:19 -0700 (Fri, 04 Apr 2008) | 2 lines Oops again. EINTR is in errno, not signal. ........ r62158 | andrew.kuchling | 2008-04-04 19:42:20 -0700 (Fri, 04 Apr 2008) | 1 line Minor edits ........ r62159 | andrew.kuchling | 2008-04-04 19:47:07 -0700 (Fri, 04 Apr 2008) | 1 line Markup fix; explain what interval timers do; typo fix ........ r62160 | andrew.kuchling | 2008-04-04 20:38:39 -0700 (Fri, 04 Apr 2008) | 1 line Various edits ........ r62161 | neal.norwitz | 2008-04-04 21:26:31 -0700 (Fri, 04 Apr 2008) | 9 lines Prevent test_sqlite from hanging on older versions of sqlite. The problem is that when trying to do the second insert, sqlite seems to sleep for a very long time. Here is the output from strace: read(6, "SQLite format 3\0\4\0\1\1\0@ \0\0\0\1\0\0\0\0"..., 1024) = 1024 nanosleep({4294, 966296000}, <unfinished ...> I don't know which version this was fixed in, but 3.2.1 definitely fails. ........
1 parent 9ed7735 commit f5c7c2e

9 files changed

Lines changed: 188 additions & 34 deletions

File tree

Doc/library/signal.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ The variables defined in the :mod:`signal` module are:
8282

8383
.. data:: ITIMER_REAL
8484

85-
Decrements interval timer in real time, and delivers SIGALRM upon expiration.
85+
Decrements interval timer in real time, and delivers :const:`SIGALRM` upon expiration.
8686

8787

8888
.. data:: ITIMER_VIRTUAL
@@ -143,12 +143,18 @@ The :mod:`signal` module defines the following functions:
143143

144144
.. function:: setitimer(which, seconds[, interval])
145145

146-
Sets given itimer (one of :const:`signal.ITIMER_REAL`,
147-
:const:`signal.ITIMER_VIRTUAL` or :const:`signal.ITIMER_PROF`) especified
146+
Sets given interval timer (one of :const:`signal.ITIMER_REAL`,
147+
:const:`signal.ITIMER_VIRTUAL` or :const:`signal.ITIMER_PROF`) specified
148148
by *which* to fire after *seconds* (float is accepted, different from
149149
:func:`alarm`) and after that every *interval* seconds. The interval
150150
timer specified by *which* can be cleared by setting seconds to zero.
151151

152+
When an interval timer fires, a signal is sent to the process.
153+
The signal sent is dependent on the timer being used;
154+
:const:`signal.ITIMER_REAL` will deliver :const:`SIGALRM`,
155+
:const:`signal.ITIMER_VIRTUAL` sends :const:`SIGVTALRM`,
156+
and :const:`signal.ITIMER_PROF` will deliver :const:`SIGPROF`.
157+
152158
The old values are returned as a tuple: (delay, interval).
153159

154160
Attempting to pass an invalid interval timer will cause a
@@ -159,7 +165,7 @@ The :mod:`signal` module defines the following functions:
159165

160166
.. function:: getitimer(which)
161167

162-
Returns current value of a given itimer especified by *which*.
168+
Returns current value of a given interval timer specified by *which*.
163169

164170
.. versionadded:: 2.6
165171

Doc/whatsnew/2.6.rst

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,11 @@ The infrastructure committee of the Python Software Foundation
133133
therefore posted a call for issue trackers, asking volunteers to set
134134
up different products and import some of the bugs and patches from
135135
SourceForge. Four different trackers were examined: Atlassian's `Jira
136-
<XXX>`__, `Launchpad <http://www.launchpad.net>`__, ` `Roundup
137-
<XXX>`__, and Trac <XXX>`__. The committee eventually settled on Jira
136+
<http://www.atlassian.com/software/jira/>`__,
137+
`Launchpad <http://www.launchpad.net>`__,
138+
`Roundup <http://roundup.sourceforge.net/>`__, and
139+
Trac <http://trac.edgewall.org/>`__.
140+
The committee eventually settled on Jira
138141
and Roundup as the two candidates. Jira is a commercial product that
139142
offers a no-cost hosted instance to free-software projects; Roundup
140143
is an open-source project that requires volunteers
@@ -146,19 +149,18 @@ host multiple trackers, and this server now also hosts issue trackers
146149
for Jython and for the Python web site. It will surely find
147150
other uses in the future.
148151

149-
Hosting is kindly provided by `Upfront <XXX>`__ of XXX. Martin von
150-
Loewis put a lot of effort into importing existing bugs and patches
151-
from SourceForge; his scripts for this import are at XXX.
152+
Hosting is kindly provided by `Upfront Systems <http://www.upfrontsystems.co.za/>`__ of Stellenbosch, South Africa. Martin von Loewis put a
153+
lot of effort into importing existing bugs and patches from
154+
SourceForge; his scripts for this import operation are at
155+
http://svn.python.org/view/tracker/importer/.
152156

153157
.. seealso::
154158

155-
XXX Roundup web site.
159+
http://bugs.python.org: The Python bug tracker.
156160

157-
bugs.python.org
161+
http://bugs.jython.org: The Jython bug tracker.
158162

159-
bugs.jython.org
160-
161-
Python web site bug tracker
163+
http://roundup.sourceforge.net/: Roundup downloads and documentation.
162164

163165

164166
New Documentation Format: ReStructured Text
@@ -728,6 +730,21 @@ and it also supports the ``b''`` notation.
728730

729731
.. ======================================================================
730732
733+
.. _pep-3116:
734+
735+
PEP 3116: New I/O Library
736+
=====================================================
737+
738+
XXX write this.
739+
740+
.. seealso::
741+
742+
:pep:`3116` - New I/O
743+
PEP written by Daniel Stutzbach, Mike Verdone, and Guido van Rossum.
744+
XXX code written by who?
745+
746+
.. ======================================================================
747+
731748
.. _pep-3118:
732749

733750
PEP 3118: Revised Buffer Protocol
@@ -895,8 +912,9 @@ one, :func:`math.trunc`, that's been backported to Python 2.6.
895912
:pep:`3141` - A Type Hierarchy for Numbers
896913
PEP written by Jeffrey Yasskin.
897914

898-
XXX link: Discusses Scheme's numeric tower.
915+
`Scheme's numerical tower <http://www.gnu.org/software/guile/manual/html_node/Numerical-Tower.html#Numerical-Tower>`__, from the Guile manual.
899916

917+
`Scheme's number datatypes <http://schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-9.html#%_sec_6.2>`__ from the R5RS Scheme specification.
900918

901919

902920
The :mod:`fractions` Module
@@ -1229,7 +1247,7 @@ complete list of changes, or look through the CVS logs for all the details.
12291247
* The :mod:`datetime` module's :meth:`strftime` methods now support a
12301248
``%f`` format code that expands to the number of microseconds in the
12311249
object, zero-padded on
1232-
the left to six places. (Contributed by XXX.)
1250+
the left to six places. (Contributed by Skip Montanaro.)
12331251

12341252
.. Patch 1158
12351253
@@ -1527,7 +1545,8 @@ complete list of changes, or look through the CVS logs for all the details.
15271545
numbers following a triangular distribution. The returned values
15281546
are between *low* and *high*, not including *high* itself, and
15291547
with *mode* as the mode, the most frequently occurring value
1530-
in the distribution. (Contributed by Raymond Hettinger. XXX check)
1548+
in the distribution. (Contributed by Wladmir van der Laan and
1549+
Raymond Hettinger.)
15311550

15321551
.. Patch 1681432
15331552
@@ -1544,7 +1563,7 @@ complete list of changes, or look through the CVS logs for all the details.
15441563
have a read-only :attr:`queue` attribute that returns the
15451564
contents of the scheduler's queue, represented as a list of
15461565
named tuples with the fields ``(time, priority, action, argument)``.
1547-
(Contributed by Raymond Hettinger XXX check.)
1566+
(Contributed by Raymond Hettinger.)
15481567

15491568
.. Patch 1861
15501569
@@ -1554,7 +1573,7 @@ complete list of changes, or look through the CVS logs for all the details.
15541573
objects; ``pollobj.modify(fd, eventmask)`` takes a file descriptor
15551574
or file object and an event mask,
15561575

1557-
(Contributed by XXX.)
1576+
(Contributed by Christian Heimes.)
15581577

15591578
.. Patch 1657
15601579
@@ -1571,7 +1590,7 @@ complete list of changes, or look through the CVS logs for all the details.
15711590
:cfunc:`PySignal_SetWakeupFd`, for setting the descriptor.
15721591

15731592
Event loops will use this by opening a pipe to create two descriptors,
1574-
one for reading and one for writing. The writeable descriptor
1593+
one for reading and one for writing. The writable descriptor
15751594
will be passed to :func:`set_wakeup_fd`, and the readable descriptor
15761595
will be added to the list of descriptors monitored by the event loop via
15771596
:cfunc:`select` or :cfunc:`poll`.
@@ -1586,6 +1605,16 @@ complete list of changes, or look through the CVS logs for all the details.
15861605
and allows changing whether signals can interrupt system calls or not.
15871606
(Contributed by Ralf Schmitt.)
15881607

1608+
The :func:`setitimer` and :func:`getitimer` functions have also been
1609+
added on systems that support these system calls. :func:`setitimer`
1610+
allows setting interval timers that will cause a signal to be
1611+
delivered to the process after a specified time, measured in
1612+
wall-clock time, consumed process time, or combined process+system
1613+
time. (Contributed by Guilherme Polo.)
1614+
1615+
.. Patch 2240
1616+
1617+
15891618
* The :mod:`smtplib` module now supports SMTP over SSL thanks to the
15901619
addition of the :class:`SMTP_SSL` class. This class supports an
15911620
interface identical to the existing :class:`SMTP` class. Both

Lib/distutils/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def run_setup (script_name, script_args=None, stop_after="run"):
207207
_setup_stop_after = stop_after
208208

209209
save_argv = sys.argv
210-
g = {}
210+
g = {'__file__': script_name}
211211
l = {}
212212
try:
213213
try:

Lib/distutils/tests/test_core.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
"""Tests for distutils.core."""
2+
3+
import io
4+
import distutils.core
5+
import os
6+
import shutil
7+
import sys
8+
import test.test_support
9+
import unittest
10+
11+
12+
# setup script that uses __file__
13+
setup_using___file__ = """\
14+
15+
__file__
16+
17+
from distutils.core import setup
18+
setup()
19+
"""
20+
21+
setup_prints_cwd = """\
22+
23+
import os
24+
print(os.getcwd())
25+
26+
from distutils.core import setup
27+
setup()
28+
"""
29+
30+
31+
class CoreTestCase(unittest.TestCase):
32+
33+
def setUp(self):
34+
self.old_stdout = sys.stdout
35+
self.cleanup_testfn()
36+
37+
def tearDown(self):
38+
sys.stdout = self.old_stdout
39+
self.cleanup_testfn()
40+
41+
def cleanup_testfn(self):
42+
path = test.test_support.TESTFN
43+
if os.path.isfile(path):
44+
os.remove(path)
45+
elif os.path.isdir(path):
46+
shutil.rmtree(path)
47+
48+
def write_setup(self, text, path=test.test_support.TESTFN):
49+
open(path, "w").write(text)
50+
return path
51+
52+
def test_run_setup_provides_file(self):
53+
# Make sure the script can use __file__; if that's missing, the test
54+
# setup.py script will raise NameError.
55+
distutils.core.run_setup(
56+
self.write_setup(setup_using___file__))
57+
58+
def test_run_setup_uses_current_dir(self):
59+
# This tests that the setup script is run with the current directory
60+
# as it's own current directory; this was temporarily broken by a
61+
# previous patch when TESTFN did not use the current directory.
62+
sys.stdout = io.StringIO()
63+
cwd = os.getcwd()
64+
65+
# Create a directory and write the setup.py file there:
66+
os.mkdir(test.test_support.TESTFN)
67+
setup_py = os.path.join(test.test_support.TESTFN, "setup.py")
68+
distutils.core.run_setup(
69+
self.write_setup(setup_prints_cwd, path=setup_py))
70+
71+
output = sys.stdout.getvalue()
72+
if output.endswith("\n"):
73+
output = output[:-1]
74+
self.assertEqual(cwd, output)
75+
76+
77+
def test_suite():
78+
return unittest.makeSuite(CoreTestCase)
79+
80+
if __name__ == "__main__":
81+
unittest.main(defaultTest="test_suite")

Lib/sqlite3/test/transactions.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ def CheckToggleAutoCommit(self):
112112
self.failUnlessEqual(len(res), 1)
113113

114114
def CheckRaiseTimeout(self):
115+
if sqlite.sqlite_version_info < (3, 2, 2):
116+
# This will fail (hang) on earlier versions of sqlite.
117+
# Determine exact version it was fixed. 3.2.1 hangs.
118+
return
115119
self.cur1.execute("create table test(i)")
116120
self.cur1.execute("insert into test(i) values (5)")
117121
try:
@@ -127,6 +131,10 @@ def CheckLocking(self):
127131
This tests the improved concurrency with pysqlite 2.3.4. You needed
128132
to roll back con2 before you could commit con1.
129133
"""
134+
if sqlite.sqlite_version_info < (3, 2, 2):
135+
# This will fail (hang) on earlier versions of sqlite.
136+
# Determine exact version it was fixed. 3.2.1 hangs.
137+
return
130138
self.cur1.execute("create table test(i)")
131139
self.cur1.execute("insert into test(i) values (5)")
132140
try:

Lib/test/test_signal.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def exit_subprocess():
3131
def ignoring_eintr(__func, *args, **kwargs):
3232
try:
3333
return __func(*args, **kwargs)
34-
except IOError as e:
35-
if e.errno != signal.EINTR:
34+
except EnvironmentError as e:
35+
if e.errno != errno.EINTR:
3636
raise
3737
return None
3838

@@ -363,12 +363,15 @@ def test_itimer_virtual(self):
363363
def test_itimer_prof(self):
364364
self.itimer = signal.ITIMER_PROF
365365
signal.signal(signal.SIGPROF, self.sig_prof)
366-
signal.setitimer(self.itimer, 0.2)
366+
signal.setitimer(self.itimer, 0.2, 0.2)
367367

368368
for i in range(100000000):
369369
if signal.getitimer(self.itimer) == (0.0, 0.0):
370370
break # sig_prof handler stopped this itimer
371371

372+
# profiling itimer should be (0.0, 0.0) now
373+
self.assertEquals(signal.getitimer(self.itimer), (0.0, 0.0))
374+
# and the handler should have been called
372375
self.assertEqual(self.hndl_called, True)
373376

374377
def test_main():

Lib/test/test_threading.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,35 @@ def waitingThread():
237237
"""])
238238
self.assertEqual(rc, 42)
239239

240+
def test_finalize_with_trace(self):
241+
# Issue1733757
242+
# Avoid a deadlock when sys.settrace steps into threading._shutdown
243+
import subprocess
244+
rc = subprocess.call([sys.executable, "-c", """if 1:
245+
import sys, threading
246+
247+
# A deadlock-killer, to prevent the
248+
# testsuite to hang forever
249+
def killer():
250+
import os, time
251+
time.sleep(2)
252+
print('program blocked; aborting')
253+
os._exit(2)
254+
t = threading.Thread(target=killer)
255+
t.setDaemon(True)
256+
t.start()
257+
258+
# This is the trace function
259+
def func(frame, event, arg):
260+
threading.currentThread()
261+
return func
262+
263+
sys.settrace(func)
264+
"""])
265+
self.failIf(rc == 2, "interpreted was blocked")
266+
self.failUnless(rc == 0, "Unexpected error")
267+
268+
240269
def test_enumerate_after_join(self):
241270
# Try hard to trigger #1703448: a thread is still returned in
242271
# threading.enumerate() after it has been join()ed.

Lib/threading.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -577,15 +577,16 @@ def _delete(self):
577577
# since it isn't if dummy_threading is *not* being used then don't
578578
# hide the exception.
579579

580-
_active_limbo_lock.acquire()
581580
try:
582-
try:
581+
with _active_limbo_lock:
583582
del _active[_get_ident()]
584-
except KeyError:
585-
if 'dummy_threading' not in _sys.modules:
586-
raise
587-
finally:
588-
_active_limbo_lock.release()
583+
# There must not be any python code between the previous line
584+
# and after the lock is released. Otherwise a tracing function
585+
# could try to acquire the lock again in the same thread, (in
586+
# currentThread()), and would block.
587+
except KeyError:
588+
if 'dummy_threading' not in _sys.modules:
589+
raise
589590

590591
def join(self, timeout=None):
591592
if not self._initialized:

Tools/buildbot/buildmsi.bat

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
cmd /c Tools\buildbot\external.bat
44
@rem build release versions of things
55
call "%VS90COMNTOOLS%vsvars32.bat"
6-
if not exist ..\db-4.4.20\build_win32\release\libdb44s.lib (
7-
vcbuild db-4.4.20\build_win32\Berkeley_DB.sln /build Release /project db_static
8-
)
96

107
@rem build Python
118
vcbuild /useenv PCbuild\pcbuild.sln "Release|Win32"

0 commit comments

Comments
 (0)