Commit Graph

100584 Commits

Author SHA1 Message Date
Victor Stinner 747f48e2e9
bpo-32230: Set sys.warnoptions with -X dev (#4820)
Rather than supporting dev mode directly in the warnings module, this
instead adjusts the initialisation code to add an extra 'default'
entry to sys.warnoptions when dev mode is enabled.

This ensures that dev mode behaves *exactly* as if `-Wdefault` had
been passed on the command line, including in the way it interacts
with `sys.warnoptions`, and with other command line flags like `-bb`.

Fix also bpo-20361: have -b & -bb options take precedence over any
other warnings options.

Patch written by Nick Coghlan, with minor modifications of Victor Stinner.
2017-12-12 22:59:48 +01:00
Serhiy Storchaka b748e3b258
Fix improper use of re.escape() in tests. (#4814) 2017-12-12 19:21:50 +02:00
Serhiy Storchaka 0e069a1597
Fix implementation dependent assertion in test_plistlib. (#4813)
It is failed with an advanced optimizer.
2017-12-12 19:03:08 +02:00
Serhiy Storchaka 4ae06c5337
bpo-32241: Add the const qualifire to declarations of umodifiable strings. (#4748) 2017-12-12 13:55:04 +02:00
Nitish Chandra 5ce0a2a100 bpo-31942: Document optional support of start and stop attributes in Sequence.index method (#4277) 2017-12-12 11:22:30 +01:00
Licht Takeuchi 2001900b0c bpo-32255: Always quote a single empty field when write into a CSV file. (#4769)
This allows to distinguish an empty row from a row consisting of a single empty field.
2017-12-12 11:57:06 +02:00
Chris e0720cd9e4 Fix small typo in tupleobject.h (#4801) 2017-12-12 09:59:30 +02:00
Terry Jan Reedy e570211406
Fix idlelib comment typos reported by Mike on pull request 4803. (#4807) 2017-12-11 22:59:08 -05:00
Łukasz Langa e56975351b
bpo-32227: functools.singledispatch supports registering via type annotations (#4733) 2017-12-11 13:56:31 -08:00
Andrew Svetlov 8874342cf3
bpo-32258: Replace 'yield from' to 'await' in asyncio docs (#4779)
* Replace 'yield from' to 'await' in asyncio docs

* Fix docstrings
2017-12-11 17:35:49 +02:00
Yury Selivanov abae67ebc2
Add asyncio.get_running_loop() function. (#4782) 2017-12-11 10:07:44 -05:00
Yury Selivanov 3e9751819a
bpo-32273: Move asyncio.test_utils to test.test_asyncio (#4785) 2017-12-11 10:04:40 -05:00
Yury Selivanov 9edad3c701
bpo-32272: Remove asyncio.async() function. (#4784) 2017-12-11 10:03:48 -05:00
Sanyam Khurana 1b74f9b77a bpo-22671: Clarify and test default read method implementations (#4568)
Original patch written by Martin Panter, enhanced by Sanyam Khurana.
2017-12-11 14:42:09 +01:00
Victor Stinner 48d4dd974f
bpo-32252: Fix faulthandler_suppress_crash_report() (#4794)
Fix faulthandler_suppress_crash_report() used to prevent core dump files
when testing crashes. getrlimit() returns zero on success.
2017-12-11 13:57:12 +01:00
Yury Selivanov 19d0d54809
bpo-32262: Fix f-string (#4787) 2017-12-10 19:52:53 -05:00
Yury Selivanov 6370f345e1
bpo-32262: Fix codestyle; use f-strings formatting where necessary. (#4775) 2017-12-10 18:36:12 -05:00
Yury Selivanov c4d9df5fd7
Skip test_read_pty_output test on macOS for poll and select. (#4774)
Starting with 10.13.2 the test hangs forever.
2017-12-10 12:40:19 -05:00
Pablo Galindo 77106b2c21 bpo-32114: Updated the documentation for get_event_loop to reflect the policy change (#4510) 2017-12-10 12:34:59 -05:00
Terry Jan Reedy f658641a05
Removed doubled 'bpo-'. (#4777) 2017-12-10 04:02:53 -05:00
Sanyam Khurana 780acc89bc bpo-31506: Improve the error message logic for class instantiation (GH-4740)
The error messages in `object.__new__` and `object.__init__` now aim
to point the user more directly at the name of the class being instantiated
in cases where they *haven't* been overridden (on the assumption that
the actual problem is a missing `__new__` or `__init__` definition in the
class body).

When they *have* been overridden, the errors still report themselves as
coming from object, on the assumption that the problem is with the call
up to the base class in the method implementation, rather than with the
way the constructor is being called.
2017-12-10 10:14:22 +10:00
Benjamin Peterson 60ed130830
byte swap the raw hash secrets (more bpo-32260) (#4773) 2017-12-09 13:11:39 -08:00
Benjamin Peterson 83620773ee
fix my byte-swapping implementation (#4772) 2017-12-09 12:18:56 -08:00
Benjamin Peterson 4e3e156391
bpo-32260: don't byte swap siphash keys (#4771)
Reference siphash takes the keys as a bytes, so it makes sense to byte swap
when reifying the keys as 64-bit integers. However, Python's siphash takes host
integers in to start with.
2017-12-09 11:24:18 -08:00
Benjamin Peterson 42aa93b8ff
closes bpo-31650: PEP 552 (Deterministic pycs) implementation (#4575)
Python now supports checking bytecode cache up-to-dateness with a hash of the
source contents rather than volatile source metadata. See the PEP for details.

While a fairly straightforward idea, quite a lot of code had to be modified due
to the pervasiveness of pyc implementation details in the codebase. Changes in
this commit include:

- The core changes to importlib to understand how to read, validate, and
  regenerate hash-based pycs.

- Support for generating hash-based pycs in py_compile and compileall.

- Modifications to our siphash implementation to support passing a custom
  key. We then expose it to importlib through _imp.

- Updates to all places in the interpreter, standard library, and tests that
  manually generate or parse pyc files to grok the new format.

- Support in the interpreter command line code for long options like
  --check-hash-based-pycs.

- Tests and documentation for all of the above.
2017-12-09 10:26:52 -08:00
Andrew Svetlov 28d8d14013
bpo-32253: Deprecate with statement and bare await for asyncio locks (GH-4764)
* Add test for 'with (yield from lock)'
* Deprecate with statement for asyncio locks
* Document the deprecation
2017-12-09 20:00:05 +02:00
Vinay Sajip a9f8df646a
bpo-32212: Updated logging documentation to make parameter names more consistent with source. (GH-4765) 2017-12-09 11:09:04 +00:00
Andrew Svetlov 5f841b5538
bpo-32193: Convert asyncio to async/await usage (#4753)
* Convert asyncio/tasks.py to async/await

* Convert asyncio/queues.py to async/await

* Convert asyncio/test_utils.py to async/await

* Convert asyncio/base_subprocess.py to async/await

* Convert asyncio/subprocess.py to async/await

* Convert asyncio/streams.py to async/await

* Fix comments

* Convert asyncio/locks.py to async/await

* Convert asyncio.sleep to async def

* Add a comment

* Add missing news

* Convert stubs from AbstrctEventLoop to async functions

* Convert subprocess_shell/subprocess_exec

* Convert connect_read_pipe/connect_write_pip to async/await syntax

* Convert create_datagram_endpoint

* Convert create_unix_server/create_unix_connection

* Get rid of old style coroutines in unix_events.py

* Convert selector_events.py to async/await

* Convert wait_closed and create_connection

* Drop redundant line

* Convert base_events.py

* Code cleanup

* Drop redundant comments

* Fix indentation

* Add explicit tests for compatibility between old and new coroutines

* Convert windows event loop to use async/await

* Fix double awaiting of async function

* Convert asyncio/locks.py

* Improve docstring

* Convert tests to async/await

* Convert more tests

* Convert more tests

* Convert more tests

* Convert tests

* Improve test
2017-12-09 00:23:48 +02:00
Nitish Chandra ede157331b bpo-22589 Changed MIME type of .bmp to "image/bmp" (#4756)
Per rfc7903 this is the standard MIME type for this file format, and appears as such in the IANA MIME registry.
2017-12-08 07:48:44 -05:00
Neil Schemenauer 11cc289490
Fix missing DECREF of mod. (#4749) 2017-12-07 16:24:59 -08:00
Victor Stinner dd431b32f4
PyLong_FromString(): fix Coverity CID 1424951 (#4738)
Explicitly cast digits (Py_ssize_t) to double to fix the following
false-alarm warning from Coverity:

"fsize_z = digits * log_base_BASE[base] + 1;"

CID 1424951: Incorrect expression (UNINTENDED_INTEGER_DIVISION)
Dividing integer expressions "9223372036854775783UL" and "4UL", and
then converting the integer quotient to type "double". Any remainder,
or fractional part of the quotient, is ignored.
2017-12-08 00:06:55 +01:00
Garrett Berg a0374dd34a bpo-32208: update threading.Semaphore docs and add unit test (#4709)
* fix issue32208: update threading.Semaphore docs and add unit test to validate correct behavior

* add test for blocking

* Update threading.rst

* semaphore: remove documentation validation tests and move 'return value' test to BaseSemaphore
2017-12-07 20:04:26 +02:00
xdegaye 961dbe0548
bpo-32199: The getnode() ip getter now uses 'ip link' instead of 'ip link list' (GH-4696) 2017-12-07 12:59:13 +01:00
Pablo Galindo fb77e0d855 Fix hardcoded value in test_os.py (#4744) 2017-12-07 07:55:44 +01:00
Steve Dower 9ab11b3a02
Allows non-critical upload steps to fail (#4742) 2017-12-06 11:33:15 -08:00
Eric V. Smith 24e77f9265
Use raw strings for regex to avoid invalid escape sequences. (GH-4741) 2017-12-06 14:00:34 -05:00
Rob Boehne 9d25bd11ca Modify configure to link with the compiler driver under HP-UX when not using gcc. (#2519) 2017-12-06 09:58:17 -08:00
Stefan Krah bd4ed77f73
bpo-32233: Fix build with --with-system-libmpdec. (#4739) 2017-12-06 18:24:17 +01:00
Victor Stinner 92a3c6f493
bpo-32030: Add _PyImport_Fini2() (#4737)
PyImport_ExtendInittab() now uses PyMem_RawRealloc() rather than
PyMem_Realloc(). PyImport_ExtendInittab() can be called before
Py_Initialize() whereas only the PyMem_Raw allocator is supposed to
be used before Py_Initialize().

Add _PyImport_Fini2() to release the memory allocated by
PyImport_ExtendInittab() at exit. PyImport_ExtendInittab() now forces
the usage of the default raw allocator, to be able to release memory
in _PyImport_Fini2().

Don't export these functions anymore to be C API, only to
Py_BUILD_CORE:

* _PyExc_Fini()
* _PyImport_Fini()
* _PyGC_DumpShutdownStats()
* _PyGC_Fini()
* _PyType_Fini()
* _Py_HashRandomization_Fini()
2017-12-06 18:12:59 +01:00
Sanyam Khurana 1b4587a246 bpo-25910: Fixes redirection from http to https (#4674) 2017-12-06 17:39:33 +01:00
Victor Stinner 6bf992a1ac
bpo-32030: Add pymain_get_global_config() (#4735)
* Py_Main() now starts by reading Py_xxx configuration variables to
  only work on its own private structure, and then later writes back
  the configuration into these variables.
* Replace Py_GETENV() with pymain_get_env_var() which ignores empty
  variables.
* Add _PyCoreConfig.dump_refs
* Add _PyCoreConfig.malloc_stats
* _PyObject_DebugMallocStats() is now responsible to check if debug
  hooks are installed. The function returns 1 if stats were written,
  or 0 if the hooks are disabled. Mark _PyMem_PymallocEnabled() as
  static.
2017-12-06 17:26:10 +01:00
Victor Stinner 672b6baa71
bpo-32030: pass interp to _PyImport_Init() (#4736)
Remove also the initstr variable, unused since the commit
e69f0df45b pushed in 2012: "bpo-13959:
Re-implement imp.find_module() in Lib/imp.py"
2017-12-06 17:25:50 +01:00
Ned Deily a2a25eb037 Bump to 3.7.0a3+ 2017-12-05 21:06:12 -05:00
Ned Deily d86f29e9c9 Python 3.7.0a3
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEDZbfTUEQ5cQ/v7F/LTR+pqplQh0FAlomWNwACgkQLTR+pqpl
 Qh34Aw/+LDgBou5bRTgHXRAyx4vU8gDT97K0Fm604FXTcQLtTMo/3LDVa+7NbROg
 EWIaSxOjObRwZxjTVU1P063QKBDpjzeqK0PE+DYtEfpKVcqm8tADG30jHx9FYnXp
 yalV6/NzzHhcdxdhwrcbbAYnykk7xcUqEAimJ6YLgQYqe5Z1cemprjuPIcDWAagV
 Jw9ARZI9somzoqDRNAT1s72rJ7V/nKFGOcZ0PL+pv65o7essht+v7ReSxLsbyJYC
 ZAAxTiJT6fpyGc6/ZcKJ6xnbxINvlkdfqwELFMM7/+6l5Xwg07pZSEzOdh1Ng1sz
 woBIJkAoCTV4xAiKZ4DW6vxEeRFDnJgSO7Vd2zFKpSa9iLorZBEpNSObP/1gLTUC
 0fah7ddY2ZIHsi6vdAKnD877FoYFlNsSnlYxHxE1dOOB/5LbHd25/4gTjOHvav8n
 Xrd0qZ4SVVNSdqvDIhsf3GHnao9N5wKkcs9YBX/BK8ryRdIyUof3a2vXoOJtsNNt
 poyIhmrnqjRYttDVHefPk+vi/rS3l3kLfj71AKdmfO5Fv7xFXbzcJBU3ax5SBvbp
 w1XoMoTOSJDZt/GdMvC2htsG5PZWw8Bg8RGqBrLyUFEN0rnoIh5ykEH6YuPSusDQ
 fFUuaE1pGETNhrE50YWYYb4MGOE4xakdRV6cT402DhrzexFwuCA=
 =CREY
 -----END PGP SIGNATURE-----

Merge tag 'v3.7.0a3'
2017-12-05 20:57:44 -05:00
Guido van Rossum 5e8cbcc4f2 Add Guido and Ivan as owners for typing.py (#4729) 2017-12-05 16:56:39 -05:00
Eric V. Smith 2582f6f24e
Add dataclasses to CODEOWNERS. (GH-4730) 2017-12-05 15:52:19 -05:00
Victor Stinner 33c377ed9b
bpo-32030: Simplify _PyCoreConfig_INIT macro (#4728)
* Simplify _PyCoreConfig_INIT, _PyMainInterpreterConfig_INIT,
  _PyPathConfig_INIT macros: no need to set fields to 0/NULL, it's
  redundant (the C language sets them to 0/NULL for us).
* Fix typo: pymain_run_statup() => pymain_run_startup()
* Remove a few XXX/TODO
2017-12-05 15:12:41 +01:00
Ned Deily 90a6785f63 Bump to 3.7.0a3 2017-12-05 03:27:19 -05:00
Ned Deily 3f9a728d95 Update NEWS and pydoc topics. 2017-12-05 03:17:33 -05:00
Ned Deily d4d2b56302 Tidy NEWS entry. 2017-12-05 02:45:57 -05:00