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

Skip to content

Commit e223eb8

Browse files
committed
Merged revisions 74075,74187,74197,74201,74216,74225 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r74075 | georg.brandl | 2009-07-18 05:06:31 -0400 (Sat, 18 Jul 2009) | 1 line #6505: fix typos. ........ r74187 | benjamin.peterson | 2009-07-23 10:19:08 -0400 (Thu, 23 Jul 2009) | 1 line use bools for autoraise ........ r74197 | benjamin.peterson | 2009-07-24 22:03:48 -0400 (Fri, 24 Jul 2009) | 1 line clarify ........ r74201 | amaury.forgeotdarc | 2009-07-25 12:22:06 -0400 (Sat, 25 Jul 2009) | 2 lines Better name a variable: 'buf' seems to imply a mutable buffer. ........ r74216 | michael.foord | 2009-07-26 17:12:14 -0400 (Sun, 26 Jul 2009) | 1 line Issue 6581. Michael Foord ........ r74225 | kurt.kaiser | 2009-07-27 12:09:28 -0400 (Mon, 27 Jul 2009) | 5 lines 1. Clean workspace more thoughly before build. 2. Add url of branch we are building to 'results' webpage. (url is now available in $repo_path, could be added to failure email.) 3. Adjust permissions to improve upload reliability. ........
1 parent e9ce1fb commit e223eb8

6 files changed

Lines changed: 45 additions & 30 deletions

File tree

Doc/tutorial/inputoutput.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ Positional and keyword arguments can be arbitrarily combined::
152152
other='Georg'))
153153
The story of Bill, Manfred, and Georg.
154154

155-
An optional ``':'`` and format specifier can follow the field name. This also
155+
An optional ``':'`` and format specifier can follow the field name. This allows
156156
greater control over how the value is formatted. The following example
157-
truncates the Pi to three places after the decimal.
157+
truncates Pi to three places after the decimal.
158158

159159
>>> import math
160160
>>> print('The value of PI is approximately {0:.3f}.'.format(math.pi))
@@ -208,8 +208,8 @@ operation. For example::
208208
The value of PI is approximately 3.142.
209209

210210
Since :meth:`str.format` is quite new, a lot of Python code still uses the ``%``
211-
operator. However, because this old style of formatting will eventually removed
212-
from the language :meth:`str.format` should generally be used.
211+
operator. However, because this old style of formatting will eventually be
212+
removed from the language, :meth:`str.format` should generally be used.
213213

214214
More information can be found in the :ref:`old-string-formatting` section.
215215

Lib/inspect.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,10 @@ def getinnerframes(tb, context=1):
994994
tb = tb.tb_next
995995
return framelist
996996

997-
currentframe = sys._getframe
997+
if hasattr(sys, '_getframe'):
998+
currentframe = sys._getframe
999+
else:
1000+
currentframe = lambda _=None: None
9981001

9991002
def stack(context=1):
10001003
"""Return a list of records for the stack above the caller's frame."""

Lib/webbrowser.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def get(using=None):
5656
# It is recommended one does "import webbrowser" and uses webbrowser.open(url)
5757
# instead of "from webbrowser import *".
5858

59-
def open(url, new=0, autoraise=1):
59+
def open(url, new=0, autoraise=True):
6060
for name in _tryorder:
6161
browser = get(name)
6262
if browser.open(url, new, autoraise):
@@ -145,7 +145,7 @@ def __init__(self, name=""):
145145
self.name = name
146146
self.basename = name
147147

148-
def open(self, url, new=0, autoraise=1):
148+
def open(self, url, new=0, autoraise=True):
149149
raise NotImplementedError
150150

151151
def open_new(self, url):
@@ -169,7 +169,7 @@ def __init__(self, name):
169169
self.args = name[1:]
170170
self.basename = os.path.basename(self.name)
171171

172-
def open(self, url, new=0, autoraise=1):
172+
def open(self, url, new=0, autoraise=True):
173173
cmdline = [self.name] + [arg.replace("%s", url)
174174
for arg in self.args]
175175
try:
@@ -186,7 +186,7 @@ class BackgroundBrowser(GenericBrowser):
186186
"""Class for all browsers which are to be started in the
187187
background."""
188188

189-
def open(self, url, new=0, autoraise=1):
189+
def open(self, url, new=0, autoraise=True):
190190
cmdline = [self.name] + [arg.replace("%s", url)
191191
for arg in self.args]
192192
try:
@@ -217,7 +217,7 @@ def _invoke(self, args, remote, autoraise):
217217
raise_opt = []
218218
if remote and self.raise_opts:
219219
# use autoraise argument only for remote invocation
220-
autoraise = int(bool(autoraise))
220+
autoraise = int(autoraise)
221221
opt = self.raise_opts[autoraise]
222222
if opt: raise_opt = [opt]
223223

@@ -257,7 +257,7 @@ def _invoke(self, args, remote, autoraise):
257257
else:
258258
return not p.wait()
259259

260-
def open(self, url, new=0, autoraise=1):
260+
def open(self, url, new=0, autoraise=True):
261261
if new == 0:
262262
action = self.remote_action
263263
elif new == 1:
@@ -341,7 +341,7 @@ class Konqueror(BaseBrowser):
341341
for more information on the Konqueror remote-control interface.
342342
"""
343343

344-
def open(self, url, new=0, autoraise=1):
344+
def open(self, url, new=0, autoraise=True):
345345
# XXX Currently I know no way to prevent KFM from opening a new win.
346346
if new == 2:
347347
action = "newTab"
@@ -429,7 +429,7 @@ def _remote(self, action):
429429
s.close()
430430
return 1
431431

432-
def open(self, url, new=0, autoraise=1):
432+
def open(self, url, new=0, autoraise=True):
433433
if new:
434434
ok = self._remote("LOADNEW " + url)
435435
else:
@@ -512,7 +512,7 @@ def register_X_browsers():
512512

513513
if sys.platform[:3] == "win":
514514
class WindowsDefault(BaseBrowser):
515-
def open(self, url, new=0, autoraise=1):
515+
def open(self, url, new=0, autoraise=True):
516516
try:
517517
os.startfile(url)
518518
except WindowsError:
@@ -546,7 +546,7 @@ def open(self, url, new=0, autoraise=1):
546546
pass
547547
else:
548548
class InternetConfig(BaseBrowser):
549-
def open(self, url, new=0, autoraise=1):
549+
def open(self, url, new=0, autoraise=True):
550550
ic.launchurl(url)
551551
return True # Any way to get status?
552552

@@ -567,7 +567,7 @@ class MacOSX(BaseBrowser):
567567
def __init__(self, name):
568568
self.name = name
569569

570-
def open(self, url, new=0, autoraise=1):
570+
def open(self, url, new=0, autoraise=True):
571571
assert "'" not in url
572572
# hack for local urls
573573
if not ':' in url:

Misc/build.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
## does this:
55
## svn up ; ./configure ; make ; make test ; make install ; cd Doc ; make
66
##
7-
## Logs are kept and rsync'ed to the host. If there are test failure(s),
7+
## Logs are kept and rsync'ed to the webhost. If there are test failure(s),
88
## information about the failure(s) is mailed.
99
##
10+
## The user must be a member of the webmaster group locally and on webhost.
11+
##
1012
## This script is run on the PSF's machine as user neal via crontab.
1113
##
1214
## Yes, this script would probably be easier in python, but then
@@ -76,7 +78,8 @@ ALWAYS_SKIP="-x $_ALWAYS_SKIP"
7678
# Skip these tests altogether when looking for leaks. These tests
7779
# do not need to be stored above in LEAKY_TESTS too.
7880
# test_logging causes hangs, skip it.
79-
LEAKY_SKIPS="-x test_logging $_ALWAYS_SKIP"
81+
# KBK 21Apr09: test_httpservers causes hangs, skip for now.
82+
LEAKY_SKIPS="-x test_compiler test_logging test_httpservers"
8083

8184
# Change this flag to "yes" for old releases to only update/build the docs.
8285
BUILD_DISABLED="no"
@@ -133,9 +136,14 @@ mail_on_failure() {
133136

134137
## setup
135138
cd $DIR
139+
make clobber /dev/null 2>&1
140+
cp -p Modules/Setup.dist Modules/Setup
141+
# But maybe there was no Makefile - we are only building docs. Clear build:
142+
rm -rf build/
136143
mkdir -p build
137-
rm -f $RESULT_FILE build/*.out
138144
rm -rf $INSTALL_DIR
145+
## get the path we are building
146+
repo_path=$(grep "url=" .svn/entries | sed -e s/\\W*url=// -e s/\"//g)
139147

140148
## create results file
141149
TITLE="Automated Python Build Results"
@@ -153,6 +161,8 @@ echo " </tr><tr>" >> $RESULT_FILE
153161
echo " <td>Hostname:</td><td>`uname -n`</td>" >> $RESULT_FILE
154162
echo " </tr><tr>" >> $RESULT_FILE
155163
echo " <td>Platform:</td><td>`uname -srmpo`</td>" >> $RESULT_FILE
164+
echo " </tr><tr>" >> $RESULT_FILE
165+
echo " <td>URL:</td><td>$repo_path</td>" >> $RESULT_FILE
156166
echo " </tr>" >> $RESULT_FILE
157167
echo "</table>" >> $RESULT_FILE
158168
echo "<ul>" >> $RESULT_FILE
@@ -223,7 +233,7 @@ if [ $err = 0 -a "$BUILD_DISABLED" != "yes" ]; then
223233
start=`current_time`
224234
## ensure that the reflog exists so the grep doesn't fail
225235
touch $REFLOG
226-
$PYTHON $REGRTEST_ARGS -R 4:3:$REFLOG -u network,urlfetch $LEAKY_SKIPS >& build/$F
236+
$PYTHON $REGRTEST_ARGS -R 4:3:$REFLOG -u network $LEAKY_SKIPS >& build/$F
227237
LEAK_PAT="($LEAKY_TESTS|sum=0)"
228238
NUM_FAILURES=`egrep -vc "$LEAK_PAT" $REFLOG`
229239
place_summary_first build/$F
@@ -259,13 +269,13 @@ start=`current_time`
259269
# which will definitely fail with a conflict.
260270
#CONFLICTED_FILE=commontex/boilerplate.tex
261271
#conflict_count=`grep -c "<<<" $CONFLICTED_FILE`
262-
make clean
263272
conflict_count=0
264273
if [ $conflict_count != 0 ]; then
265274
echo "Conflict detected in $CONFLICTED_FILE. Doc build skipped." > ../build/$F
266275
err=1
267276
else
268-
make checkout update html >& ../build/$F
277+
make clean > ../build/$F 2>&1
278+
make checkout update html >> ../build/$F 2>&1
269279
err=$?
270280
fi
271281
update_status "Making doc" "$F" $start
@@ -279,6 +289,8 @@ echo "</body>" >> $RESULT_FILE
279289
echo "</html>" >> $RESULT_FILE
280290

281291
## copy results
292+
chgrp -R webmaster build/html
293+
chmod -R g+w build/html
282294
rsync $RSYNC_OPTS build/html/* $REMOTE_SYSTEM:$REMOTE_DIR
283295
cd ../build
284296
rsync $RSYNC_OPTS index.html *.out $REMOTE_SYSTEM:$REMOTE_DIR/results/

Objects/dictobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ PyDict_GetItem(PyObject *op, PyObject *key)
718718
running "python -Wi" for an example related to string interning.
719719
Let's just hope that no exception occurs then... This must be
720720
_PyThreadState_Current and not PyThreadState_GET() because in debug
721-
mode, it complains if tstate is NULL. */
721+
mode, the latter complains if tstate is NULL. */
722722
tstate = _PyThreadState_Current;
723723
if (tstate != NULL && tstate->curexc_type != NULL) {
724724
/* preserve the existing exception */

Python/import.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,7 +1783,7 @@ static int init_builtin(char *); /* Forward */
17831783
its module object WITH INCREMENTED REFERENCE COUNT */
17841784

17851785
static PyObject *
1786-
load_module(char *name, FILE *fp, char *buf, int type, PyObject *loader)
1786+
load_module(char *name, FILE *fp, char *pathname, int type, PyObject *loader)
17871787
{
17881788
PyObject *modules;
17891789
PyObject *m;
@@ -1804,27 +1804,27 @@ load_module(char *name, FILE *fp, char *buf, int type, PyObject *loader)
18041804
switch (type) {
18051805

18061806
case PY_SOURCE:
1807-
m = load_source_module(name, buf, fp);
1807+
m = load_source_module(name, pathname, fp);
18081808
break;
18091809

18101810
case PY_COMPILED:
1811-
m = load_compiled_module(name, buf, fp);
1811+
m = load_compiled_module(name, pathname, fp);
18121812
break;
18131813

18141814
#ifdef HAVE_DYNAMIC_LOADING
18151815
case C_EXTENSION:
1816-
m = _PyImport_LoadDynamicModule(name, buf, fp);
1816+
m = _PyImport_LoadDynamicModule(name, pathname, fp);
18171817
break;
18181818
#endif
18191819

18201820
case PKG_DIRECTORY:
1821-
m = load_package(name, buf);
1821+
m = load_package(name, pathname);
18221822
break;
18231823

18241824
case C_BUILTIN:
18251825
case PY_FROZEN:
1826-
if (buf != NULL && buf[0] != '\0')
1827-
name = buf;
1826+
if (pathname != NULL && pathname[0] != '\0')
1827+
name = pathname;
18281828
if (type == C_BUILTIN)
18291829
err = init_builtin(name);
18301830
else

0 commit comments

Comments
 (0)