Commit Graph

21350 Commits

Author SHA1 Message Date
Zackery Spytz ae62f01524 bpo-34910: Ensure that PyObject_Print() always returns -1 on error. (GH-9733) 2018-10-06 09:44:25 +03:00
E. M. Bray 7a7693e9cb bpo-28441: Ensure `.exe` suffix in `sys.executable` on MinGW and Cygwin (GH-4348)
This is needed to even the run the test suite on buildbots for affected platforms; e.g.:

```
./python.exe  ./Tools/scripts/run_tests.py -j 1 -u all -W --slowest --fail-env-changed --timeout=11700 -j2
/home/embray/src/python/test-worker/3.x.test-worker/build/python -u -W default -bb -E -W error::BytesWarning -m test -r -w -j 1 -u all -W --slowest --fail-env-changed --timeout=11700 -j2
Traceback (most recent call last):
  File "./Tools/scripts/run_tests.py", line 56, in <module>
    main(sys.argv[1:])
  File "./Tools/scripts/run_tests.py", line 52, in main
    os.execv(sys.executable, args)
PermissionError: [Errno 13] Permission denied
make: *** [Makefile:1073: buildbottest] Error 1
```
2018-10-05 20:38:50 +09:00
INADA Naoki 6f85b826b5 bpo-34871: inspect: Don't pollute sys.modules (GH-9696)
https://bugs.python.org/issue34871
2018-10-04 09:47:09 -07:00
Elvis Pranskevichus 0c797a6aca bpo-34872: Fix self-cancellation in C implementation of asyncio.Task (GH-9679)
The C implementation of asyncio.Task currently fails to perform the
cancellation cleanup correctly in the following scenario.

    async def task1():
        async def task2():
            await task3     # task3 is never cancelled

        asyncio.current_task().cancel()
        await asyncio.create_task(task2())

The actuall error is a hardcoded call to `future_cancel()` instead of
calling the `cancel()` method of a future-like object.

Thanks to Vladimir Matveev for noticing the code discrepancy and to
Yury Selivanov for coming up with a pathological scenario.
2018-10-03 10:30:31 -04:00
Zackery Spytz 96c5932794 bpo-34879: Fix a possible null pointer dereference in bytesobject.c (GH-9683)
formatfloat() was not checking if PyBytes_FromStringAndSize()
failed, which could lead to a null pointer dereference in
_PyBytes_FormatEx().
2018-10-03 09:01:30 +03:00
tzickel 97bfe8d3eb bpo-34172: multiprocessing.Pool leaks resources after being deleted (GH-8450)
Fix a reference issue inside multiprocessing.Pool that caused the pool to remain alive if it was deleted without being closed or terminated explicitly.
2018-10-02 23:01:23 +02:00
Victor Stinner e972c13624
bpo-30156: Remove property_descr_get() optimization (GH-9541)
property_descr_get() uses a "cached" tuple to optimize function
calls. But this tuple can be discovered in debug mode with
sys.getobjects(). Remove the optimization, it's not really worth it
and it causes 3 different crashes last years.

Microbenchmark:

./python -m perf timeit -v \
    -s "from collections import namedtuple; P = namedtuple('P', 'x y'); p = P(1, 2)" \
    --duplicate 1024 "p.x"

Result:

Mean +- std dev: [ref] 32.8 ns +- 0.8 ns -> [patch] 40.4 ns +- 1.3 ns: 1.23x slower (+23%)
2018-10-01 03:03:22 -07:00
Serhiy Storchaka 2a2940e5c3
bpo-34854: Fix compiling string annotations containing lambdas. (GH-9645)
* Compiling a string annotation containing a lambda with keyword-only
argument without default value caused a crash.

* Remove the final "*" (it is incorrect syntax) in the representation of
lambda without *args and keyword-only arguments when compile from AST.

* Improve the representation of lambda without arguments.
2018-09-30 21:07:05 +03:00
Andrew Svetlov d5bd036138 bpo-34849: Don't log wating for selector.select in asyncio loop iteration (GH-9641)
The waiting is pretty normal for any asyncio program, logging its time just adds
a noise to logs without any useful information provided.



https://bugs.python.org/issue34849
2018-09-29 22:28:40 -07:00
Zsolt Cserna 9df346bf98 bpo-34248: Add filename to error raised in {gnu,ndbm}.open() (GH-8590)
Report the filename to the exception when raising {gdbm,dbm.ndbm}.error in
dbm.gnu.open() and dbm.ndbm.open() functions, so it gets printed when the
exception is raised, and can also be obtained by the filename attribute of the
exception object.
2018-09-27 22:54:34 +03:00
Serhiy Storchaka 3f22811fef
bpo-32892: Use ast.Constant instead of specific constant AST types. (GH-9445) 2018-09-27 17:42:37 +03:00
orlnub123 a94ee12c26 bpo-34819: Use a monotonic clock to compute timeouts in concurrent.futures (GH-9599)
Use a monotonic clock to compute timeouts in :meth:`Executor.map` and :func:`as_completed`, in order to prevent timeouts from deviating when the system clock is adjusted.

This may not be sufficient on all systems. On POSIX for example, the actual waiting (e.g. in ``sem_timedwait``) is specified to rely on the CLOCK_REALTIME clock.
2018-09-27 13:16:26 +02:00
Tal Einat f55c64c632
bpo-31425: fix versionadded in docs and add attribution in NEWS (GH-9595) 2018-09-27 00:20:38 +03:00
Bjorn Andersson bb8165172a bpo-31425: Expose AF_QIPCRTR in socket module (GH-3706)
The AF_QIPCRTR address family was introduced in Linux v4.7.

Co-authored-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-09-26 16:47:52 +03:00
INADA Naoki 2aaf98c16a bpo-34320: Fix dict(o) didn't copy order of dict subclass (GH-8624)
When dict subclass overrides order (`__iter__()`, `keys()`, and `items()`), `dict(o)`
should use it instead of dict ordering.


https://bugs.python.org/issue34320
2018-09-25 20:59:00 -07:00
Cheryl Sabella d345bb4d9b bpo-34334: Don't log traceback twice in QueueHandler (GH-9537) 2018-09-26 00:00:08 +01:00
Zackery Spytz 5a5ce064b3 bpo-5950: Support reading zips with comments in zipimport (#9548)
* bpo-5950: Support reading zips with comments in zipimport
2018-09-25 15:15:47 -04:00
Yury Selivanov 996859a90d
bpo-34790: [docs] Passing coroutines to asyncio.wait() can be confusing. (GH-9543) 2018-09-25 14:51:21 -04:00
Victor Stinner 6ea29c5e90 bpo-34687: Make asynico use ProactorEventLoop by default (GH-9538) 2018-09-25 11:27:08 -04:00
Joe Pamer c8c0249c9e bpo-32557: allow shutil.disk_usage to take a file path on Windows also (GH-9372)
https://bugs.python.org/issue32557
2018-09-25 07:57:36 -07:00
Tal Einat 604e7b9931
bpo-1529353: IDLE: squeeze large output in the shell (GH-7626) 2018-09-25 15:10:14 +03:00
Zackery Spytz f6c8007a29 bpo-34770: Fix a possible null pointer dereference in pyshellext.cpp (GH-9497)
The GlobalLock() call in UpdateDropDescription() was not checked for
failure.



https://bugs.python.org/issue34770
2018-09-24 21:25:23 -07:00
Ammar Askar 025eb98dc0 bpo-34683: Make SyntaxError column offsets consistently 1-indexed (gh-9338)
Also point to start of tokens in parsing errors.

Fixes bpo-34683
2018-09-24 14:12:49 -07:00
Christian Heimes 223e501fb9 bpo-34791: xml package obeys ignore env flags (GH-9544)
The xml.sax and xml.dom.domreg modules now obey
sys.flags.ignore_environment.

Signed-off-by: Christian Heimes <christian@python.org>



https://bugs.python.org/issue34791
2018-09-24 10:21:12 -07:00
João Júnior 558c49bcf3 bpo-34728: Remove deprecate *loop* argument in asyncio.sleep (GH-9415)
* Insert the warn in the asyncio.sleep when the loop argument is used

* Insert the warn in the asyncio.wait and asyncio.wait_for when the loop argument is used

* Better format of the code

* Add news file

* change calls for get_event_loop() to calls for get_running_loop()

* Change message to be more clear in News

* Improve the comments in test_tasks
2018-09-24 05:51:22 -04:00
Tim Hoffmann a0fd7f1b55 Migrate datetime.date.fromtimestamp to Argument Clinic (GH-8535) 2018-09-24 10:39:02 +02:00
Lisa Roach 9718b59ee5
bpo-34659: Adds initial kwarg to itertools.accumulate() (GH-9345) 2018-09-23 17:34:59 -07:00
Tal Einat c87d9f406b bpo-34548: IDLE: use configured theme colors in TextView (GH-9008)
https://bugs.python.org/issue34548
2018-09-23 05:23:15 -07:00
Christian Heimes 17b1d5d4e3 bpo-17239: Disable external entities in SAX parser (GH-9217)
The SAX parser no longer processes general external entities by default
to increase security. Before, the parser created network connections
to fetch remote files or loaded local files from the file system for DTD
and entities.

Signed-off-by: Christian Heimes <christian@python.org>



https://bugs.python.org/issue17239
2018-09-23 00:50:25 -07:00
Christian Heimes 9fb051f032 bpo-34670: Add TLS 1.3 post handshake auth (GH-9460)
Add SSLContext.post_handshake_auth and
SSLSocket.verify_client_post_handshake for TLS 1.3 post-handshake
authentication.

Signed-off-by: Christian Heimes <christian@python.org>q


https://bugs.python.org/issue34670
2018-09-22 23:32:31 -07:00
jChapman 8fabae3b00 bpo-32117: Iterable unpacking in return and yield documentation (GH-9487)
News entry clean up, added to what's new

Requested by @gvanrossum in https://github.com/python/cpython/pull/4509 


https://bugs.python.org/issue32117
2018-09-22 18:13:10 -07:00
Christian Heimes 026337a710 bpo-34623: Mention CVE-2018-14647 in news entry (GH-9482)
https://bugs.python.org/issue34623
2018-09-21 21:42:29 -07:00
Ethan Furman 5bdab641da
bpo-29577: Enum: mixin classes don't mix well with already mixed Enums (GH-9328)
* bpo-29577: allow multiple mixin classes
2018-09-21 19:03:09 -07:00
David Cuthbert fd97d1f1af bpo-32117: Allow tuple unpacking in return and yield statements (gh-4509)
Iterable unpacking is now allowed without parentheses in yield and return
statements, e.g. ``yield 1, 2, 3, *rest``. Thanks to David Cuthbert for the
change and jChapman for added tests.
2018-09-21 18:31:15 -07:00
Elvis Pranskevichus 7279b5125e bpo-34537: Fix test_gdb:test_strings with LC_ALL=C (GH-9483)
We cannot simply call locale.getpreferredencoding() here,
as GDB might have been linked against a different version
of Python with a different encoding and coercion policy
with respect to PEP 538 and PEP 540.

Thanks to Victor Stinner for a hint on how to fix this.
2018-09-21 18:13:16 -07:00
Brett Cannon d64ee1a5ba bpo-32718: Make Activate.ps1 for venv cross-platform and available on all platforms (GH-9321)
PowerShell Core 6.1 is the cross-platform port of Windows PowerShell. This change updates Activate.ps1 to not make Windows assumptions as well as installing it into the bin/Scripts directory on all operating systems.

Requires PowerShell Core 6.1 for proper readline support once the shell has been activated for the virtual environment.
2018-09-21 15:27:26 -07:00
Yury Selivanov 2ec872b31e
bpo-34762: Fix contextvars C API to use PyObject* pointer types. (GH-9473) 2018-09-21 15:33:56 -04:00
Zackery Spytz 91e6c8717b bpo-34735: Fix a memory leak in Modules/timemodule.c (GH-9418)
There was a missing PyMem_Free(format) in time_strftime().
2018-09-21 09:09:48 +03:00
Berker Peksag 8d1e190fc5
bpo-32215: Fix performance regression in sqlite3 (GH-8511) 2018-09-20 14:10:49 +03:00
Victor Stinner 06e7608207
Revert "bpo-34589: Add -X coerce_c_locale command line option (GH-9378)" (GH-9430)
* Revert "bpo-34589: Add -X coerce_c_locale command line option (GH-9378)"

This reverts commit dbdee0073c.

* Revert "bpo-34589: C locale coercion off by default (GH-9073)"

This reverts commit 7a0791b699.

* Revert "bpo-34589: Make _PyCoreConfig.coerce_c_locale private (GH-9371)"

This reverts commit 188ebfa475.
2018-09-19 14:56:36 -07:00
jdemeyer e89de73987 bpo-34125: Enable profiling of method_descriptor in all cases (GH-8416)
`list.append([], None)` was profiled but `list.append([], None, **{})` was not profiled.
Enable profiling for later case.

https://bugs.python.org/issue34125
2018-09-19 03:06:20 -07:00
Ross Burton 2a9c3805dd closes bpo-34585: Don't do runtime test to get float byte order. (GH-9085)
Currently configure.ac uses AC_RUN_IFELSE to determine the byte order of doubles, but this silently fails under cross compilation and Python doesn't do floats properly.

Instead, steal a macro from autoconf-archive which compiles code using magic doubles (which encode to ASCII) and grep for the representation in the binary.

RFC because this doesn't yet handle the weird ancient ARMv4 OABI 'mixed-endian' encoding properly. This encoding is ancient and I don't believe the union of "Python 3.8 users" and "OABI users" has anything in. Should the support for this just be dropped too? Alternatively, someone will need to find an OABI toolchain to verify the encoding of the magic double.
2018-09-18 23:25:48 -07:00
Serhiy Storchaka 79d1c2e6c9
bpo-25711: Rewrite zipimport in pure Python. (GH-6809) 2018-09-18 22:22:29 +03:00
Silas Sewell 4ba3b50bfe bpo-34472: Add data descriptor signature to zipfile (GH-8871)
This makes streamed zips compatible with MacOS Archive Utility and
other applications.
2018-09-18 20:00:05 +03:00
Steve Dower d0f49d2f50
bpo-34582: Adds JUnit XML output for regression tests (GH-9210) 2018-09-18 09:10:26 -07:00
Christian Heimes cb5778f00c bpo-34623: Use XML_SetHashSalt in _elementtree (GH-9146)
The C accelerated _elementtree module now initializes hash randomization
salt from _Py_HashSecret instead of libexpat's default CPRNG.

Signed-off-by: Christian Heimes <christian@python.org>



https://bugs.python.org/issue34623
2018-09-18 05:38:58 -07:00
Serhiy Storchaka 0185f34ddc
bpo-33721: Make some os.path functions and pathlib.Path methods be tolerant to invalid paths. (#7695)
Such functions as os.path.exists(), os.path.lexists(), os.path.isdir(),
os.path.isfile(), os.path.islink(), and os.path.ismount() now return False
instead of raising ValueError or its subclasses UnicodeEncodeError
and UnicodeDecodeError for paths that contain characters or bytes
unrepresentative at the OS level.
2018-09-18 11:28:51 +03:00
Serhiy Storchaka 7bdf28265a
bpo-32455: Add jump parameter to dis.stack_effect(). (GH-6610)
Add C API function PyCompile_OpcodeStackEffectWithJump().
2018-09-18 09:54:26 +03:00
Victor Stinner dbdee0073c
bpo-34589: Add -X coerce_c_locale command line option (GH-9378)
Add a new -X coerce_c_locale command line option to control C locale
coercion (PEP 538).
2018-09-17 17:19:26 -07:00
Victor Stinner 7a0791b699
bpo-34589: C locale coercion off by default (GH-9073)
Py_Initialize() and Py_Main() cannot enable the C locale coercion
(PEP 538) anymore: it is always disabled. It can now only be enabled
by the Python program ("python3).

test_embed: get_filesystem_encoding() doesn't have to set PYTHONUTF8
nor PYTHONCOERCECLOCALE, these variables are already set in the
parent.
2018-09-17 16:22:29 -07:00