Commit Graph

2227 Commits

Author SHA1 Message Date
Abhilash Raj 02257012f6 bpo-33972: Fix EmailMessage.iter_attachments raising AttributeError. (GH-14119)
* bpo-33972: Fix EmailMessage.iter_attachments raising AttributeError.

When certain malformed messages have content-type set to 'mulitpart/*' but
still have a single part body, iter_attachments can raise AttributeError. This
patch fixes it by returning a None value instead when the body is single part.
2019-06-25 10:03:19 -07:00
Victor Stinner d7c87d982d
bpo-37400: Fix test_os.test_chown() (GH-14374)
Use os.getgroups() rather than grp.getgrall() to get groups.
Rename also the test to test_chown_gid().
2019-06-25 17:06:24 +02:00
Victor Stinner 3939c321c9
bpo-20443: _PyConfig_Read() gets the absolute path of run_filename (GH-14053)
Python now gets the absolute path of the script filename specified on
the command line (ex: "python3 script.py"): the __file__ attribute of
the __main__ module, sys.argv[0] and sys.path[0] become an absolute
path, rather than a relative path.

* Add _Py_isabs() and _Py_abspath() functions.
* _PyConfig_Read() now tries to get the absolute path of
  run_filename, but keeps the relative path if _Py_abspath() fails.
* Reimplement os._getfullpathname() using _Py_abspath().
* Use _Py_isabs() in getpath.c.
2019-06-25 15:02:43 +02:00
Serhiy Storchaka 894263ba80
bpo-24214: Fixed the UTF-8 and UTF-16 incremental decoders. (GH-14304)
* The UTF-8 incremental decoders fails now fast if encounter
  a sequence that can't be handled by the error handler.
* The UTF-16 incremental decoders with the surrogatepass error
  handler decodes now a lone low surrogate with final=False.
2019-06-25 11:54:18 +03:00
Raymond Hettinger 1791128677
bpo-36546: Mark first argument as position only (GH-14363) 2019-06-25 04:39:22 +02:00
Pablo Galindo 3f5b9088b0
bpo-37394: Fix pure Python implementation of the queue module (GH-14351) 2019-06-25 02:53:30 +01:00
Victor Stinner 36456df138
bpo-37392: Remove sys.setcheckinterval() (GH-14355)
Remove sys.getcheckinterval() and sys.setcheckinterval() functions.
They were deprecated since Python 3.2. Use sys.getswitchinterval()
and sys.setswitchinterval() instead.

Remove also check_interval field of the PyInterpreterState structure.
2019-06-25 03:01:08 +02:00
David K. Hess 9fc720e5e4 bpo-4963: Fix for initialization and non-deterministic behavior issues in mimetypes (GH-3062) 2019-06-24 16:46:59 -07:00
animalize 8bd2872adb bpo-25361: Enable SSE2 instructions for Windows 32-bit build (GH-12438) 2019-06-24 16:43:26 -07:00
animalize 7fd2ba354e bpo-35360: Update Windows builds to use SQLite 3.28.0 (GH-14179) 2019-06-24 16:22:14 -07:00
ziheng 6ffd9b05df bpo-32627: Fix compile error when conflicting `_uuid` headers included (GH-11751) 2019-06-24 13:59:50 -04:00
Steve Dower 60419a7e96
bpo-37363: Add audit events for a range of modules (GH-14301) 2019-06-24 08:42:54 -07:00
Jeroen Demeyer a8b27e623d bpo-36974: inherit tp_vectorcall_offset unconditionally (GH-13858) 2019-06-24 12:41:05 +02:00
Victor Stinner 47fbc4e45b
bpo-37359: Add --cleanup option to python3 -m test (GH-14332)
* regrtest: Add --cleanup option to remove "test_python_*" directories
  of previous failed test jobs.
* Add "make cleantest" to run "python3 -m test --cleanup".
2019-06-24 12:03:00 +02:00
Gabe Appleton 2ac3bab2a6 bpo-37345: Add formal UDPLITE support (GH-14258)
At the moment you can definitely use UDPLITE sockets on Linux systems, but it would be good if this support were formalized such that you can detect support at runtime easily.

At the moment, to make and use a UDPLITE socket requires something like the following code:

```
>>> import socket
>>> a = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 136)
>>> b = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 136)
>>> a.bind(('localhost', 44444))
>>> b.sendto(b'test'*256, ('localhost', 44444))
>>> b.setsockopt(136, 10, 16)
>>> b.sendto(b'test'*256, ('localhost', 44444))
>>> b.setsockopt(136, 10, 32)
>>> b.sendto(b'test'*256, ('localhost', 44444))
>>> b.setsockopt(136, 10, 64)
>>> b.sendto(b'test'*256, ('localhost', 44444))
```

If you look at this through Wireshark, you can see that the packets are different in that the checksums and checksum coverages change.

With the pull request that I am submitting momentarily, you could do the following code instead:

```
>>> import socket
>>> a = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDPLITE)
>>> b = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDPLITE)
>>> a.bind(('localhost', 44444))
>>> b.sendto(b'test'*256, ('localhost', 44444))
>>> b.set_send_checksum_coverage(16)
>>> b.sendto(b'test'*256, ('localhost', 44444))
>>> b.set_send_checksum_coverage(32)
>>> b.sendto(b'test'*256, ('localhost', 44444))
>>> b.set_send_checksum_coverage(64)
>>> b.sendto(b'test'*256, ('localhost', 44444))
```

One can also detect support for UDPLITE just by checking

```
>>> hasattr(socket, 'IPPROTO_UDPLITE')
```


https://bugs.python.org/issue37345
2019-06-24 02:58:56 -07:00
Inada Naoki 770847a7db
bpo-37348: optimize decoding ASCII string (GH-14283)
`_PyUnicode_Writer` is a relatively complex structure.  Initializing it is significant overhead when decoding short ASCII string.
2019-06-24 12:30:24 +09:00
Jörn Heissler c8a35417db bpo-35224: Reverse evaluation order of key: value in dict comprehensions (GH-14139)
… as proposed in PEP 572; key is now evaluated before value.





https://bugs.python.org/issue35224
2019-06-22 07:40:55 -07:00
Steve Dower 184f3d4f39 bpo-37364: Use io.open_code() to read .pth files (GH-14299)
https://bugs.python.org/issue37364
2019-06-21 15:16:46 -07:00
Steve Dower f5690925df bpo-37351: Removes libpython38.a from standard Windows distribution (#14276) 2019-06-21 14:28:46 -07:00
Victor Stinner e56a123fd0
bpo-37362: test_gdb now ignores stderr (GH-14287)
test_gdb no longer fails if it gets an "unexpected" message on
stderr: it now ignores stderr. The purpose of test_gdb is to test
that python-gdb.py commands work as expected, not to test gdb.
2019-06-21 23:17:30 +02:00
Joannah Nanjekye a0d73a143a bpo-30202 : Update test.test_importlib.test_abc to test find_spec() (GH-12847) 2019-06-21 11:17:00 -07:00
Zackery Spytz 08286d52b2 bpo-37316: mmap.mmap() passes the wrong variable to PySys_Audit() (GH-14152)
Also, add a missing call to va_end() in PySys_Audit().
2019-06-21 08:31:59 -07:00
Michael Felt 08970cb03c bpo-36210: update optional extension handling for AIX (GH-12202)
* Switch to officially supported curses from 3rd-party ASIS supported ncurses
* stop saying optional modules osaudiodev and spwd are missing on AIX

Patch by M.Felt
2019-06-21 23:58:00 +10:00
Eric V. Smith 0c48618cc0
Fix bpo number in News file. (GH-14260) 2019-06-20 04:22:28 -04:00
Terry Jan Reedy 54cf2e0780
bpo-37325: Fix focus traversal for 2 IDLE dialogs (#14209)
Tab now moves focus across and down for Help Source and Custom Run.
2019-06-18 17:08:24 -04:00
Mike Gleen 6b9c204ee7 bpo-34903: Document that some strptime formats only require 1 digit (GH-14149)
For datetime.datetime.strptime(), the leading zero for some two-digit formats is optional.

This adds a footnote to the strftime/strptime documentation to reflect this fact, and adds some tests to ensure that it is true.

bpo-34903
2019-06-18 19:14:57 +01:00
animalize d8f336fdc1 bpo-35360: Update macOS installer to use SQLite 3.28.0 (GH-14180) 2019-06-18 05:25:19 -04:00
Ned Deily f3fb8393e3
bpo-34631: Updated OpenSSL to 1.1.1c in macOS installer (GH-14187) 2019-06-18 04:17:33 -04:00
Cheryl Sabella 201bc2d18b bpo-5680: IDLE: Customize running a module (GH-13763)
The initialize options are 1) add command line options, which are appended to sys.argv as if passed on a real command line, and 2) skip the shell restart. The customization dialog is accessed by a new entry on the Run menu.
2019-06-17 22:24:10 -04:00
Victor Stinner 343ed0ffe0
bpo-37189: Export old PyRun_XXX() functions (#14142)
Many PyRun_XXX() functions like PyRun_String() were no longer
exported in libpython38.dll by mistake. Export them again to fix the
ABI compatibiliy.
2019-06-18 00:15:13 +02:00
Victor Stinner ac7b1a3f32
bpo-37320: Remove openfp() of aifc, sunau and wave (GH-14169)
aifc.openfp() alias to aifc.open(), sunau.openfp() alias to
sunau.open(), and wave.openfp() alias to wave.open() have been
removed. They were deprecated since Python 3.7.
2019-06-18 00:00:24 +02:00
Terry Jan Reedy 8fac122109
bpo-37321: Edit IDLE subprocess connection error messages. (#14170)
Mainly, add a doc reference to message in pyshell.
2019-06-17 17:23:28 -04:00
Tal Einat 5bff3c86ab bpo-37039: Make IDLE's Zoom Height adjust to users' screens (GH-13678)
Measure required height by quickly maximizing once per screen.
A search for a better method failed.
2019-06-17 15:41:00 -04:00
Steve Dower a268edd6a4
bpo-34631: Updated OpenSSL to 1.1.1c in Windows installer (GH-14163) 2019-06-17 11:36:08 -07:00
Cooper Lees 4acdbf11b1 bpo-34556: Add --upgrade-deps to venv module (#13100)
Add --upgrade-deps to venv module
- This allows for pip + setuptools to be automatically upgraded to the latest version on PyPI
- Update documentation to represent this change

bpo-34556: Add --upgrade to venv module
2019-06-17 19:18:13 +01:00
Vinay Sajip ca7b504a4d
bpo-37111: Add 'encoding' and 'errors' parameters to logging.basicCon… (GH-14008) 2019-06-17 17:40:52 +01:00
Serhiy Storchaka 231aad3849
bpo-37315: Deprecate accepting floats in math.factorial(). (GH-14147) 2019-06-17 16:57:27 +03:00
Victor Stinner 2ff58a24e8
bpo-37194: Add a new public PyObject_CallNoArgs() function (GH-13890)
Add a new public PyObject_CallNoArgs() function to the C API: call a
callable Python object without any arguments.

It is the most efficient way to call a callback without any argument.
On x86-64, for example, PyObject_CallFunctionObjArgs(func, NULL)
allocates 960 bytes on the stack per call, whereas
PyObject_CallNoArgs(func) only allocates 624 bytes per call.

It is excluded from stable ABI 3.8.

Replace private _PyObject_CallNoArg() with public
PyObject_CallNoArgs() in C extensions: _asyncio, _datetime,
_elementtree, _pickle, _tkinter and readline.
2019-06-17 14:27:23 +02:00
Victor Stinner 8bf08ee45b
bpo-37312: Remove _dummy_thread and dummy_threading modules (GH-14143)
Remove _dummy_thread and dummy_threading modules. These modules
were deprecated since Python 3.7 which requires threading support.
2019-06-17 14:18:43 +02:00
Jeroen Demeyer 2e9954d347 bpo-36922: use Py_TPFLAGS_METHOD_DESCRIPTOR in lookup_maybe_method() (GH-13865) 2019-06-17 20:53:20 +09:00
Zackery Spytz 28fca0c422 bpo-37267: Do not check for FILE_TYPE_CHAR in os.dup() on Windows (GH-14051)
On Windows, os.dup() no longer creates an inheritable fd when handling a
character file.
2019-06-17 09:17:14 +02:00
Hai Shi c83356cae2 closes bpo-37300: Remove unnecessary Py_XINCREF in classobject.c. (GH-14120) 2019-06-16 13:19:19 -07:00
Jeroen Demeyer 5600b5e1b2 bpo-28805: document METH_FASTCALL (GH-14079) 2019-06-17 02:03:22 +09:00
Rémi Lapeyre 8047e0e1c6 bpo-35922: Fix RobotFileParser when robots.txt has no relevant crawl delay or request rate (GH-11791)
Co-Authored-By: Tal Einat <taleinat+github@gmail.com>
2019-06-16 09:48:57 +03:00
Michael Felt 3a1d50e7e5 bpo-28009: Fix uuid SkipUnless logic to be based on platform programs capable of introspection (GH-12777)
uuid could try fallback methods that had no chance of working on a particular
platform, and this could cause spurious test failures, as well as degraded
performance as fallback options were tried and failed.

This fixes both the uuid module and its test's SkipUnless logic to use a
prefiltered list of techniques that may at least potentially work on that platform.

Patch by Michael Felt (aixtools).
2019-06-16 01:52:29 +10:00
Andrew Svetlov 0237265e82
Use threadpool for reading from file in sendfile fallback mode (#14076) 2019-06-15 14:05:35 +03:00
Andrew Svetlov ef2152354f
bpo-37279: Fix asyncio sendfile support when extra data are sent in fallback mode. (GH-14075) 2019-06-15 14:05:08 +03:00
Victor Stinner 066e5b1a91
bpo-37266: Daemon threads are now denied in subinterpreters (GH-14049)
In a subinterpreter, spawning a daemon thread now raises an
exception. Daemon threads were never supported in subinterpreters.
Previously, the subinterpreter finalization crashed with a Pyton
fatal error if a daemon thread was still running.

* Add _thread._is_main_interpreter()
* threading.Thread.start() now raises RuntimeError if the thread is a
  daemon thread and the method is called from a subinterpreter.
* The _thread module now uses Argument Clinic for the new function.
* Use textwrap.dedent() in test_threading.SubinterpThreadingTests
2019-06-14 18:55:22 +02:00
Zackery Spytz 9765efcb39 bpo-19865: ctypes.create_unicode_buffer() supports non-BMP strings on Windows (GH-14081) 2019-06-14 17:53:59 +02:00
Andrew Svetlov f0749da9a5 bpo-35998: Avoid TimeoutError in test_asyncio: test_start_tls_server_1() (GH-14080) 2019-06-14 17:26:24 +02:00
Victor Stinner 07559450b2
bpo-37278: Fix test_asyncio ProactorLoopCtrlC (GH-14074)
Join the thread to prevent leaking a running thread and leaking a
reference.

Cleanup also the test:

* asyncioWindowsProactorEventLoopPolicy became the default policy,
  there is no need to set it manually.
* Only start the thread once the loop is running.
* Use a shorter sleep in the thread (100 ms rather than 1 sec).
* Use close_loop(loop) rather than loop.close().
* Use longer variable names.
2019-06-14 13:02:51 +02:00
Pablo Galindo 05f8318655
bpo-37269: Correctly optimise conditionals with constant booleans (GH-14071)
Fix a regression introduced by af8646c805 that was causing code of the form:

if True and False:
   do_something()

to be optimized incorrectly, eliminating the block.
2019-06-14 06:54:53 +01:00
Michael Felt d0eeb936d8 bpo-37077: Add native thread ID (TID) for AIX (GH-13624)
This is the followup  for issue36084



https://bugs.python.org/issue37077
2019-06-13 15:34:46 -07:00
Pablo Galindo 3498c642f4
bpo-37213: Handle negative line deltas correctly in the peephole optimizer (GH-13969)
The peephole optimizer was not optimizing correctly bytecode after negative deltas were introduced. This is due to the fact that some special values (255) were being searched for in both instruction pointer delta and line number deltas.
2019-06-13 19:16:22 +01:00
Victor Stinner 6d22cc8e90
bpo-37261: Fix support.catch_unraisable_exception() (GH-14052)
The __exit__() method of test.support.catch_unraisable_exception
context manager now ignores unraisable exception raised when clearing
self.unraisable attribute.
2019-06-13 14:44:54 +02:00
Victor Stinner 63ab4ba07b
bpo-37210: Fix pure Python pickle when _pickle is unavailable (GH-14016)
Allow pure Python implementation of pickle to work
even when the C _pickle module is unavailable.

Fix test_pickle when _pickle is missing: declare PyPicklerHookTests
outside "if has_c_implementation:" block.
2019-06-13 13:58:51 +02:00
Jeroen Demeyer b4b814b398 bpo-37231: optimize calls of special methods (GH-13973) 2019-06-13 18:26:44 +09:00
Jeffrey Kintscher 8725c83ed5 bpo-35070: test_getgrouplist may fail on macOS if too many groups (GH-13071) 2019-06-13 03:01:29 -04:00
Tim Peters d1c85a27ea
bpo-37257: obmalloc: stop simple arena thrashing (#14039)
GH-14039:  allow (no more than) one wholly empty arena on the usable_arenas list.

This prevents thrashing in some easily-provoked simple cases that could end up creating and destroying an arena on each loop iteration in client code.   Intuitively, if the only arena on the list becomes empty, it makes scant sense to give it back to the system unless we know we'll never need another free pool again before another arena frees a pool.  If the latter obtains, then - yes - this will "waste" an arena.
2019-06-12 22:41:03 -05:00
Victor Stinner 468e5fec8a
bpo-36402: Fix threading._shutdown() race condition (GH-13948)
Fix a race condition at Python shutdown when waiting for threads.
Wait until the Python thread state of all non-daemon threads get
deleted (join all non-daemon threads), rather than just wait until
Python threads complete.

* Add threading._shutdown_locks: set of Thread._tstate_lock locks
  of non-daemon threads used by _shutdown() to wait until all Python
  thread states get deleted. See Thread._set_tstate_lock().
* Add also threading._shutdown_locks_lock to protect access to
  threading._shutdown_locks.
* Add test_finalization_shutdown() test.
2019-06-13 01:30:17 +02:00
Paul Monson b4c7defe58 bpo-36779: time.tzname returns empty string on Windows if default cod… (GH-13073)
Calling setlocale(LC_CTYPE, "") on a system where GetACP() returns CP_UTF8 results in empty strings in _tzname[].

This causes time.tzname to be an empty string.
I have reported the bug to the UCRT team and will follow up, but it will take some time get a fix into production.

In the meantime one possible workaround is to temporarily change the locale by calling setlocale(LC_CTYPE, "C") before calling _tzset and restore the current locale after if the GetACP() == CP_UTF8 or CP_UTF7

@zooba 


https://bugs.python.org/issue36779
2019-06-12 16:13:27 -07:00
Victor Stinner 95f61c8b16
bpo-37069: regrtest uses sys.unraisablehook (GH-13759)
regrtest now uses sys.unraisablehook() to mark a test as "environment
altered" (ENV_CHANGED) if it emits an "unraisable exception".
Moreover, regrtest logs a warning in this case.

Use "python3 -m test --fail-env-changed" to catch unraisable
exceptions in tests.
2019-06-13 01:09:04 +02:00
David Carlier 5287022eee bpo-37160: Thread native ID NetBSD support (GH-13835) 2019-06-12 17:37:56 +02:00
Guido van Rossum 10b55c1643 bpo-35766: Change format for feature_version to (major, minor) (GH-13992)
(A single int is still allowed, but undocumented.)



https://bugs.python.org/issue35766
2019-06-11 17:23:12 -07:00
Andrew Svetlov 65aa64fae8 bpo-36607: Eliminate RuntimeError raised by asyncio.all_tasks() (GH-13971)
If internal tasks weak set is changed by another thread during iteration.



https://bugs.python.org/issue36607
2019-06-11 08:27:30 -07:00
Raymond Hettinger 1f11cf9521
bpo-37219: Remove erroneous optimization for differencing an empty set (GH-13965) 2019-06-11 01:15:24 -07:00
Victor Stinner 4f6f7c5a61
bpo-18748: Fix _pyio.IOBase destructor (closed case) (GH-13952)
_pyio.IOBase destructor now does nothing if getting the closed
attribute fails to better mimick _io.IOBase finalizer.
2019-06-11 02:49:06 +02:00
Christian Heimes 8a8b59c979 bpo-37215: Fix dtrace issue introduce by bpo-36842 (GH-13940)
Signed-off-by: Christian Heimes <christian@python.org>


https://bugs.python.org/issue37215
2019-06-10 08:19:48 -07:00
Marcin Niemira 45a14942c9 bpo-11122: fix hardcoded path checking for rpmbuild in bdist_rpm.py (GH-10594) 2019-06-08 17:05:05 -04:00
Raymond Hettinger e119b3d136
bpo-37178: Allow a one argument form of math.perm() (GH-13905) 2019-06-08 08:58:11 -07:00
Rémi Lapeyre 8cc605acdd bpo-34886: Fix subprocess.run handling of exclusive arguments (GH-11727)
Fix an unintended ValueError from :func:`subprocess.run` when checking for
conflicting `input` and `stdin` or `capture_output` and `stdout` or `stderr` args
when they were explicitly provided but with `None` values within a passed in
`**kwargs` dict rather than as passed directly by name.
2019-06-08 07:56:24 -07:00
Philipp A d407d2a726 bpo-37173: Show passed class in inspect.getfile error (GH-13861)
Currently, inspect.getfile(str) will report nonsense:

```pytb
>>> inspect.getfile(str)
TypeError: <module 'builtins' (built-in)> is a built-in class
```

This fixes that


https://bugs.python.org/issue37173
2019-06-08 05:05:46 -07:00
zygocephalus 03d5831a2d bpo-37150: Throw ValueError if FileType class object was passed in add_argument (GH-13805)
There is a possibility that someone (like me) accidentally will omit parentheses with `FileType` arguments after `FileType`, and parser will contain wrong file until someone will try to use it. 

Example:
```python
parser = argparse.ArgumentParser()
parser.add_argument('-x', type=argparse.FileType)
```


https://bugs.python.org/issue37150
2019-06-07 13:08:36 -07:00
Victor Stinner 3bf0f3ad20
bpo-37169: Rewrite _PyObject_IsFreed() unit tests (GH-13888)
Replace two Python function calls with a single one to ensure that no
memory allocation is done between the invalid object is created and
when _PyObject_IsFreed() is called.
2019-06-07 16:22:21 +02:00
Tal Einat 554450fb4e
bpo-37177: make IDLE's search dialogs transient (GH-13869)
This avoids the search dialogs being hidden behind the editor window.
2019-06-07 08:54:40 +03:00
Zackery Spytz dc2476500d bpo-37170: Fix the cast on error in PyLong_AsUnsignedLongLongMask() (GH-13860) 2019-06-06 22:39:23 +02:00
websurfer5 f6713e84af bpo-36520: Email header folded incorrectly (#13608)
* bpo-36520: reset the encoded word offset when starting a new
line during an email header folding operation

* 📜🤖 Added by blurb_it.

* bpo-36520: add an additional test case, and provide descriptive
comments for the test_folding_with_utf8_encoding_* tests

* bpo-36520: fix whitespace issue

* bpo-36520: changes per reviewer request -- remove extraneous
backslashes; add whitespace between terminating quotes and
line-continuation backslashes; use "bpo-" instead of
"issue #" in comments
2019-06-06 12:53:27 -07:00
Raymond Hettinger e985804207
bpo-37165: Convert _count_elements to the argument clinic (GH-13848) 2019-06-05 16:05:25 -07:00
Ashwin Ramaswami c4c15ed7a2 bpo-35551: encodings update (GH-11446) 2019-06-05 18:18:06 -04:00
Abhilash Raj 66c4f3f38b bpo-21315: Fix parsing of encoded words with missing leading ws. (#13425)
* bpo-21315: Fix parsing of encoded words with missing leading ws.

Because of missing leading whitespace, encoded word would get parsed as
unstructured token. This patch fixes that by looking for encoded words when
splitting tokens with whitespace.

Missing trailing whitespace around encoded word now register a defect
instead.

Original patch suggestion by David R. Murray on bpo-21315.
2019-06-05 09:56:33 -07:00
Raymond Hettinger 6c01ebcc0d
bpo-37158: Simplify and speed-up statistics.fmean() (GH-13832) 2019-06-05 07:39:38 -07:00
Zackery Spytz 9aa78566fb bpo-34767: Do not always create a collections.deque() in asyncio.Lock() (GH-13834)
https://bugs.python.org/issue34767
2019-06-05 02:33:26 -07:00
Terry Jan Reedy 949fe976d5
bpo-35763: Make IDLE calltip note about '/' less obtrusive (GH-13791)
Add it to the end of the first line if there is room.  Tests were reworked.
2019-06-04 21:55:37 -04:00
Zachary Ware 19a1e1eb86 bpo-34282: Remove deprecated enum _convert method (GH-13823) 2019-06-04 23:03:10 +02:00
Łukasz Langa 23d7ce7471 Python 3.8.0b1
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAlz2r2cACgkQsmmV4xAl
 BWhasQ/9EDLL+KtFUdi3iMr7+C1UN/2u2v3OnOsZQA0WE7TfEebbf5GS4baN/pHk
 PslVY6kRqRfQIxjemXFpq52mn9+3SUE4m3avkgnUZMu8XEaUczM4IdcizGMO3qNr
 c1iz6BraJo8gZ1g+dNcRbEc89V9e1SzrBZOR9MXGjxxo0HHEPdjW9ptg1BtHq9To
 n4iivdQSnnxzP7D7SpItWPL/gFv90GBbXaTRerGUlmj/uwnBhzHB1fi4r+WDn8yR
 4AiFVSlUFpTXYOiH5A3MYQtLq8kH9AAmo6Bmj/73NvChxv7GV5v968+tlEWEK+/h
 UtTUEw8L/oSH74m8wd0q0tQdTe8VJgtwKyR6h5GLL8TLa73nN/jK4Koqirpc8mpK
 DcHVLpxHQ/yhPtAcQXp81qqJSbhnPOvbRjNQP5bHcNIl8p+OsF7N9z/tu6gmMorO
 k+f2OCOC0ZsG/EL7DPz6kG6+Cy5NhA+/IJ9I3Ayk6AsSjbzqtgai3bKKVF3s27r8
 OIZprMAVKsmsPpEfuSG8rshKxmLH5/n7YuwSuMmWXv06QspfG43zxp1VYq94zBoI
 wpBy8QxBwef7oDpMI+WgE/g8Prj1NmQuIy7co/pZDsOHeQWr96z90BcpSX8XKHKT
 9W829jFKoQEnGnuFgoUxacR8a4bQKVla5mVFvjUtGjb9GS9kJkk=
 =V2hy
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAlz2zD8QHGx1a2FzekBs
 YW5nYS5wbAAKCRCyaZXjECUFaIw/EACXkzdCOq5D/itTvFElnNWjlon8ot4toVEf
 zw4isSYiYS4B3dBI6+VyCZWNxR5F6fwfyhPLHf7CzPn+7Yp5+dX9//x0HqhNLQCY
 PmwuYG/4nWcww8UhUweGVI1u8Fjrw+LzLJPVyhLQia/TXUBfCFcggS2xo9S6mSsA
 isJr9RaCDaoit6ZjFIuo+sOn2YTx2eYBe6LlhlSx9zz0ayyy+ADqPeUq/hoEFDPD
 EXUOwsLJPo/vu7sFqKOhHBWtMCcnvkkbiBLrAmHS2vhKjl22zVez0lUiVxLUlhZT
 WcmfRkCtoBKu2rYbm85pt08fgF/CnHq9oO57yDBZ4j/Lv0HqQkp+/yZRzWqSSThw
 vw4z4Ur3l06ZMxsTH+Dd/xjqc41AlpedJNhuAgOf0URrbl4H48y5U6AG1vZWrpAk
 wUsTF1QGXL1SAam2pjI2cTpjRaCh3RK2wf0KPewxUpcvcRcGtGAbq+EFHHOFg2Lm
 AcxAuAEUXKcyJQnLtFiIOWJFttaRzAB6zq8sEL0kS1BfAEspqTk+ZdnDY1ajppqu
 7sb3/TGrxa+38Th5iVvUehHGQqrQYLORVn0w8PKUXunbUbv6AYoDJHKxiOUO4JsX
 L5jZEPjTeG0BjntTnvVYdgqPXAVbJr76LmlCPkPcmSruvXrfZP1OOi+ybepwbTpD
 8pw88nSTuA==
 =zOCJ
 -----END PGP SIGNATURE-----

Merge tag 'v3.8.0b1'

Python 3.8.0b1
2019-06-04 21:53:26 +02:00
Abhilash Raj aa79707262 bpo-30835: email: Fix AttributeError when parsing invalid CTE (GH-13598)
* bpo-30835: email: Fix AttributeError when parsing invalid Content-Transfer-Encoding

Parsing an email containing a multipart Content-Type, along with a
Content-Transfer-Encoding containing an invalid (non-ASCII-decodable) byte
will fail. email.feedparser.FeedParser._parsegen() gets the header and
attempts to convert it to lowercase before comparing it with the accepted
encodings, but as the header contains an invalid byte, it's returned as a
Header object rather than a str.

Cast the Content-Transfer-Encoding header to a str to avoid this.

Found using the AFL fuzzer.

Reported-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Andrew Donnellan <andrew@donnellan.id.au>

* Add email and NEWS entry for the bugfix.
2019-06-04 11:00:47 -07:00
Łukasz Langa 3b5deb0116
Python 3.8.0b1 2019-06-04 19:44:34 +02:00
Abhilash Raj 46d88a1131 bpo-35805: Add parser for Message-ID email header. (GH-13397)
* bpo-35805: Add parser for Message-ID header.

This parser is based on the definition of Identification Fields from RFC 5322
Sec 3.6.4.

This should also prevent folding of Message-ID header using RFC 2047 encoded
words and hence fix bpo-35805.

* Prevent folding of non-ascii message-id headers.
* Add fold method to MsgID token to prevent folding.
2019-06-04 10:41:34 -07:00
Victor Stinner bc6469f79c
bpo-37153: test_venv.test_mutiprocessing() calls pool.terminate() (GH-13816)
test_venv.test_mutiprocessing() now explicitly calls pool.terminate()
to wait until the pool completes.
2019-06-04 19:03:13 +02:00
Łukasz Langa 7f9a2ae780
Revert "bpo-34037, asyncio: add BaseEventLoop.wait_executor_on_close (GH-13786)" (#13802)
This reverts commit 0f0a30f4da.
2019-06-04 13:03:20 +02:00
Victor Stinner 0fd2c300c2
Revert "bpo-36818: Add PyInterpreterState.runtime field. (gh-13129)" (GH-13795)
This reverts commit 396e0a8d9d.
2019-06-04 03:15:09 +02:00
Andrew Svetlov 9535aff942 Revert "bpo-35621: Support running subprocesses in asyncio when loop is executed in non-main thread (#13630)" (GH-13793)
https://bugs.python.org/issue35621
2019-06-03 17:09:19 -07:00
Victor Stinner 0f0a30f4da
bpo-34037, asyncio: add BaseEventLoop.wait_executor_on_close (GH-13786)
Add BaseEventLoop.wait_executor_on_close attribute: true by default.

loop.close() now waits for the default executor to finish by default.
Set loop.wait_executor_on_close attribute to False to not wait for
the executor.
2019-06-03 23:31:04 +02:00
Christian Heimes 78c7d52779
bpo-37120: Add SSLContext.num_tickets (GH-13719)
Signed-off-by: Christian Heimes <christian@python.org>
2019-06-03 21:00:10 +02:00
Christian Heimes 47eb223406 bpo-36868: Fix what's new for SSLContext.hostname_checks_common_name (GH-13248)
What's new now mentions SSLContext.hostname_checks_common_name instead of SSLContext.host_flags.


https://bugs.python.org/issue36868
2019-06-03 11:51:27 -07:00
Christian Heimes 06651ee418
bpo-37081: Test with OpenSSL 1.1.1c (GH-13631)
Signed-off-by: Christian Heimes <christian@python.org>
2019-06-03 20:10:19 +02:00
Victor Stinner e225bebc14
Revert "bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). (gh-13714)" (GH-13780)
This reverts commit 6a150bcaeb.
2019-06-03 18:14:24 +02:00
David Carlier 0b9956e916 bpo-37087: Adding native ID support for OpenBSD (GH-13654) 2019-06-03 17:43:33 +02:00
Inada Naoki 91234a1636
bpo-26219: per opcode cache for LOAD_GLOBAL (GH-12884)
This patch implements per opcode cache mechanism, and use it in
only LOAD_GLOBAL opcode.

Based on Yury's opcache3.patch in bpo-26219.
2019-06-03 21:30:58 +09:00
Ned Deily 0288dd6a51
bpo-36231: Support building on macOS without /usr/include (GH-13773) 2019-06-03 06:34:48 -04:00
Pablo Galindo 8565f6b6db
bpo-35814: Allow unpacking in r.h.s of annotated assignment expressions (GH-13760) 2019-06-03 08:34:20 +01:00
Augusto Hack 01ee12ba35 bpo-33569 Preserve type information with dataclasses.InitVar (GH-8927) 2019-06-02 22:14:48 -04:00
Victor Stinner 0025350294
bpo-37069: tests use catch_unraisable_exception() (GH-13762)
Modify test_coroutines, test_cprofile, test_generators, test_raise,
test_ssl and test_yield_from to use
support.catch_unraisable_exception() rather than
support.captured_stderr().

test_thread: remove test_save_exception_state_on_error() which is now
updated. test_unraisable_exception() checks that sys.unraisablehook()
is called to handle _thread.start_new_thread() exception.

test_cprofile now rely on unittest for test discovery: replace
support.run_unittest() with unittest.main().
2019-06-03 03:51:43 +02:00
Matthias Bussonnier 13136e83a6 bpo-36896: Clarify that some types constructors are unstable (GH-13271) 2019-06-03 02:43:21 +02:00
Cheryl Sabella 6bdc4dee01 bpo-35610: IDLE - Replace .context_use_ps1 with .prompt_last_line (GH-11307)
Changes in bpo- 31858 made the less informative 'context_use_ps1' redundant.
2019-06-02 14:56:47 -04:00
Pablo Galindo 7ffcf848df
bpo-37126: Allow structseq objects to be tracked by the GC (GH-13729) 2019-06-02 15:45:13 +01:00
Andrew Svetlov 13ed07998a
bpo-35621: Support running subprocesses in asyncio when loop is executed in non-main thread (#13630) 2019-06-02 13:56:38 +03:00
Mark Dickinson c52996785a
bpo-36027: Extend three-argument pow to negative second argument (GH-13266) 2019-06-02 10:24:06 +01:00
Serhiy Storchaka 5ae299ac78
bpo-37128: Add math.perm(). (GH-13731) 2019-06-02 11:16:49 +03:00
Anthony Sottile b7daabd711 Improve version added references in `typing` module docs (GH-13457) 2019-06-02 01:13:25 +01:00
Eric Snow 6a150bcaeb
bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). (gh-13714) 2019-06-01 15:39:46 -06:00
Serhiy Storchaka bdbad71b9d
bpo-20092. Use __index__ in constructors of int, float and complex. (GH-13108) 2019-06-02 00:05:48 +03:00
Cheryl Sabella 1a4d9ffa1a bpo-32411: IDLE: Remove line number sort in browser.py (#5011)
Insertion in line order makes sorting keys by line order unneeded.
2019-06-01 17:03:22 -04:00
Sergey Fedoseev e5f6207ba6 bpo-34303: Micro-optimizations in functools.reduce() (GH-8598) 2019-06-01 13:32:17 -07:00
Pablo Galindo cd74e66a8c
bpo-37122: Make co->co_argcount represent the total number of positonal arguments in the code object (GH-13726) 2019-06-01 18:08:04 +01:00
Bar Harel 6b282e1887 bpo-36813: Fix QueueListener to call task_done() upon termination. (GH-13113)
Fixed QueueListener in order to avoid random deadlocks.
Unable to add regression tests atm due to time constraints, will add it in a bit.
Regarding implementation, although it's nested, it does not cause performance issues whatsoever, and does not call task_done() in case of an exception (which is the right thing to do IMHO).


https://bugs.python.org/issue36813
2019-06-01 02:19:09 -07:00
Yash Aggarwal 4a686504eb bpo-35431: Implemented math.comb (GH-11414) 2019-06-01 00:21:27 -07:00
Mario Corchero 354227a1e9 Add option to trace to run modules (GH-5134)
Adds a new option in trace that allows tracing runnable modules. It is
exposed as `--module module_name` as `-m` is already in use for another
argument.
2019-06-01 14:49:09 +10:00
Eric Snow 396e0a8d9d
bpo-36818: Add PyInterpreterState.runtime field. (gh-13129)
https://bugs.python.org/issue36818
2019-05-31 21:16:47 -06:00
Tim Peters 1c263e39c4
bpo-37029: keep usable_arenas in sorted order without searching (#13612)
This adds a vector of "search fingers" so that usable_arenas can be kept in sorted order (by number of free pools) via constant-time operations instead of linear search.

This should reduce worst-case time for reclaiming a great many objects from O(A**2) to O(A), where A is the number of arenas.  See bpo-37029.
2019-05-31 21:16:04 -05:00
Zackery Spytz 549e55a308 bpo-12202: Properly check MsiSummaryInfoGetProperty() calls in msilib (GH-13711) 2019-06-01 03:16:20 +03:00
Ammar Askar a6ec1ce1ac bpo-33361: Fix bug with seeking in StreamRecoders (GH-8278) 2019-05-31 22:44:00 +03:00
Pablo Galindo aac4d0342c
bpo-26826: Expose copy_file_range in the os module (GH-7255) 2019-05-31 19:39:47 +01:00
Zackery Spytz c8d5bf6c3f bpo-12639: msilib.Directory.start_component() fails if *keyfile* is not None (GH-13688)
msilib.Directory.start_component() was passing an extra argument to CAB.gen_id().
2019-05-31 09:43:13 -07:00
Akshay Sharma 4612671df2 bpo-25735: math.factorial doc should mention integer return type (GH-6420) 2019-05-31 12:41:17 -04:00
Christian Heimes 8cbb5b6625
bpo-26835: Add file sealing constants to fcntl (GH-13694)
Co-authored-by: nanjekyejoannah <nanjekyejoannah@gmail.com>
2019-05-31 18:32:33 +02:00
Zackery Spytz c7f803b08e bpo-36379: __ipow__ must be a ternaryfunc, not a binaryfunc (GH-13546)
If a type's __ipow__ method was implemented in C, attempting to use
the *modulo* parameter would cause crashes.


https://bugs.python.org/issue36379
2019-05-31 02:46:36 -07:00
Christian Heimes c7f7069e77
bpo-34271: Add ssl debugging helpers (GH-10031)
The ssl module now can dump key material to a keylog file and trace TLS
protocol messages with a tracing callback. The default and stdlib
contexts also support SSLKEYLOGFILE env var.

The msg_callback and related enums are private members. The feature
is designed for internal debugging and not for end users.

Signed-off-by: Christian Heimes <christian@python.org>
2019-05-31 11:44:05 +02:00
Serhiy Storchaka e9b51c0ad8
bpo-26660, bpo-35144: Fix permission errors in TemporaryDirectory cleanup. (GH-10320)
TemporaryDirectory.cleanup() failed when non-writeable or non-searchable
files or directories were created inside a temporary directory.
2019-05-31 11:30:37 +03:00
Serhiy Storchaka 38ab7d4721
bpo-31829: Make protocol 0 pickles be loadable in text mode in Python 2. (GH-11859)
Escape ``\r``, ``\0`` and ``\x1a`` (end-of-file on Windows) in Unicode strings.
2019-05-31 11:29:39 +03:00
Serhiy Storchaka 14a0e16c88
bpo-36548: Improve the repr of re flags. (GH-12715) 2019-05-31 10:39:47 +03:00
Ivan Levkivskyi 4c23aff065
bpo-29262: Add get_origin() and get_args() introspection helpers to typing (GH-13685)
This is an old feature request that appears from time to time. After a year of experimenting with various introspection capabilities in `typing_inspect` on PyPI, I propose to add these two most commonly used functions: `get_origin()` and `get_args()`. These are essentially thin public wrappers around private APIs: `__origin__` and `__args__`.

As discussed in the issue and on the typing tracker, exposing some public helpers instead of `__origin__` and `__args__` directly will give us more flexibility if we will decide to update the internal representation, while still maintaining backwards compatibility.

The implementation is very simple an is essentially a copy from `typing_inspect` with one exception: `ClassVar` was special-cased in `typing_inspect`, but I think this special-casing doesn't really help and only makes things more complicated.
2019-05-31 00:10:07 +01:00
Matthias Bussonnier eea47e0939 bpo-36953: Delay removal of ABCs from collections. (GH-13409)
Bump the removal to 3.9, indicate collections.abc available since 3.3,
replace version-changed directive to deprecated-removed.


https://bugs.python.org/issue36953
2019-05-30 14:45:48 -07:00
xdegaye 5437ccca14 bpo-36342: Fix test_multiprocessing in test_venv (GH-12513)
when platform lacks a functioning sem_open implementation



https://bugs.python.org/issue36342
2019-05-30 14:42:29 -07:00
Alex Grönholm 98ef92002e bpo-36999: Add asyncio.Task.get_coro() (GH-13680)
https://bugs.python.org/issue36999
2019-05-30 08:30:09 -07:00
Zackery Spytz 249b7d59d8 bpo-20602: Do not clear sys.flags and sys.float_info during shutdown (GH-8096)
There is no need to clear these immutable objects during shutdown.
2019-05-30 13:08:24 +02:00
Christian Heimes 6eb814b8ce
bpo-37098: Skip memfd_create test before Linux 3.17 (GH-13677) 2019-05-30 11:27:06 +02:00
Giampaolo Rodola 413d955f8e
bpo-36610: shutil.copyfile(): use sendfile() on Linux only (GH-13675)
...and avoid using it on Solaris as it can raise EINVAL if offset is equal or bigger than the size of the file
2019-05-30 14:05:41 +08:00
Ying Wang a16387ab2d bpo-24564: shutil.copystat(): ignore EINVAL on os.setxattr() (GH-13369) 2019-05-30 11:25:31 +08:00
Zackery Spytz 8f96c9f8ed bpo-37007: Implement socket.if_nametoindex(), if_indextoname() and if_nameindex() on Windows (GH-13522) 2019-05-29 14:02:37 -07:00
Antoine Pitrou ada319bb6d
bpo-32388: Remove cross-version binary compatibility requirement in tp_flags (GH-4944)
It is now allowed to add new fields at the end of the PyTypeObject struct without having to allocate a dedicated compatibility flag in tp_flags.

This will reduce the risk of running out of bits in the 32-bit tp_flags value.
2019-05-29 22:12:38 +02:00
Zackery Spytz 43fdbd2729 bpo-26836: Add os.memfd_create() (#13567)
* bpo-26836: Add os.memfd_create()

* Use the glibc wrapper for memfd_create()

Co-Authored-By: Christian Heimes <christian@python.org>

* Fix deletions caused by autoreconf.

* Use MFD_CLOEXEC as the default value for *flags*.

* Add memset_s to configure.ac.

* Revert memset_s changes.

* Apply the requested changes.

* Tweak the docs.
2019-05-29 21:57:03 +02:00
Gregory P. Smith 0c2f930564
bpo-22385: Support output separators in hex methods. (#13578)
* bpo-22385: Support output separators in hex methods.

Also in binascii.hexlify aka b2a_hex.

The underlying implementation behind all hex generation in CPython uses the
same pystrhex.c implementation.  This adds support to bytes, bytearray,
and memoryview objects.

The binascii module functions exist rather than being slated for deprecation
because they return bytes rather than requiring an intermediate step through a
str object.

This change was inspired by MicroPython which supports sep in its binascii
implementation (and does not yet support the .hex methods).

https://bugs.python.org/issue22385
2019-05-29 11:46:58 -07:00
Jeroen Demeyer aacc77fbd7 bpo-36974: implement PEP 590 (GH-13185)
Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be>
Co-authored-by: Mark Shannon <mark@hotpy.org>
2019-05-29 20:31:52 +02:00
Anthony Sottile d30da5dd9a bpo-36983: Fix typing.__all__ and add test for exported names (GH-13456)
https://bugs.python.org/issue36983
2019-05-29 11:19:37 -07:00
Andrew Svetlov 4dd3e3f9bb bpo-32972: Async test case (GH-13386)
Add explicit `asyncSetUp` and `asyncTearDown` methods.
The rest is the same as for #13228

`AsyncTestCase` create a loop instance for every test for the sake of test isolation.
Sometimes a loop shared between all tests can speed up tests execution time a lot but it requires control of closed resources after every test finish. Basically, it requires nested supervisors support that was discussed with @1st1 many times. Sorry, asyncio supervisors have no chance to land on Python 3.8.

The PR intentionally does not provide API for changing the used event loop or getting the test loop: use `asyncio.set_event_loop_policy()` and `asyncio.get_event_loop()` instead.

The PR adds four overridable methods to base `unittest.TestCase` class:
```
    def _callSetUp(self):
        self.setUp()

    def _callTestMethod(self, method):
        method()

    def _callTearDown(self):
        self.tearDown()

    def _callCleanup(self, function, /, *args, **kwargs):
        function(*args, **kwargs)
```
It allows using asyncio facilities with minimal influence on the unittest code.

The last but not least: the PR respects contextvars. The context variable installed by `asyncSetUp` is available on test, `tearDown` and a coroutine scheduled by `addCleanup`.


https://bugs.python.org/issue32972
2019-05-29 02:33:59 -07:00
Bo Bayles ca80495592 bpo-22454: Add shlex.join() (the opposite of shlex.split()) (GH-7605) 2019-05-29 09:06:11 +01:00
依云 744c08a9c7 bpo-35246: fix support for path-like args in asyncio subprocess (GH-13628)
Drop isinstance checks from create_subprocess_exec function and let
subprocess module do them.

https://bugs.python.org/issue35246


https://bugs.python.org/issue35246
2019-05-28 23:50:59 -07:00
Victor Stinner 8b09500345
bpo-37076: _thread.start_new_thread() calls _PyErr_WriteUnraisableMsg() (GH-13617)
_thread.start_new_thread() now logs uncaught exception raised by the
function using sys.unraisablehook(), rather than sys.excepthook(), so
the hook gets access to the function which raised the exception.
2019-05-29 02:57:56 +02:00
Guido van Rossum 77f0ed7a42
bpo-37072: Fix crash in PyAST_FromNodeObject() when flags is NULL (#13634)
I'm confident that this fixes the reported crash. flags=NULL is treated as using the latest minor version.

https://bugs.python.org/issue37072
2019-05-28 16:44:58 -07:00