Permalink
Browse files

[#655] Upgrade to Python 2.6.1 for the Windows exe

  • Loading branch information...
1 parent 240e3b2 commit b2f546bf2d22577e059c337d746680869583ecfd Erwan Loisant committed Mar 14, 2011
Showing 2,322 changed files with 342,351 additions and 6,839 deletions.
View
0 play.bat 100644 → 100755
No changes.
View
Binary file not shown.
View
BIN python/DLLs/_ctypes.pyd 100644 → 100755
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
View
BIN python/DLLs/_socket.pyd 100644 → 100755
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
26 python/Lib/BaseHTTPServer.py 100644 → 100755
@@ -73,10 +73,15 @@
import sys
import time
import socket # For gethostbyaddr()
-import mimetools
+from warnings import filterwarnings, catch_warnings
+with catch_warnings():
+ if sys.py3kwarning:
+ filterwarnings("ignore", ".*mimetools has been removed",
+ DeprecationWarning)
+ import mimetools
import SocketServer
-# Default error message
+# Default error message template
DEFAULT_ERROR_MESSAGE = """\
<head>
<title>Error response</title>
@@ -89,6 +94,8 @@
</body>
"""
+DEFAULT_ERROR_CONTENT_TYPE = "text/html"
+
def _quote_html(html):
return html.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
@@ -216,6 +223,12 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
# where each string is of the form name[/version].
server_version = "BaseHTTP/" + __version__
+ # The default request version. This only affects responses up until
+ # the point where the request line is parsed, so it mainly decides what
+ # the client gets back when sending a malformed request line.
+ # Most web servers default to HTTP 0.9, i.e. don't send a status line.
+ default_request_version = "HTTP/0.9"
+
def parse_request(self):
"""Parse a request (internal).
@@ -228,7 +241,7 @@ def parse_request(self):
"""
self.command = None # set in case of error on the first line
- self.request_version = version = "HTTP/0.9" # Default
+ self.request_version = version = self.default_request_version
self.close_connection = 1
requestline = self.raw_requestline
if requestline[-2:] == '\r\n':
@@ -342,13 +355,14 @@ def send_error(self, code, message=None):
content = (self.error_message_format %
{'code': code, 'message': _quote_html(message), 'explain': explain})
self.send_response(code, message)
- self.send_header("Content-Type", "text/html")
+ self.send_header("Content-Type", self.error_content_type)
self.send_header('Connection', 'close')
self.end_headers()
if self.command != 'HEAD' and code >= 200 and code not in (204, 304):
self.wfile.write(content)
error_message_format = DEFAULT_ERROR_MESSAGE
+ error_content_type = DEFAULT_ERROR_CONTENT_TYPE
def send_response(self, code, message=None):
"""Send the response header and log the response code.
@@ -396,7 +410,7 @@ def log_request(self, code='-', size='-'):
self.log_message('"%s" %s %s',
self.requestline, str(code), str(size))
- def log_error(self, *args):
+ def log_error(self, format, *args):
"""Log an error.
This is called when a request cannot be fulfilled. By
@@ -408,7 +422,7 @@ def log_error(self, *args):
"""
- self.log_message(*args)
+ self.log_message(format, *args)
def log_message(self, format, *args):
"""Log an arbitrary message.
View
3 python/Lib/Bastion.py 100644 → 100755
@@ -25,6 +25,9 @@
bastion is created.
"""
+from warnings import warnpy3k
+warnpy3k("the Bastion module has been removed in Python 3.0", stacklevel=2)
+del warnpy3k
__all__ = ["BastionClass", "Bastion"]
View
14 python/Lib/CGIHTTPServer.py 100644 → 100755
@@ -70,17 +70,18 @@ def send_head(self):
return SimpleHTTPServer.SimpleHTTPRequestHandler.send_head(self)
def is_cgi(self):
- """Test whether self.path corresponds to a CGI script.
+ """Test whether self.path corresponds to a CGI script,
+ and return a boolean.
- Return a tuple (dir, rest) if self.path requires running a
- CGI script, None if not. Note that rest begins with a
+ This function sets self.cgi_info to a tuple (dir, rest)
+ when it returns True, where dir is the directory part before
+ the CGI script name. Note that rest begins with a
slash if it is not empty.
The default implementation tests whether the path
begins with one of the strings in the list
self.cgi_directories (and the next character is a '/'
or the end of the string).
-
"""
path = self.path
@@ -197,6 +198,9 @@ def run_cgi(self):
length = self.headers.getheader('content-length')
if length:
env['CONTENT_LENGTH'] = length
+ referer = self.headers.getheader('referer')
+ if referer:
+ env['HTTP_REFERER'] = referer
accept = []
for line in self.headers.getallmatchingheaders('accept'):
if line[:1] in "\t\n\r ":
@@ -214,7 +218,7 @@ def run_cgi(self):
# Since we're setting the env in the parent, provide empty
# values to override previously set values
for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH',
- 'HTTP_USER_AGENT', 'HTTP_COOKIE'):
+ 'HTTP_USER_AGENT', 'HTTP_COOKIE', 'HTTP_REFERER'):
env.setdefault(k, "")
os.environ.update(env)
View
51 python/Lib/ConfigParser.py 100644 → 100755
@@ -106,6 +106,21 @@
class Error(Exception):
"""Base class for ConfigParser exceptions."""
+ def _get_message(self):
+ """Getter for 'message'; needed only to override deprecation in
+ BaseException."""
+ return self.__message
+
+ def _set_message(self, value):
+ """Setter for 'message'; needed only to override deprecation in
+ BaseException."""
+ self.__message = value
+
+ # BaseException.message has been deprecated since Python 2.6. To prevent
+ # DeprecationWarning from popping up over this pre-existing attribute, use
+ # a new property that takes lookup precedence.
+ message = property(_get_message, _set_message)
+
def __init__(self, msg=''):
self.message = msg
Exception.__init__(self, msg)
@@ -199,11 +214,11 @@ def __init__(self, filename, lineno, line):
self.line = line
-
class RawConfigParser:
- def __init__(self, defaults=None):
- self._sections = {}
- self._defaults = {}
+ def __init__(self, defaults=None, dict_type=dict):
+ self._dict = dict_type
+ self._sections = self._dict()
+ self._defaults = self._dict()
if defaults:
for key, value in defaults.items():
self._defaults[self.optionxform(key)] = value
@@ -220,11 +235,15 @@ def add_section(self, section):
"""Create a new section in the configuration.
Raise DuplicateSectionError if a section by the specified name
- already exists.
+ already exists. Raise ValueError if name is DEFAULT or any of it's
+ case-insensitive variants.
"""
+ if section.lower() == "default":
+ raise ValueError, 'Invalid section name: %s' % section
+
if section in self._sections:
raise DuplicateSectionError(section)
- self._sections[section] = {}
+ self._sections[section] = self._dict()
def has_section(self, section):
"""Indicate whether the named section is present in the configuration.
@@ -307,7 +326,7 @@ def items(self, section):
except KeyError:
if section != DEFAULTSECT:
raise NoSectionError(section)
- d2 = {}
+ d2 = self._dict()
d = self._defaults.copy()
d.update(d2)
if "__name__" in d:
@@ -453,7 +472,8 @@ def _read(self, fp, fpname):
elif sectname == DEFAULTSECT:
cursect = self._defaults
else:
- cursect = {'__name__': sectname}
+ cursect = self._dict()
+ cursect['__name__'] = sectname
self._sections[sectname] = cursect
# So sections can't start with a continuation line
optname = None
@@ -568,7 +588,7 @@ def _interpolate(self, section, option, rawval, vars):
value = value % vars
except KeyError, e:
raise InterpolationMissingOptionError(
- option, section, rawval, e[0])
+ option, section, rawval, e.args[0])
else:
break
if "%(" in value:
@@ -593,7 +613,8 @@ def _interpolate(self, section, option, rawval, vars):
self._interpolate_some(option, L, rawval, section, vars, 1)
return ''.join(L)
- _interpvar_match = re.compile(r"%\(([^)]+)\)s").match
+ _interpvar_re = re.compile(r"%\(([^)]+)\)s")
+ _badpercent_re = re.compile(r"%[^%]|%$")
def _interpolate_some(self, option, accum, rest, section, map, depth):
if depth > MAX_INTERPOLATION_DEPTH:
@@ -612,7 +633,7 @@ def _interpolate_some(self, option, accum, rest, section, map, depth):
accum.append("%")
rest = rest[2:]
elif c == "(":
- m = self._interpvar_match(rest)
+ m = self._interpvar_re.match(rest)
if m is None:
raise InterpolationSyntaxError(option, section,
"bad interpolation variable reference %r" % rest)
@@ -637,4 +658,12 @@ def set(self, section, option, value):
"""Set an option. Extend ConfigParser.set: check for string values."""
if not isinstance(value, basestring):
raise TypeError("option values must be strings")
+ # check for bad percent signs:
+ # first, replace all "good" interpolations
+ tmp_value = self._interpvar_re.sub('', value)
+ # then, check if there's a lone percent sign left
+ m = self._badpercent_re.search(tmp_value)
+ if m:
+ raise ValueError("invalid interpolation syntax in %r at "
+ "position %d" % (value, m.start()))
ConfigParser.set(self, section, option, value)
View
6 python/Lib/Cookie.py 100644 → 100755
@@ -408,6 +408,9 @@ class Morsel(dict):
# For historical reasons, these attributes are also reserved:
# expires
#
+ # This is an extension from Microsoft:
+ # httponly
+ #
# This dictionary provides a mapping from the lowercase
# variant on the left to the appropriate traditional
# formatting on the right.
@@ -417,6 +420,7 @@ class Morsel(dict):
"domain" : "Domain",
"max-age" : "Max-Age",
"secure" : "secure",
+ "httponly" : "httponly",
"version" : "Version",
}
@@ -499,6 +503,8 @@ def OutputString(self, attrs=None):
RA("%s=%d" % (self._reserved[K], V))
elif K == "secure":
RA(str(self._reserved[K]))
+ elif K == "httponly":
+ RA(str(self._reserved[K]))
else:
RA("%s=%s" % (self._reserved[K], V))
View
47 python/Lib/DocXMLRPCServer.py 100644 → 100755
@@ -30,7 +30,7 @@ def markup(self, text, escape=None, funcs={}, classes={}, methods={}):
results = []
here = 0
- # XXX Note that this regular expressions does not allow for the
+ # XXX Note that this regular expression does not allow for the
# hyperlinking of arbitrary strings being used as method
# names. Only methods with names consisting of word characters
# and '.'s are hyperlinked.
@@ -52,7 +52,7 @@ def markup(self, text, escape=None, funcs={}, classes={}, methods={}):
url = 'http://www.rfc-editor.org/rfc/rfc%d.txt' % int(rfc)
results.append('<a href="%s">%s</a>' % (url, escape(all)))
elif pep:
- url = 'http://www.python.org/peps/pep-%04d.html' % int(pep)
+ url = 'http://www.python.org/dev/peps/pep-%04d/' % int(pep)
results.append('<a href="%s">%s</a>' % (url, escape(all)))
elif text[end:end+1] == '(':
results.append(self.namelink(name, methods, funcs, classes))
@@ -64,14 +64,15 @@ def markup(self, text, escape=None, funcs={}, classes={}, methods={}):
results.append(escape(text[here:]))
return ''.join(results)
- def docroutine(self, object, name=None, mod=None,
+ def docroutine(self, object, name, mod=None,
funcs={}, classes={}, methods={}, cl=None):
"""Produce HTML documentation for a function or method object."""
anchor = (cl and cl.__name__ or '') + '-' + name
note = ''
- title = '<a name="%s"><strong>%s</strong></a>' % (anchor, name)
+ title = '<a name="%s"><strong>%s</strong></a>' % (
+ self.escape(anchor), self.escape(name))
if inspect.ismethod(object):
args, varargs, varkw, defaults = inspect.getargspec(object.im_func)
@@ -113,6 +114,7 @@ def docserver(self, server_name, package_documentation, methods):
fdict[key] = '#-' + key
fdict[value] = fdict[key]
+ server_name = self.escape(server_name)
head = '<big><big><strong>%s</strong></big></big>' % server_name
result = self.heading(head, '#ffffff', '#7799ee')
@@ -121,8 +123,7 @@ def docserver(self, server_name, package_documentation, methods):
result = result + '<p>%s</p>\n' % doc
contents = []
- method_items = methods.items()
- method_items.sort()
+ method_items = sorted(methods.items())
for key, value in method_items:
contents.append(self.docroutine(value, key, funcs=fdict))
result = result + self.bigsection(
@@ -174,7 +175,7 @@ def generate_html_documentation(self):
methods = {}
for method_name in self.system_listMethods():
- if self.funcs.has_key(method_name):
+ if method_name in self.funcs:
method = self.funcs[method_name]
elif self.instance is not None:
method_info = [None, None] # argspec, documentation
@@ -252,8 +253,10 @@ class DocXMLRPCServer( SimpleXMLRPCServer,
"""
def __init__(self, addr, requestHandler=DocXMLRPCRequestHandler,
- logRequests=1):
- SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests)
+ logRequests=1, allow_none=False, encoding=None,
+ bind_and_activate=True):
+ SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests,
+ allow_none, encoding, bind_and_activate)
XMLRPCDocGenerator.__init__(self)
class DocCGIXMLRPCRequestHandler( CGIXMLRPCRequestHandler,
@@ -278,29 +281,3 @@ def handle_get(self):
def __init__(self):
CGIXMLRPCRequestHandler.__init__(self)
XMLRPCDocGenerator.__init__(self)
-
-if __name__ == '__main__':
- def deg_to_rad(deg):
- """deg_to_rad(90) => 1.5707963267948966
-
- Converts an angle in degrees to an angle in radians"""
- import math
- return deg * math.pi / 180
-
- server = DocXMLRPCServer(("localhost", 8000))
-
- server.set_server_title("Math Server")
- server.set_server_name("Math XML-RPC Server")
- server.set_server_documentation("""This server supports various mathematical functions.
-
-You can use it from Python as follows:
-
->>> from xmlrpclib import ServerProxy
->>> s = ServerProxy("http://localhost:8000")
->>> s.deg_to_rad(90.0)
-1.5707963267948966""")
-
- server.register_function(deg_to_rad)
- server.register_introspection_functions()
-
- server.serve_forever()
Oops, something went wrong.

0 comments on commit b2f546b

Please sign in to comment.