Commit graph

21438 commits

Author SHA1 Message Date
Christopher Thorne ac22f6aa98 bpo-33578: Add getstate/setstate for CJK codec (GH-6984)
This implements getstate and setstate for the cjkcodecs multibyte incremental encoders/decoders, primarily to fix issues with seek/tell.

The encoder getstate/setstate is slightly tricky as the "state" is pending bytes + MultibyteCodec_State but only an integer can be returned. The approach I've taken is to encode this data into a long, similar to how .tell() encodes a "cookie_type" as a long.


https://bugs.python.org/issue33578
2018-11-01 03:48:49 -07:00
Xiang Zhang b08746bfdf
bpo-35062: Fix parsing _io.IncrementalNewlineDecoder's *translate* argument. (GH-10217)
_io.IncrementalNewlineDecoder's initializer possibly assigns out-of-range
value to the bitwise struct field.
2018-10-31 19:49:16 +08:00
Serhiy Storchaka 0353b4eaaf
bpo-33138: Change standard error message for non-pickleable and non-copyable types. (GH-6239) 2018-10-31 02:28:07 +02:00
Serhiy Storchaka 3f819ca138
bpo-35110: Fix unintentional spaces around hyphens and dashes. (GH-10231) 2018-10-31 02:26:06 +02:00
Serhiy Storchaka b232df9197
bpo-31680: Add curses.ncurses_version. (GH-4217)
Use curses.ncurses_version for conditionally skipping a test.
2018-10-30 13:22:42 +02:00
Serhiy Storchaka 3e429dcc24
bpo-33237: Improve AttributeError message for partially initialized module. (GH-6398) 2018-10-30 13:19:51 +02:00
Serhiy Storchaka 95b6acf951
bpo-34876: Change the lineno of the AST for decorated function and class. (GH-9731)
It was overridden by the lineno of the first decorator. Now it is
the lineno of 'def' or 'class'.
2018-10-30 13:16:02 +02:00
Serhiy Storchaka c93c58b5d5
bpo-33331: Clean modules in the reversed order in PyImport_Cleanup(). (GH-6565)
Modules imported last are now cleared first at interpreter shutdown.

A newly imported module is moved to the end of sys.modules, behind
modules on which it depends.
2018-10-29 19:30:16 +02:00
Terry Jan Reedy ea9c8bd443
bpo-35097: Add IDLE doc subsection explaining editor windows. (#10206)
Topics include opening, title and status bar, .py* extension, and running.
2018-10-28 20:42:18 -04:00
Petter Strandmark 47d94241a3 bpo-35047, unittest.mock: Better error messages on assert_called_xxx failures (GH-10090)
unittest.mock now includes mock calls in exception messages if
assert_not_called, assert_called_once, or assert_called_once_with
fails.
2018-10-28 21:37:10 +01:00
Terry Jan Reedy 18032632ab
Issue 35093: Document the IDLE document viewer in the IDLE doc. (#10195)
Add a paragraph in "Help and preferences", "Help sources" subsection.
2018-10-28 16:21:18 -04:00
Pablo Galindo 372d705d95
bpo-33234 Improve list() pre-sizing for inputs with known lengths (GH-9846)
The list() constructor isn't taking full advantage of known input
lengths or length hints. This commit makes the constructor
pre-size and not over-allocate when the input size is known (the
input collection implements __len__). One on the main advantages is
that this provides 12% difference in memory savings due to the difference
between overallocating and allocating exactly the input size.

For efficiency purposes and to avoid a performance regression for small
generators and collections, the size of the input object is calculated using
__len__ and not __length_hint__, as the later is considerably slower.
2018-10-28 20:16:26 +00:00
Raymond Hettinger e3685fd5fd
bpo-34160: Preserve user specified order of Element attributes (GH-10163) 2018-10-28 11:18:22 -07:00
Sebastian Rittau c8a8d6b347 bpo-35089: Don't mention typing.io and typing.re (GH-10173)
https://bugs.python.org/issue35089
2018-10-28 16:03:29 +00:00
Terry Jan Reedy 2b555fc1f0
bpo-35088: Update idlelib.help.copy_string docstring (#10164)
We now use git and backporting instead of hg and forward merging.
2018-10-28 01:29:00 -04:00
Terry Jan Reedy db40cb50eb
bpo-35087: Update idlelib help files for the current doc build. (GH-10162)
There is only one trivial change to idle.rst. Nearly all the changes to help.html are the elimination of chapter and section numbers on headers due to changes in the build system. help.py no longer requires header numbering.
2018-10-28 01:21:36 -04:00
jdemeyer aeb1be5868 bpo-34751: improved hash function for tuples (GH-9471) 2018-10-27 20:06:38 -04:00
Steve Dower 53125a53f4
bpo-35067: Remove _distutils_findvs and use vswhere.exe instead. (GH-10095) 2018-10-27 16:48:33 -04:00
Serhiy Storchaka fec35c99aa
bpo-33710: Deprecate l*gettext() and related functions in the gettext module. (GH-10139)
They return encoded bytes and are Python 2 artifacts.
2018-10-27 08:00:41 +03:00
Terry Jan Reedy d9bff4e81b
bpo-35079: Revise difflib.SequenceManager.get_matching_blocks doc (GH-10144)
Specify that blocks are non-overlapping. Change '!=' to '<'.
2018-10-26 23:03:08 -04:00
Stéphane Wirtel 12e696b4f0 bpo-35042: Use the :pep: role where a PEP is specified (#10036) 2018-10-26 15:58:26 -07:00
Quentin Agren 9e14e49f13 bpo-35024: Remove redundant and possibly incorrect verbose message after writing '.pyc' (GH-9998)
Since `SourceFileLoader.set_data()` catches exceptions raised by `_write_atomic()` and logs an informative message consequently, always logging successful outcome in 'SourceLoader.get_code()' seems redundant.  



https://bugs.python.org/issue35024
2018-10-26 11:36:30 -07:00
Andrés Delfino a6dc531063 bpo-34789: make xml.sax.make_parser accept iterables of all types (GH-9576) 2018-10-26 17:56:57 +03:00
Denis Ledoux 10cb3760e8 bpo-35017, socketserver: don't accept request after shutdown (GH-9952)
Prior to this revision, after the shutdown of a `BaseServer`,
the server accepted a last single request
if it was sent between the server socket polling
and the polling timeout.

This can be problematic for instance for a server restart
for which you do not want to interrupt the service,
by not closing the listening socket during the restart.
One request failed because of this behavior.

Note that only one request failed,
following requests were not accepted, as expected.
2018-10-26 15:46:17 +02:00
Victor Stinner a05bef4f5b
bpo-35059, PCbuild: Expand inline funcs in Debug (GH-10094)
Visual Studio solution: Set InlineFunctionExpansion to
OnlyExplicitInline ("/Ob1" option) on all projects (in
pyproject.props) in Debug mode on Win32 and x64 platforms to expand
functions marked as inline.

This change should make Python compiled in Debug mode a little bit
faster on Windows. On Unix, GCC uses -Og optimization level for
./configure --with-pydebug.
2018-10-26 15:10:29 +02:00
Pablo Galindo 7cd2543416
bpo-34890: Make iscoroutinefunction, isgeneratorfunction and isasyncgenfunction work with functools.partial (GH-9903)
inspect.isfunction() processes both inspect.isfunction(func) and
inspect.isfunction(partial(func, arg)) correctly but some other functions in the
inspect module (iscoroutinefunction, isgeneratorfunction and isasyncgenfunction)
lack this functionality. This commits adds a new check in the mentioned functions
in the inspect module so they can work correctly with arbitrarily nested partial
functions.
2018-10-26 12:19:14 +01:00
Stéphane Wirtel e483f02423 bpo-35044, doc: Use the :exc: role for the exceptions (GH-10037) 2018-10-26 12:52:11 +02:00
Max Bélanger 6c83d9f4a7 bpo-35022: unittest.mock.MagicMock now also supports __fspath__ (GH-9960)
The MagicMock class supports many magic methods, but not __fspath__. To ease
testing with modules such as os.path, this function is now supported by default.
2018-10-25 23:48:58 +02:00
Stéphane Wirtel 1770d1c512 bpo-35038: AttributeError: 'frame' object has no attribute 'f_restricted'. (GH-10098)
https://bugs.python.org/issue35038
2018-10-25 14:13:45 -07:00
Tim Graham d03b775781 bpo-31047: Fix ntpath.abspath to trim ending separator (GH-10082)
Regression in b0bf51b322.
2018-10-25 11:26:37 -04:00
madman-bob e25d5fc18e bpo-32321: Add pure Python fallback for functools.reduce (GH-8548) 2018-10-25 16:02:10 +02:00
Victor Stinner 9e00e80e21
bpo-35053: Enhance tracemalloc to trace free lists (GH-10063)
tracemalloc now tries to update the traceback when an object is
reused from a "free list" (optimization for faster object creation,
used by the builtin list type for example).

Changes:

* Add _PyTraceMalloc_NewReference() function which tries to update
  the Python traceback of a Python object.
* _Py_NewReference() now calls _PyTraceMalloc_NewReference().
* Add an unit test.
2018-10-25 13:31:16 +02:00
serge-sans-paille 5ad36f9b21 bpo-28015: Support LTO build with clang (GH-9908)
.o generated by clang in LTO mode actually are LLVM bitcode files, which
leads to a few errors during configure/build step:

- add lto flags to the BASECFLAGS instead of CFLAGS, as CFLAGS are used
  to build autoconf test case, and some are not compatible with clang LTO
  (they assume binary in the .o, not bitcode)
- force llvm-ar instead of ar, as ar is not aware of .o files generated
  by clang -flto
2018-10-25 01:54:22 +02:00
Serhiy Storchaka c46db9232f
bpo-30863: Rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString(). (GH-2599)
They no longer cache the wchar_t* representation of string objects.
2018-10-23 22:58:24 +03:00
Serhiy Storchaka df13df41a2
bpo-34794: Fix a leak in Tkinter. (GH-10025)
Based on the investigation by Xiang Zhang.
2018-10-23 22:40:54 +03:00
Tal Einat 2447773573
bpo-29843: raise AttributeError if given negative _length_ (GH-10029)
Raise ValueError OverflowError in case of a negative
_length_ in a ctypes.Array subclass.  Also raise TypeError
instead of AttributeError for non-integer _length_.


Co-authored-by: Oren Milman <orenmn@gmail.com>
2018-10-22 18:33:10 +03:00
Xtreak 121eb1694c bpo-34081: Fix wrong example link that was linking to distutils (GH-8248) 2018-10-21 16:54:52 +02:00
Serhiy Storchaka 914f9a078f
bpo-34973: Fix crash in bytes constructor. (GH-9841)
Constructing bytes from mutating list could cause a crash.
2018-10-21 15:25:53 +03:00
Sanyam Khurana a323cdcb33 bpo-8525: help() on a type now shows builtin subclasses (GH-5066)
For builtin types with builtin subclasses, help() on the type now shows up
to 4 of the subclasses. This partially replaces the exception hierarchy
information previously displayed in Python 2.7.
2018-10-21 17:22:02 +10:00
Serhiy Storchaka d31e7730cd
bpo-35029: Replace the SyntaxWarning exception with a SyntaxError. (GH-9999)
If SyntaxWarning was raised as an exception, it will be replaced
with a SyntaxError for better error reporting.
2018-10-21 10:09:39 +03:00
Max Bélanger 94451182cc closes bpo-35025: Properly guard the CLOCK_GETTIME et al macros in timemodule.c. (GH-9961)
Guard the `CLOCK_GETTIME` et al macros in `timemodule` based on the availability of the parent functions
2018-10-20 17:07:54 -07:00
Sergey Fedoseev a5259fb05d bpo-34574: Prevent OrderedDict iterators from exhaustion during pickling. (GH-9051) 2018-10-20 08:20:39 +03:00
Ned Deily 8c9fd9c91b
bpo-34909: NEWS entry (GH-9995) 2018-10-20 00:44:21 -04:00
Pablo Galindo d5b4f1b5a0
bpo-34983: Expose symtable.Symbol.is_nonlocal() in the symtable module (GH-9872)
The symbol table was not exposing functionality to query the nonlocal symbols
in a function or to check if a particular symbol is nonlocal.
2018-10-20 01:46:00 +01:00
Alexey Izbyshev 834603112e bpo-32890, os: Use errno instead of GetLastError() in execve() and truncate() (GH-5784)
path_error() uses GetLastError() on Windows, but some os functions
are implemented via CRT APIs which report errors via errno.
This may result in raising OSError with invalid error code (such
as zero).

Introduce posix_path_error() function and use it where appropriate.
2018-10-20 02:28:22 +02:00
Alexey Izbyshev a2670565d8 bpo-32236: open() emits RuntimeWarning if buffering=1 for binary mode (GH-4842)
If buffering=1 is specified for open() in binary mode, it is silently
treated as buffering=-1 (i.e., the default buffer size).
Coupled with the fact that line buffering is always supported in Python 2,
such behavior caused several issues (e.g., bpo-10344, bpo-21332).

Warn that line buffering is not supported if open() is called with
binary mode and buffering=1.
2018-10-20 02:22:31 +02:00
Matthias Bussonnier ded87d804e bpo-33594: Add deprecation info in inspect.py module (GH-7036) 2018-10-20 01:40:45 +02:00
David Herberth 8deab96725 bpo-34070: open() only checks for isatty if buffering < 0 (GH-8187) 2018-10-20 00:32:04 +02:00
Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి) dd13c88b53 bpo-33947: dataclasses no longer can raise RecursionError in repr (GF9916)
The reprlib code was copied here instead of importing reprlib. I'm not sure if we really need to avoid the import, but since I expect dataclasses to be more common that reprlib, it seems wise. Plus, the code is small.
2018-10-19 12:54:50 -04:00
Serhiy Storchaka 6543912c90
bpo-32912: Replace a DeprecationWarning with a SyntaxWarning (GH-9652)
for invalid escape sequences in string and bytes literals.
2018-10-19 17:42:06 +03:00