diff options
-rw-r--r-- | .bzrignore | 18 | ||||
-rw-r--r-- | .hgignore | 18 | ||||
-rw-r--r-- | Doc/c-api/import.rst | 4 | ||||
-rw-r--r-- | Doc/library/array.rst | 7 | ||||
-rw-r--r-- | Doc/library/imp.rst | 21 | ||||
-rw-r--r-- | Doc/library/locale.rst | 255 | ||||
-rw-r--r-- | Lib/subprocess.py | 4 | ||||
-rw-r--r-- | Lib/test/support.py | 9 | ||||
-rw-r--r-- | Makefile.pre.in | 1 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
10 files changed, 148 insertions, 192 deletions
@@ -14,24 +14,7 @@ platform pyconfig.h libpython*.a python.exe -CP936.TXT -SHIFT_JISX0213.TXT -JOHAB.TXT -EUC-JP.TXT -NormalizationTest-3.2.0.txt -NormalizationTest.txt -BIG5.TXT -BIG5HKSCS-2004.TXT -CP949.TXT -EUC-CN.TXT -BIG5HKSCS.TXT -SHIFTJIS.TXT -EUC-KR.TXT -EUC-JISX0213.TXT -CP932.TXT -CP950.TXT reflog.txt -gb-18030-2000.xml tags TAGS .gdb_history @@ -45,5 +28,6 @@ Modules/Setup.config Modules/Setup.local Modules/config.c Parser/pgen +Lib/test/data/* Lib/lib2to3/Grammar*.pickle Lib/lib2to3/PatternGrammar*.pickle @@ -1,24 +1,8 @@ .gdb_history .purify .svn -BIG5.TXT -BIG5HKSCS-2004.TXT -BIG5HKSCS.TXT -CP932.TXT -CP936.TXT -CP949.TXT -CP950.TXT -EUC-CN.TXT -EUC-JISX0213.TXT -EUC-JP.TXT -EUC-KR.TXT -JOHAB.TXT Makefile Makefile.pre -NormalizationTest-3.2.0.txt -NormalizationTest.txt -SHIFTJIS.TXT -SHIFT_JISX0213.TXT TAGS autom4te.cache build @@ -28,7 +12,6 @@ config.log config.status config.status.lineno db_home -gb-18030-2000.xml platform pyconfig.h python @@ -59,6 +42,7 @@ libpython*.a *.rej *~ Lib/lib2to3/*.pickle +Lib/test/data/* PCbuild/*.exe PCbuild/*.dll PCbuild/*.pdb diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst index ac4cde5..2bf4079 100644 --- a/Doc/c-api/import.rst +++ b/Doc/c-api/import.rst @@ -25,6 +25,8 @@ Importing Modules imported module, or *NULL* with an exception set on failure. A failing import of a module doesn't leave the module in :data:`sys.modules`. + This function always uses absolute imports. + .. cfunction:: PyObject* PyImport_ImportModuleNoBlock(const char *name) @@ -75,6 +77,8 @@ Importing Modules current globals. This means that the import is done using whatever import hooks are installed in the current environment. + This function always uses absolute imports. + .. cfunction:: PyObject* PyImport_ReloadModule(PyObject *m) diff --git a/Doc/library/array.rst b/Doc/library/array.rst index 78c433d..2235f08 100644 --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -52,9 +52,9 @@ through the :attr:`itemsize` attribute. The module defines the following type: -.. function:: array(typecode[, initializer]) +.. class:: array(typecode[, initializer]) - Return a new array whose items are restricted by *typecode*, and initialized + A new array whose items are restricted by *typecode*, and initialized from the optional *initializer* value, which must be a list, object supporting the buffer interface, or iterable over elements of the appropriate type. @@ -67,7 +67,7 @@ The module defines the following type: .. data:: ArrayType - Obsolete alias for :func:`array`. + Obsolete alias for :class:`array`. .. data:: typecodes @@ -81,7 +81,6 @@ and may be used wherever buffer objects are supported. The following data items and methods are also supported: - .. attribute:: array.typecode The typecode character used to create the array. diff --git a/Doc/library/imp.rst b/Doc/library/imp.rst index 06cfefc..68cda84 100644 --- a/Doc/library/imp.rst +++ b/Doc/library/imp.rst @@ -33,16 +33,17 @@ This module provides an interface to the mechanisms used to implement the .. function:: find_module(name[, path]) - Try to find the module *name* on the search path *path*. If *path* is a list - of directory names, each directory is searched for files with any of the - suffixes returned by :func:`get_suffixes` above. Invalid names in the list - are silently ignored (but all list items must be strings). If *path* is - omitted or ``None``, the list of directory names given by ``sys.path`` is - searched, but first it searches a few special places: it tries to find a - built-in module with the given name (:const:`C_BUILTIN`), then a frozen - module (:const:`PY_FROZEN`), and on some systems some other places are looked - in as well (on Windows, it looks in the registry which may point to a - specific file). + Try to find the module *name*. If *path* is omitted or ``None``, the list of + directory names given by ``sys.path`` is searched, but first a few special + places are searched: the function tries to find a built-in module with the + given name (:const:`C_BUILTIN`), then a frozen module (:const:`PY_FROZEN`), + and on some systems some other places are looked in as well (on Windows, it + looks in the registry which may point to a specific file). + + Otherwise, *path* must be a list of directory names; each directory is + searched for files with any of the suffixes returned by :func:`get_suffixes` + above. Invalid names in the list are silently ignored (but all list items + must be strings). If search is successful, the return value is a 3-element tuple ``(file, pathname, description)``: diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst index 163a383..9e2cab6 100644 --- a/Doc/library/locale.rst +++ b/Doc/library/locale.rst @@ -144,13 +144,127 @@ The :mod:`locale` module defines the following exception and functions: .. function:: nl_langinfo(option) - Return some locale-specific information as a string. This function is not - available on all systems, and the set of possible options might also vary across - platforms. The possible argument values are numbers, for which symbolic - constants are available in the locale module. + Return some locale-specific information as a string. This function is not + available on all systems, and the set of possible options might also vary + across platforms. The possible argument values are numbers, for which + symbolic constants are available in the locale module. + The :func:`nl_langinfo` function accepts one of the following keys. Most + descriptions are taken from the corresponding description in the GNU C + library. -.. function:: getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')) + .. data:: CODESET + + Get a string with the name of the character encoding used in the + selected locale. + + .. data:: D_T_FMT + + Get a string that can be used as a format string for :func:`strftime` to + represent time and date in a locale-specific way. + + .. data:: D_FMT + + Get a string that can be used as a format string for :func:`strftime` to + represent a date in a locale-specific way. + + .. data:: T_FMT + + Get a string that can be used as a format string for :func:`strftime` to + represent a time in a locale-specific way. + + .. data:: T_FMT_AMPM + + Get a format string for :func:`strftime` to represent time in the am/pm + format. + + .. data:: DAY_1 ... DAY_7 + + Get the name of the n-th day of the week. + + .. note:: + + This follows the US convention of :const:`DAY_1` being Sunday, not the + international convention (ISO 8601) that Monday is the first day of the + week. + + .. data:: ABDAY_1 ... ABDAY_7 + + Get the abbreviated name of the n-th day of the week. + + .. data:: MON_1 ... MON_12 + + Get the name of the n-th month. + + .. data:: ABMON_1 ... ABMON_12 + + Get the abbreviated name of the n-th month. + + .. data:: RADIXCHAR + + Get the radix character (decimal dot, decimal comma, etc.) + + .. data:: THOUSEP + + Get the separator character for thousands (groups of three digits). + + .. data:: YESEXPR + + Get a regular expression that can be used with the regex function to + recognize a positive response to a yes/no question. + + .. note:: + + The expression is in the syntax suitable for the :cfunc:`regex` function + from the C library, which might differ from the syntax used in :mod:`re`. + + .. data:: NOEXPR + + Get a regular expression that can be used with the regex(3) function to + recognize a negative response to a yes/no question. + + .. data:: CRNCYSTR + + Get the currency symbol, preceded by "-" if the symbol should appear before + the value, "+" if the symbol should appear after the value, or "." if the + symbol should replace the radix character. + + .. data:: ERA + + Get a string that represents the era used in the current locale. + + Most locales do not define this value. An example of a locale which does + define this value is the Japanese one. In Japan, the traditional + representation of dates includes the name of the era corresponding to the + then-emperor's reign. + + Normally it should not be necessary to use this value directly. Specifying + the ``E`` modifier in their format strings causes the :func:`strftime` + function to use this information. The format of the returned string is not + specified, and therefore you should not assume knowledge of it on different + systems. + + .. data:: ERA_YEAR + + Get the year in the relevant era of the locale. + + .. data:: ERA_D_T_FMT + + Get a format string for :func:`strftime` to represent dates and times in a + locale-specific era-based way. + + .. data:: ERA_D_FMT + + Get a format string for :func:`strftime` to represent time in a + locale-specific era-based way. + + .. data:: ALT_DIGITS + + Get a representation of up to 100 values used to represent the values + 0 to 99. + + +.. function:: getdefaultlocale([envvars]) Tries to determine the default locale settings and returns them as a tuple of the form ``(language code, encoding)``. @@ -338,140 +452,13 @@ The :mod:`locale` module defines the following exception and functions: This is a symbolic constant used for different values returned by :func:`localeconv`. -The :func:`nl_langinfo` function accepts one of the following keys. Most -descriptions are taken from the corresponding description in the GNU C library. - - -.. data:: CODESET - - Return a string with the name of the character encoding used in the selected - locale. - - -.. data:: D_T_FMT - - Return a string that can be used as a format string for strftime(3) to represent - time and date in a locale-specific way. - - -.. data:: D_FMT - - Return a string that can be used as a format string for strftime(3) to represent - a date in a locale-specific way. - - -.. data:: T_FMT - - Return a string that can be used as a format string for strftime(3) to represent - a time in a locale-specific way. - - -.. data:: T_FMT_AMPM - - The return value can be used as a format string for 'strftime' to represent time - in the am/pm format. - - -.. data:: DAY_1 ... DAY_7 - - Return name of the n-th day of the week. - - .. note:: - - This follows the US convention of :const:`DAY_1` being Sunday, not the - international convention (ISO 8601) that Monday is the first day of the week. - - -.. data:: ABDAY_1 ... ABDAY_7 - - Return abbreviated name of the n-th day of the week. - - -.. data:: MON_1 ... MON_12 - - Return name of the n-th month. - - -.. data:: ABMON_1 ... ABMON_12 - - Return abbreviated name of the n-th month. - - -.. data:: RADIXCHAR - - Return radix character (decimal dot, decimal comma, etc.) - - -.. data:: THOUSEP - - Return separator character for thousands (groups of three digits). - - -.. data:: YESEXPR - - Return a regular expression that can be used with the regex function to - recognize a positive response to a yes/no question. - - .. note:: - - The expression is in the syntax suitable for the :cfunc:`regex` function from - the C library, which might differ from the syntax used in :mod:`re`. - - -.. data:: NOEXPR - - Return a regular expression that can be used with the regex(3) function to - recognize a negative response to a yes/no question. - - -.. data:: CRNCYSTR - - Return the currency symbol, preceded by "-" if the symbol should appear before - the value, "+" if the symbol should appear after the value, or "." if the symbol - should replace the radix character. - - -.. data:: ERA - - The return value represents the era used in the current locale. - - Most locales do not define this value. An example of a locale which does define - this value is the Japanese one. In Japan, the traditional representation of - dates includes the name of the era corresponding to the then-emperor's reign. - - Normally it should not be necessary to use this value directly. Specifying the - ``E`` modifier in their format strings causes the :func:`strftime` function to - use this information. The format of the returned string is not specified, and - therefore you should not assume knowledge of it on different systems. - - -.. data:: ERA_YEAR - - The return value gives the year in the relevant era of the locale. - - -.. data:: ERA_D_T_FMT - - This return value can be used as a format string for :func:`strftime` to - represent dates and times in a locale-specific era-based way. - - -.. data:: ERA_D_FMT - - This return value can be used as a format string for :func:`strftime` to - represent time in a locale-specific era-based way. - - -.. data:: ALT_DIGITS - - The return value is a representation of up to 100 values used to represent the - values 0 to 99. Example:: >>> import locale >>> loc = locale.getlocale() # get current locale - >>> locale.setlocale(locale.LC_ALL, 'de_DE') # use German locale; name might vary with platform + # use German locale; name might vary with platform + >>> locale.setlocale(locale.LC_ALL, 'de_DE') >>> locale.strcoll('f\xe4n', 'foo') # compare a string containing an umlaut >>> locale.setlocale(locale.LC_ALL, '') # use user's preferred locale >>> locale.setlocale(locale.LC_ALL, 'C') # use default (C) locale diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 2e7864c..06454f3 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -724,7 +724,7 @@ class Popen(object): # Windows methods # def _get_handles(self, stdin, stdout, stderr): - """Construct and return tupel with IO objects: + """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: @@ -959,7 +959,7 @@ class Popen(object): # POSIX methods # def _get_handles(self, stdin, stdout, stderr): - """Construct and return tupel with IO objects: + """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ p2cread, p2cwrite = None, None diff --git a/Lib/test/support.py b/Lib/test/support.py index f24adc8..e11fbae 100644 --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -453,13 +453,12 @@ def open_urlresource(url, *args, **kw): requires('urlfetch') filename = urllib.parse.urlparse(url)[2].split('/')[-1] # '/': it's URL! - for path in [os.path.curdir, os.path.pardir]: - fn = os.path.join(path, filename) - if os.path.exists(fn): - return open(fn, *args, **kw) + fn = os.path.join(os.path.dirname(__file__), "data", filename) + if os.path.exists(fn): + return open(fn) print('\tfetching %s ...' % url, file=get_original_stdout()) - fn, _ = urllib.request.urlretrieve(url, filename) + fn, _ = urllib.request.urlretrieve(url, fn) return open(fn, *args, **kw) diff --git a/Makefile.pre.in b/Makefile.pre.in index 9b51a0b..7ec5e12 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1181,6 +1181,7 @@ clobber: clean profile-removal # remove all generated files, even Makefile[.pre] # Keep configure and Python-ast.[ch], it's possible they can't be generated distclean: clobber + -rm -f Lib/test/data/* -rm -f core Makefile Makefile.pre config.status \ Modules/Setup Modules/Setup.local Modules/Setup.config find $(srcdir) '(' -name '*.fdc' -o -name '*~' \ @@ -915,9 +915,6 @@ Library - Issue #2622: Fixed an ImportError when importing email.messsage from a standalone application built with py2exe or py2app. -- Issue #6459: distutils.command.build_ext.get_export_symbols now uses the - "PyInit" prefix, rather than "init". - - Issue #6455: Fixed test_build_ext under win32. - Issue #6377: Enabled the compiler option, and deprecate its usage as an |