Commit Graph

42496 Commits

Author SHA1 Message Date
Neil Schemenauer 8837dd092f
bpo-19610: Warn if distutils is provided something other than a list to some fields (#4685)
* Rather than raise TypeError, warn and call list() on the value.

* Fix tests, revise NEWS and whatsnew text.

* Revise documentation, a string is okay as well.

* Ensure 'requires' and 'obsoletes' are real lists.

* Test that requires and obsoletes are turned to lists.
2017-12-04 18:58:12 -08:00
Ivan Levkivskyi 29bc193210 [bpo-28556] Minor fixes for typing module (#4710) 2017-12-04 21:43:58 -05:00
Terry Jan Reedy 2c0c68d927
bpo-30928: update idlelib/NEWS.txt. (#4706) 2017-12-04 17:04:15 -05:00
Eric V. Smith f0db54a0a1
bpo-32214: Implement PEP 557: Data Classes (#4704) 2017-12-04 16:58:55 -05:00
Terry Jan Reedy 1e2fcac497
bpo-32207: Improve tk event exception tracebacks in IDLE. (#4703)
When tk event handling is driven by IDLE's run loop, a confusing
and distracting queue.EMPTY traceback context is no longer added
to tk event exception tracebacks.  The traceback is now the same
as when event handling is driven by user code.  Patch based on
a suggestion by Serhiy Storchaka.
2017-12-04 16:16:18 -05:00
Terry Jan Reedy 21255fc393
bpo-30928: Update idlelib/NEWS.txt to 2017 Dec 3. (#4701)
Patches are in 3.7.0a3 even if this update is not.
2017-12-04 14:48:25 -05:00
Serhiy Storchaka 70d56fb525
bpo-25054, bpo-1647489: Added support of splitting on zerowidth patterns. (#4471)
Also fixed searching patterns that could match an empty string.
2017-12-04 14:29:05 +02:00
Serhiy Storchaka e69fbb6a56
Fix a regression in uuid added in bpo-32107. (#4677)
uuid.get_node() always must return a stable result.
Also added a test for non-reproducibility of _random_getnode().
Original patch by Xavier de Gaye.
2017-12-04 11:51:55 +02:00
R. David Murray 85d5c18c9d
bpo-27240 Rewrite the email header folding algorithm. (#3488)
The original algorithm tried to delegate the folding to the tokens so
that those tokens whose folding rules differed could specify the
differences.  However, this resulted in a lot of duplicated code because
most of the rules were the same.

The new algorithm moves all folding logic into a set of functions
external to the token classes, but puts the information about which
tokens can be folded in which ways on the tokens...with the exception of
mime-parameters, which are a special case (which was not even
implemented in the old folder).

This algorithm can still probably be improved and hopefully simplified
somewhat.

Note that some of the test expectations are changed.  I believe the
changes are toward more desirable and consistent behavior: in general
when (re) folding a line the canonical version of the tokens is
generated, rather than preserving errors or extra whitespace.
2017-12-03 18:51:41 -05:00
Serhiy Storchaka 1fb72d2ad2
bpo-32137: The repr of deeply nested dict now raises a RecursionError (#4570)
instead of crashing due to a stack overflow.

This perhaps will fix similar problems in other extension types.
2017-12-03 22:12:11 +02:00
Nick Coghlan 078f1814f1
bpo-32176: Set CO_NOFREE in the code object constructor (GH-4675)
Previously, CO_NOFREE was set in the compiler, which meant
it could end up being set incorrectly when code objects
were created directly. Setting it in the constructor based
on freevars and cellvars ensures it is always accurate,
regardless of how the code object is defined.
2017-12-03 11:12:20 +10:00
Neil Schemenauer 1eaa1169c5
Add a minimal unit test for Python/frozen.c. (#2995)
If the marshal or bytecode formats get changed, frozen.c needs to
be updated as well.  It can be easy to miss this step and not doing
so can cause test_importlib to crash in mysterious ways.  Add an
explict unit test to make it easier to track down the problem.
2017-12-02 13:54:00 -08:00
John Chen 8f5c28b193 Fix asyncio.streams.FlowControlMixin docstring typo. (#4578) 2017-12-01 14:33:40 +02:00
xdegaye bf2b65e413
bpo-28668: test.support.requires_multiprocessing_queue is removed (GH-4560)
Skip tests with test.support.import_module('multiprocessing.synchronize')
instead when the semaphore implementation is broken or missing.
2017-12-01 08:08:49 +01:00
Serhiy Storchaka 73a7e9b10b bpo-10544: Deprecate "yield" in comprehensions and generator expressions. (GH-4579)
The current behaviour of yield expressions inside comprehensions  and
generator expressions is essentially an accident of implementation - it
arises implicitly from the way the compiler handles yield expressions inside
nested functions and generators.

Since the current behaviour wasn't deliberately designed, and is inherently
confusing, we're deprecating it, with no current plans to reintroduce it.
Instead, our advice will be to use a named nested generator definition
for cases where this behaviour is desired.
2017-12-01 14:54:17 +10:00
Serhiy Storchaka a897aeeef6
bpo-32072: Fix issues with binary plists. (#4455)
* Fixed saving bytearrays.
* Identical objects will be saved only once.
* Equal references will be load as identical objects.
* Added support for saving and loading recursive data structures.
2017-11-30 23:26:11 +02:00
Victor Stinner b4d1e1f7c1
bpo-20891: Fix PyGILState_Ensure() (#4650)
When PyGILState_Ensure() is called in a non-Python thread before
PyEval_InitThreads(), only call PyEval_InitThreads() after calling
PyThreadState_New() to fix a crash.

Add an unit test in test_embed.
2017-11-30 22:05:00 +01:00
Serhiy Storchaka 986375ebde
bpo-28416: Break reference cycles in Pickler and Unpickler subclasses (#4080)
with the persistent_id() and persistent_load() methods.
2017-11-30 22:48:31 +02:00
Victor Stinner 86afc1f2a7
Skip test_socket.test_sha256() on linux < 4.5 (#4643)
bpo-31705.
2017-11-30 13:58:43 +01:00
Victor Stinner 5e3806f8cf
bpo-32101: Add PYTHONDEVMODE environment variable (#4624)
* bpo-32101: Add sys.flags.dev_mode flag
  Rename also the "Developer mode" to the "Development mode".
* bpo-32101: Add PYTHONDEVMODE environment variable
  Mention it in the development chapiter.
2017-11-30 11:40:24 +01:00
Jesse-Bakker 706e10b186 bpo-32121: Add most_recent_first parameter to tracemalloc.Traceback.format (#4534)
* Add most_recent_first parameter to tracemalloc.Traceback.format to allow
   reversing the order of the frames in the output
* Reversed default sorting of tracemalloc.Traceback frames
* Allowed negative limit, truncating from the other side.
2017-11-30 00:05:07 +01:00
Andrew Svetlov cc83920ad2
bpo-32166: Drop Python 3.4 code from asyncio (#4612)
* Drop Python 3.4 code from asyncio

* Fix notes

* Add missing imports

* Restore comment

* Resort imports

* Drop Python 3.4-3.5 specific code

* Drop redunant check

* Fix tests

* Restore _COROUTINE_TYPES order

* Remove useless code
2017-11-29 18:23:43 +02:00
Victor Stinner 5d39e04290
bpo-32030: Rework memory allocators (#4625)
* Fix _PyMem_SetupAllocators("debug"): always restore allocators to
  the defaults, rather than only caling _PyMem_SetupDebugHooks().
* Add _PyMem_SetDefaultAllocator() helper to set the "default"
  allocator.
* Add _PyMem_GetAllocatorsName(): get the name of the allocators
* main() now uses debug hooks on memory allocators if Py_DEBUG is
  defined, rather than calling directly malloc()
* Document default memory allocators in C API documentation
* _Py_InitializeCore() now fails with a fatal user error if
  PYTHONMALLOC value is an unknown memory allocator, instead of
  failing with a fatal internal error.
* Add new tests on the PYTHONMALLOC environment variable
* Add support.with_pymalloc()
* Add the _testcapi.WITH_PYMALLOC constant and expose it as
   support.with_pymalloc().
* sysconfig.get_config_var('WITH_PYMALLOC') doesn't work on Windows, so
   replace it with support.with_pymalloc().
* pythoninfo: add _testcapi collector for pymem
2017-11-29 17:20:38 +01:00
Victor Stinner c15bb49d71
test_socket: socket.socketpair() is always available (#4634) 2017-11-29 16:33:53 +01:00
xdegaye ef83806f5e
bpo-32138: Skip on Android test_faulthandler tests that raise SIGSEGV (GH-4604)
Remove the test.support.requires_android_level decorator.
2017-11-29 11:43:23 +01:00
xdegaye cc55e78aca
bpo-32139: test_strftime does not anymore modify the locale (GH-4569) 2017-11-29 11:36:48 +01:00
Terry Jan Reedy 041efd292e
bpo-32164: Delete unused file idlelib/tabbedpages.py (#4628) 2017-11-29 00:08:28 -05:00
Terry Jan Reedy e8f7c78a86
bpo-30781: Remove unused imports in idlelib.configdialog. (#4627) 2017-11-28 21:52:32 -05:00
Terry Jan Reedy fd6f8c56b9
bpo-32100: Delete unneeded import in idlelib.pathbrowser. (#4626) 2017-11-28 21:50:21 -05:00
Serhiy Storchaka 219c2de5ad
bpo-32110: codecs.StreamReader.read(n) now returns not more than n (#4499)
characters/bytes for non-negative n.  This makes it compatible with
read() methods of other file-like objects.
2017-11-29 01:30:00 +02:00
Barry Warsaw 23df2d1304
bpo-32107 - Improve MAC address calculation and fix test_uuid.py (#4600)
``uuid.getnode()`` now preferentially returns universally administered MAC addresses if available, over locally administered MAC addresses.  This makes a better guarantee for global uniqueness of UUIDs returned from ``uuid.uuid1()``.  If only locally administered MAC addresses are available, the first such one found is returned.

Also improve internal code style by being explicit about ``return None`` rather than falling off the end of the function.

Improve the test robustness.
2017-11-28 17:26:04 -05:00
Victor Stinner 71bd588646
bpo-32155: Revert distutils.config change (#4618)
Revert distutils changes of the commit
696b501cd1 and remove the realm
variable.
2017-11-28 23:19:26 +01:00
Victor Stinner fe2d5babba
bpo-32159: Remove tools for CVS and Subversion (#4615)
CPython migrated from CVS to Subversion, to Mercurial, and then to
Git. CVS and Subversion are not more used to develop CPython.

* platform module: drop support for sys.subversion. The
  sys.subversion attribute has been removed in Python 3.3.
* Remove Misc/svnmap.txt
* Remove Tools/scripts/svneol.py
* Remove Tools/scripts/treesync.py
2017-11-28 22:29:32 +01:00
Serhiy Storchaka a4a3020abc
bpo-32157: Removed explicit quotes around %r and {!r}. (#4582) 2017-11-28 22:54:42 +02:00
Victor Stinner ac577d7d0b
bpo-32154: Remove asyncio.windows_utils.socketpair (#4609) 2017-11-28 21:33:20 +01:00
Jonas Haag 4d193bcc25 bpo-32071: Fix regression and add What's New entry (#4589)
* bpo-32071: Fix an undocumented behaviour regression

* bpo-32071: Add 3.7 release note entry for unittest -k
2017-11-28 20:40:44 +01:00
Dong-hee Na a489599793 bpo-32046: Update 2to3 when converts operator.isCallable(obj). (#4417) 2017-11-28 11:26:56 -05:00
Victor Stinner 696b501cd1
bpo-32155: Bugfixes found by flake8 F841 warnings (#4608)
* distutils.config: Use the PyPIRCCommand.realm attribute if set
* turtledemo: wait until macOS osascript command completes to not
  create a zombie process
* Tools/scripts/treesync.py: declare 'default_answer' and
  'create_files' as globals to modify them with the command line
  arguments. Previously, -y, -n, -f and -a options had no effect.

flake8 warning: "F841 local variable 'p' is assigned to but never
used".
2017-11-28 15:30:32 +01:00
Victor Stinner 4271dfd781
bpo-32154: Remove asyncio.selectors (#4605)
* Remove asyncio.selectors and asyncio._overlapped symbols from the
  namespace of the asyncio module
* Replace "from asyncio import selectors" with "import selectors"
* Replace "from asyncio import _overlapped" with "import _overlapped"

asyncio.selectors was added to support Python 3.3, which doesn't have
selectors in its standard library, and Python 3.4 in the same code
base. Same rationale for asyncio._overlapped. Python 3.3 reached its
end of life, and asyncio is no more maintained as a third party
module on PyPI.
2017-11-28 15:19:56 +01:00
Victor Stinner 3f438a9fa0
asyncio: Remove asyncio/compat.py (#4606)
The asyncio/compat.py file was written to support Python < 3.5 and
Python < 3.5.2. But Python 3.5 doesn't accept bugfixes anymore, only
security fixes. There is no more need to backport bugfixes to Python
3.5, and so no need to have a single code base for Python 3.5, 3.6
and 3.7.

Say hello (again) to "async" and "await", who became real keywords in
Python 3.7 ;-)
2017-11-28 14:43:52 +01:00
Victor Stinner a10dc3efcb
asyncio: use directly socket.socketpair() (#4597)
Since Python 3.5, socket.socketpair() is also available on Windows,
and so can be used directly, rather than using
asyncio.windows_utils.socketpair().
2017-11-28 11:15:26 +01:00
Victor Stinner 92f9339a58
asyncio: Fix BaseSelectorEventLoopTests (#4595)
Currently, two tests fail with PYTHONASYNCIODEBUG=1 (or using -X
dev).
2017-11-28 00:35:55 +01:00
Victor Stinner c16bacec3c
asyncio: Remove unused Future._tb_logger attribute (#4596)
It was only used on Python 3.3, now only Future._log_traceback is
used.
2017-11-28 00:35:33 +01:00
Victor Stinner 28e61650b2
bpo-31245: asyncio: Fix typo, isistance => isinstance (#4594) 2017-11-28 00:34:08 +01:00
Victor Stinner c9409f7c45
Revert "bpo-32107 - Better merge of #4494 (#4576)" (#4593)
This reverts commit 9522a218f7.
2017-11-28 00:30:21 +01:00
Nick Coghlan 39f0bb5ad0
bpo-32136: Separate embedding tests from C API tests (GH-4567)
Some parts of the C API are only relevant to larger
applications embedding CPython as a runtime engine.

The helpers to test those APIs are already separated
out into Programs/_testembed.c, this update moves
the associated test cases out into their own dedicated
test file.
2017-11-28 08:11:51 +10:00
Barry Warsaw 9522a218f7
bpo-32107 - Better merge of #4494 (#4576)
Improve UUID1 MAC address calculation and related tests.

There are two bits in the MAC address that are relevant to UUID1.  The first is the locally administered vs. universally administered bit (second least significant of the first octet).   Physical network interfaces such as ethernet ports and wireless adapters will always be universally administered, but some interfaces --such as the interface that MacBook Pros communicate with their Touch Bars-- are locally administered.  The former are guaranteed to be globally unique, while the latter are demonstrably *not* globally unique and are in fact the same on every MBP with a Touch Bar.  With this bit is set, the MAC is locally administered; with it unset it is universally administered.

The other bit is the multicast bit (least significant bit of the first octet).  When no other MAC address can be found, RFC 4122 mandates that a random 48-bit number be generated.  This randomly generated number *must* have the multicast bit set.

The improvements in uuid.py include:

* Preferentially return a universally administered MAC address, falling back to a locally administered address if none of the former can be found.
* Improve several coding style issues, such as adding explicit returns of None, using a more readable bitmask pattern, and assuming that the ultimate fallback, random MAC generation will not fail (and propagating any exception there instead of swallowing them).

Improvements in test_uuid.py include:

* Always testing the calculated MAC for universal administration, unless explicitly disabled (i.e. for the random case), or implicitly disabled due to running in the Travis environment.  Travis test machines have *no* universally administered MAC address at the time of this writing.
2017-11-27 14:40:10 -05:00
Victor Stinner c9758784eb
bpo-27535: Fix memory leak with warnings ignore (#4489)
The warnings module doesn't leak memory anymore in the hidden
warnings registry for the "ignore" action of warnings filters.

The warn_explicit() function doesn't add the warning key to the
registry anymore for the "ignore" action.
2017-11-27 16:57:07 +01:00
Victor Stinner 21c7730761
bpo-32089: Use default action for ResourceWarning (#4584)
In development and debug mode, use the "default" action, rather than
the "always" action, for ResourceWarning in the default warnings
filters.
2017-11-27 12:11:55 +01:00
Mandeep Singh ede2ac913e bpo-23033: Improve SSL Certificate handling (GH-937)
Wildcard is now supported in hostname when it is one and only character in
the leftmost segment.
2017-11-26 14:31:27 -08:00