Commit Graph

42976 Commits

Author SHA1 Message Date
Yury Selivanov 8a387219bd
bpo-33009: Fix inspect.signature() for single-parameter partialmethods. (GH-6004) 2018-03-06 12:59:45 -05:00
Jason R. Coombs b9650a04a8
bpo-32991: Restore expectation that inspect.getfile raises TypeError on namespace package (GH-5980)
* bpo-32991: Add test capturing expectation.

DocTestFinder.find should return an empty list for doctests in a namespace package.

* bpo-32991: Restore expectation that inspect.getfile on a namespace package raises TypeError.
2018-03-05 18:29:08 -05:00
Steve Dower 6921e73e33
bpo-33001: Prevent buffer overrun in os.symlink (GH-5989) 2018-03-05 14:26:08 -08:00
Terry Jan Reedy 22c82be5df
bpo-32984: IDLE - set __file__ for startup files (GH-5981)
Like Python, IDLE optionally runs one startup file in the Shell window
before presenting the first interactive input prompt.  For IDLE,
option -s runs a file named in environmental variable IDLESTARTUP or
PYTHONSTARTUP; -r file runs file.  Python sets __file__ to the startup
file name before running the file and unsets it before the first
prompt.  IDLE now does the same when run normally, without the -n
option.
2018-03-05 11:02:46 -05:00
Cheryl Sabella 74382a3f17 bpo-32857: Raise error when tkinter after_cancel() is called with None. (GH-5701) 2018-03-04 12:41:47 +02:00
Jamie Davis 0e6c8ee235 bpo-32981: Fix catastrophic backtracking vulns (#5955)
* Prevent low-grade poplib REDOS (CVE-2018-1060)

The regex to test a mail server's timestamp is susceptible to
catastrophic backtracking on long evil responses from the server.

Happily, the maximum length of malicious inputs is 2K thanks
to a limit introduced in the fix for CVE-2013-1752.

A 2KB evil response from the mail server would result in small slowdowns
(milliseconds vs. microseconds) accumulated over many apop calls.
This is a potential DOS vector via accumulated slowdowns.

Replace it with a similar non-vulnerable regex.

The new regex is RFC compliant.
The old regex was non-compliant in edge cases.

* Prevent difflib REDOS (CVE-2018-1061)

The default regex for IS_LINE_JUNK is susceptible to
catastrophic backtracking.
This is a potential DOS vector.

Replace it with an equivalent non-vulnerable regex.

Also introduce unit and REDOS tests for difflib.

Co-authored-by: Tim Peters <tim.peters@gmail.com>
Co-authored-by: Christian Heimes <christian@python.org>
2018-03-03 21:33:32 -08:00
Serhiy Storchaka b21d155f57
bpo-32964: Reuse a testing implementation of the path protocol in tests. (#5930) 2018-03-02 11:53:51 +02:00
Eric V. Smith 5da8cfb838
Fixed incorrect default value for dataclass unsafe_hash. (GH-5949) 2018-03-01 08:01:41 -05:00
Cheryl Sabella f0daa880a4 bpo-32940: IDLE: Simplify StringTranslatePseudoMapping in pyparse (GH-5862)
The new code also runs faster.
2018-02-28 17:23:58 -05:00
Terry Jan Reedy 0954c9e9c8
bpo-30928: Update idlelib/NEWS.txt, possibly for 3.7.0b2 (GH-5932) 2018-02-27 18:36:21 -05:00
Serhiy Storchaka be50a7b627 Revert "bpo-31961: subprocess now accepts path-like args (GH-4329)" (#5912)
* Revert "bpo-31961: subprocess now accepts path-like args (GH-4329)"

This reverts commit dd42cb71f2.
2018-02-27 18:03:46 -05:00
Christian Heimes 698dde16f6
bpo-31453: Add setter for min/max protocol version (#5259)
OpenSSL 1.1 has introduced a new API to set the minimum and maximum
supported protocol version. The API is easier to use than the old
OP_NO_TLS1 option flags, too.

Since OpenSSL has no call to set minimum version to highest supported,
the implementation emulate maximum_version = MINIMUM_SUPPORTED and
minimum_version = MAXIMUM_SUPPORTED by figuring out the minumum and
maximum supported version at compile time.

Signed-off-by: Christian Heimes <christian@python.org>
2018-02-27 11:54:43 +01:00
Christian Heimes 9d50ab563d
bpo-32951: Disable SSLSocket/SSLObject constructor (#5864)
Direct instantiation of SSLSocket and SSLObject objects is now prohibited.
The constructors were never documented, tested, or designed as public
constructors. The SSLSocket constructor had limitations. For example it was
not possible to enabled hostname verification except was
ssl_version=PROTOCOL_TLS_CLIENT with cert_reqs=CERT_REQUIRED.

SSLContext.wrap_socket() and SSLContext.wrap_bio are the recommended API
to construct SSLSocket and SSLObject instances. ssl.wrap_socket() is
also deprecated.

The only test case for direct instantiation was added a couple of days
ago for IDNA testing.

Signed-off-by: Christian Heimes <christian@python.org>
2018-02-27 10:17:30 +01:00
Christian Heimes 05d9fe32a1
bpo-32947: OpenSSL 1.1.1-pre1 / TLS 1.3 fixes (#5663)
* bpo-32947: OpenSSL 1.1.1-pre1 / TLS 1.3 fixes

Misc fixes and workarounds for compatibility with OpenSSL 1.1.1-pre1 and
TLS 1.3 support. With OpenSSL 1.1.1, Python negotiates TLS 1.3 by
default. Some test cases only apply to TLS 1.2. Other tests currently
fail because the threaded or async test servers stop after failure.

I'm going to address these issues when OpenSSL 1.1.1 reaches beta.

OpenSSL 1.1.1 has added a new option OP_ENABLE_MIDDLEBOX_COMPAT for TLS
1.3. The feature is enabled by default for maximum compatibility with
broken middle boxes. Users should be able to disable the hack and CPython's test suite needs
it to verify default options.

Signed-off-by: Christian Heimes <christian@python.org>
2018-02-27 08:55:39 +01:00
Eric V. Smith 2fa6b9eae0
bpo-32960: For dataclasses, disallow inheriting frozen from non-frozen classes and vice-versa, (GH-5919)
This restriction will be relaxed at a future date.
2018-02-26 20:38:33 -05:00
Joffrey F 72d9b2be36 bpo-32713: Fix tarfile.itn for large/negative float values. (GH-5434) 2018-02-27 02:02:21 +02:00
Tobotimus eee72d4778 bpo-32222: Fix pygettext skipping docstrings for funcs with arg typehints (GH-4745) 2018-02-27 00:48:14 +02:00
Sergey Fedoseev 6b5df906af bpo-32147: Improved perfomance of binascii.unhexlify(). (GH-4586) 2018-02-26 22:35:41 +02:00
animalize 19e7d48ce8 bpo-32394: Remove some TCP options on old version Windows. (GH-5523) 2018-02-26 10:10:36 -08:00
Serhiy Storchaka 3f2e6f15d6
Revert unneccessary changes made in bpo-30296 and apply other improvements. (GH-2624) 2018-02-26 16:50:11 +02:00
Serhiy Storchaka 6f600ff173
bpo-32922: dbm.open() now encodes filename with the filesystem encoding. (GH-5832) 2018-02-26 16:02:22 +02:00
Terry Jan Reedy 973cae07d6
Fix 'deecorator' typo in test/test_dataclasses (GH-5899) 2018-02-25 21:38:18 -05:00
Eric V. Smith dbf9cff48a
bpo-32929: Dataclasses: Change the tri-state hash parameter to the boolean unsafe_hash. (#5891)
unsafe_hash=False is now the default. It is the same behavior as the old hash=None parameter. unsafe_hash=True will try to add __hash__. If it already exists, TypeError is raised.
2018-02-25 21:30:17 -05:00
Andrew Svetlov a19fb3c6aa
bpo-32622: Native sendfile on windows (#5565)
* Support sendfile on Windows Proactor event loop naively.
2018-02-25 19:32:14 +03:00
Aaron Gallagher 5fb632e831 Delete a broken threading.local example (#5870)
This code never did anything correct or useful. The class attribute will never be affected, and the condition will never be true.
2018-02-25 10:03:40 -05:00
Christian Heimes b7b9225831
bpo-31809: test secp ECDH curves (#4036)
Add tests to verify connection with secp384r1 ECDH curves.
2018-02-25 09:49:31 +01:00
Christian Heimes 141c5e8c24
bpo-24334: Cleanup SSLSocket (#5252)
* The SSLSocket is no longer implemented on top of SSLObject to
  avoid an extra level of indirection.
* Owner and session are now handled in the internal constructor.
* _ssl._SSLSocket now uses the same method names as SSLSocket and
  SSLObject.
* Channel binding type check is now handled in C code. Channel binding
  is always available.

The patch also changes the signature of SSLObject.__init__(). In my
opinion it's fine. A SSLObject is not a user-constructable object.
SSLContext.wrap_bio() is the only valid factory.
2018-02-24 21:10:57 +01:00
Serhiy Storchaka 42c35d9c0c
bpo-31966: Fixed WindowsConsoleIO.write() for writing empty data. (GH-5754) 2018-02-24 18:55:51 +02:00
Christian Heimes aef1283ba4
bpo-32819: Simplify and improve ssl.match_hostname (#5620)
ssl.match_hostname() has been simplified and no longer depends on re and
ipaddress module for wildcard and IP addresses. Error reporting for invalid
wildcards has been improved.

Signed-off-by: Christian Heimes <christian@python.org>
2018-02-24 14:35:56 +01:00
Cheryl Sabella c29c03a34a bpo-32916: IDLE: Change `str` to `code` in pyparse (GH-5830)
Adjust tests and user modules to match.
2018-02-23 21:35:27 -05:00
Christian Heimes 11a1493bc4 [bpo-28414] Make all hostnames in SSL module IDN A-labels (GH-5128)
Previously, the ssl module stored international domain names (IDNs)
as U-labels. This is problematic for a number of reasons -- for
example, it made it impossible for users to use a different version
of IDNA than the one built into Python.

After this change, we always convert to A-labels as soon as possible,
and use them for all internal processing. In particular, server_hostname
attribute is now an A-label, and on the server side there's a new
sni_callback that receives the SNI servername as an A-label rather than
a U-label.
2018-02-23 17:35:08 -08:00
Eric V. Smith 718070db26
Exhaustively test dataclass hashing when no hash= value is provided. This is in anticipation of changing how non-default hashing is handled. (#5834) 2018-02-23 13:01:31 -05:00
INADA Naoki 58a1096761
ipaddress: Use str.isascii() instead of frozenset (GH-5811) 2018-02-23 20:02:41 +09:00
Anselm Kruis 33dddac00b bpo-30028: make test.support.temp_cwd() fork-safe (GH-1066)
Make test.support.temp_cwd() fork-safe. The context manager test.support.temp_cwd() no longer removes the temporary directory when executing in a process other than the parent it entered from.
If a forked child exits the context manager it won't do the cleanup.
2018-02-22 17:37:38 -08:00
Serhiy Storchaka 520b7ae27e
bpo-17611. Move unwinding of stack for "pseudo exceptions" from interpreter to compiler. (GH-5006)
Co-authored-by: Mark Shannon <mark@hotpy.org>
Co-authored-by: Antoine Pitrou <antoine@python.org>
2018-02-22 23:33:30 +02:00
Serhiy Storchaka 4af8fd5614
bpo-32838: Fix Python versions in the table of magic numbers. (#5658) 2018-02-22 22:26:23 +02:00
Paul Ganssle a049f5790e Test that new_timezone can return the UTC singleton (gh-5318) 2018-02-22 15:15:32 -05:00
Steve Dower 48e8c82fc6
bpo-32457: Improves handling of denormalized executable path when launching Python (GH-5756) 2018-02-22 10:39:26 -08:00
Steve Dower 23ad6d0d1a
bpo-32556: nt._getfinalpathname, nt._getvolumepathname and nt._getdiskusage now correctly convert from bytes. (GH-5761) 2018-02-22 10:39:10 -08:00
Terry Jan Reedy 451d1edaf4
bpo-32905: IDLE - remove unused code in pyparse module (GH-5807)
dump is similar to print but less flexible.  lastopenbracketpos is now always initialized in _study2, as was stmt_bracketing, so the class settings are not needed.  get_last_open_bracket_pos is never called.
2018-02-22 01:19:02 -05:00
Cheryl Sabella c84cf6c03f bpo-32874: IDLE: add tests for pyparse (GH-5755)
There are no code changes other than comments and docstrings.
2018-02-21 22:48:36 -05:00
Eric Snow f53d9f2778
bpo-32604: Swap threads only if the interpreter is different. (gh-5778)
The CPython runtime assumes that there is a one-to-one relationship (for a given interpreter) between PyThreadState and OS threads. Sending and receiving on a channel in the same interpreter was causing crashes because of this (specifically due to a check in PyThreadState_Swap()). The solution is to not switch threads if the interpreter is the same.
2018-02-20 16:30:17 -07:00
Zackery Spytz 80d20b918b bpo-31848: Fix broken error handling in Aifc_read.initfp() when the SSND chunk is not found (#5240)
Initialize self._ssnd_chunk so that aifc.Error is raised as intended,
not AttributeError.
2018-02-20 23:06:11 +02:00
Steve Dower 6240917b77
bpo-32409: Ensures activate.bat can handle Unicode contents (GH-5757) 2018-02-19 17:25:24 -08:00
Zachary Ware 5537646bfa
bpo-30121: Fix test_subprocess for Windows Debug builds (GH-5758) 2018-02-19 14:02:38 -06:00
pmp-p 4c7108a771 bpo-32682: Improve libz version parsing in test_zilb (GH-5347) 2018-02-18 21:45:11 -06:00
chason dfa015cf77 bpo-31972: Improve docstrings for pathlib classes (#5310) 2018-02-18 18:36:32 -05:00
Éric Araujo 08a6926b25
Improve error message for "setup.py upload" without dist files (#21060) 2018-02-18 18:14:54 -05:00
Ivan Levkivskyi 03e3c340a0
bpo-31333: Re-implement ABCMeta in C (#5273)
This adds C versions of methods used by ABCMeta that
improve performance of various ABC operations.
2018-02-18 12:41:58 +00:00
Steve Dower 01423cb53b
Improves the ability to build in CI (GH-5728) 2018-02-17 18:59:03 -08:00
Kyle Altendorf 9f4223261f bpo-32852: Fix trace changing sys.argv to tuple. (GH-5692) 2018-02-17 08:32:37 +02:00
Eric Snow 4c6955e2b0
bpo-32604: Clean up created subinterpreters before runtime finalization. (gh-5709) 2018-02-16 18:53:40 -07:00
Bar Harel 5746510b7a bpo-32841: Fix cancellation in awaiting asyncio.Condition (#5665) 2018-02-14 11:18:11 +02:00
INADA Naoki f0bc645dfe
bpo-31787: Skip refleak check when _hashlib is not available (GH-5660) 2018-02-13 23:41:19 +09:00
Oren Milman d019bc8319 bpo-31787: Prevent refleaks when calling __init__() more than once (GH-3995) 2018-02-13 19:28:33 +09:00
Segev Finer da6c3da6c3 bpo-32370: Use the correct encoding for ipconfig output in the uuid module. (GH-5608) 2018-02-13 08:29:54 +02:00
Terry Jan Reedy 688722cedd
bpo-32837: IDLE - require encoding argument for textview.view_file. (GH-5646)
Using the system and place-dependent default encoding for open()
is a bad idea for IDLE's system and location-independent files.
2018-02-12 17:42:41 -05:00
Terry Jan Reedy f34e03ec0e
bpo-32826: Add "encoding=utf-8" to open() in idle_test/test_help_about. (GH-5639)
GUI test test_file_buttons() only looks at initial ascii-only lines,
but failed on systems where open() defaults to 'ascii' because
readline() internally reads and decodes far enough ahead to encounter
a non-ascii character in CREDITS.txt.
2018-02-12 14:58:26 -05:00
Коренберг Марк 7766b96ab8 bpo-32221: makeipaddr(): remove interface part + speedup (GH-5449) (#5449) 2018-02-12 14:47:42 -05:00
SSE4 3c34aad4e7 bpo-29248: Fix os.readlink() on Windows (GH-5577)
The PrintNameOffset field of the reparse data buffer
was treated as a number of characters instead of bytes.
2018-02-12 20:10:35 +03:00
Raymond Hettinger 136c8e0795
Code beautification using f-strings (#5618) 2018-02-11 08:00:11 -08:00
Raymond Hettinger 3793f95f98
bpo-32792: Preserve mapping order in ChainMap() (GH-5586) 2018-02-11 00:30:31 -08:00
Zhou Fangyi 5df5286abd bpo-30688: Import unicodedata only when needed. (GH-5606)
Importing unicodedata in sre_parse leads to failure in compilation.
unicodedata is unused during compilation, and is not compiled when this
file is imported. The error occurs when generating posix variables,
pprint is required. The dependency chain goes on like this:

sysconfig -> pprint -> re -> sre_compile -> sre_parse (this file)

This commits fixes compilation issues introduced by
2272cec13b.
(Issue 30688, GH-5588)
2018-02-10 08:59:29 +02:00
Serhiy Storchaka a445feb729
bpo-30688: Support \N{name} escapes in re patterns. (GH-5588)
Co-authored-by: Jonathan Eunice <jonathan.eunice@gmail.com>
2018-02-10 00:08:17 +02:00
Serhiy Storchaka 2411292ba8
bpo-30157: Fix csv.Sniffer.sniff() regex pattern. (GH-5601)
Co-authored-by: Jake Davis <jcdavis@awedge.net>
2018-02-09 20:00:49 +02:00
Serhiy Storchaka 23cdbfa744
bpo-32775: Fix regular expression warnings in fnmatch. (#5583)
fnmatch.translate() no longer produces patterns which contain set
operations.

Sets starting with '[' or containing '--', '&&', '~~' or '||' will
be interpreted differently in regular expressions in future versions.
Currently they emit warnings. fnmatch.translate() now avoids producing
patterns containing such sets by accident.
2018-02-09 13:30:19 +02:00
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) feaefc7f60 Cleanup inspect
* use isinstance(..)  instead of type(..)
* use  '.. not in ..'  instead of 'not .. in ..	'
2018-02-09 18:59:19 +09:00
Alan D Moore a48e78a0b7 bpo-32585: Add tkinter.ttk.Spinbox. (#5221) 2018-02-09 02:03:55 +02:00
Bernhard M. Wiedemann 4ad703b7ca bpo-30693: Fix tarfile test cleanup on MSWindows (#5557)
it was using our mocked listdir to check when the files were gone.
2018-02-06 20:08:53 +02:00
Serhiy Storchaka 6c85efa5a6
bpo-32749: Make dbm.dumb databases more cosistent with other dbm databases. (#5497) 2018-02-05 22:47:31 +02:00
Terry Jan Reedy 05e806767b
Add entry for uniform lower context; add 'since' to be explicit. (GH-5539) 2018-02-04 19:07:16 -05:00
Cheryl Sabella 845d86485e bpo-32765: Update configdialog General tab create page docstring (GH-5529)
Add new entries to the widget list.
2018-02-04 18:15:21 -05:00
Serhiy Storchaka 95c3262762
Use assertTrue() instead of deprecated assert_(). (#5526) 2018-02-04 18:14:47 +02:00
Serhiy Storchaka 07ca9afaa8
bpo-10544: Disallow "yield" in comprehensions and generator expressions. (GH-4564) 2018-02-04 10:53:48 +02:00
Leo Arias c3d9508ff2 bpo-32746: Fix multiple typos (GH-5144)
Fix typos found by codespell in docs, docstrings, and comments.
2018-02-03 19:36:10 -05:00
Mario Corchero 38bfa8418f bpo-32691: Use mod_spec.parent when running modules with pdb (GH-5474)
Previously the module name was used, which broke relative imports when pdb was run against a plain module or submodule.
2018-02-03 16:40:11 +10:00
Eric Snow 4e9da0d163
bpo-32604: Fix memory leaks in the new _xxsubinterpreters module. (#5507) 2018-02-02 21:49:49 -07:00
Bar Harel 2f79c01493 bpo-32734: Fix asyncio.Lock multiple acquire safety issue (GH-5466) 2018-02-02 17:04:00 -05:00
Barry Warsaw bbbcf8693b
bpo-32303 - Consistency fixes for namespace loaders (#5481)
* Make sure ``__spec__.loader`` matches ``__loader__`` for namespace packages.
* Make sure ``__spec__.origin` matches ``__file__`` for namespace packages.

https://bugs.python.org/issue32303
https://bugs.python.org/issue32305
2018-02-02 15:15:58 -05:00
Yury Selivanov 383b32fe10
Revert "bpo-31356: Add context manager to temporarily disable GC GH-5495
This reverts commit 72a0d218dc.

The reverted commit had a few issues so it was unanimously decided
to undo it. See the bpo issue for details.
2018-02-02 09:31:06 -05:00
Nathaniel J. Smith 2efb973589
bpo-32733: Make test_coroutines robust against -Werror (GH-5487) 2018-02-01 20:55:55 -08:00
Andrew Svetlov 3d4dbd8f01
Implement TimerHandle.when() (#5473) 2018-02-01 19:59:32 +02:00
Serhiy Storchaka 97f1ca1673
[3.8] bpo-31508: Remove support of arguments in tkinter.ttk.Treeview.selection. (GH-3651)
It was deprecated in 3.6.
2018-02-01 18:49:21 +02:00
Ned Deily 6e41cd95b5 Update NEWS, docs, and patchlevel for 3.7.0b1 2018-01-31 17:14:30 -05:00
Serhiy Storchaka c66f9f8d39
bpo-25988: Emit a warning when use or import ABCs from 'collections'. (#5460) 2018-01-31 19:19:33 +02:00
Xiang Zhang 2c7fd46e11
bpo-32583: Fix possible crashing in builtin Unicode decoders (#5325)
When using customized decode error handlers, it is possible for builtin decoders
to write out-of-bounds and then crash.
2018-01-31 20:48:05 +08:00
Bernhard M. Wiedemann 84521047e4 bpo-30693: zip+tarfile: sort directory listing (#2263)
tarfile and zipfile now sort directory listing to generate tar and zip archives
in a more reproducible way.

See also https://reproducible-builds.org/docs/stable-inputs/ on that topic.
2018-01-31 11:17:10 +01:00
Stéphane Wirtel 8d83e4ba78 bpo-32727: smtplib's SMTP.send_message behaves differently with from_addr and to_addrs (#5451)
Do not pass the name field in the 'from' address in the SMTP envelope.
2018-01-30 19:02:51 -05:00
Benjamin Peterson 1e17d4aaff
compare with difflib not diff(1) (GH-5450) 2018-01-30 09:03:12 -08:00
Ned Deily 763f094b1f
bpo-28440: Don't add /Library/Python/3.x/site-packages to sys.path (#5445)
No longer add /Library/Python/3.x/site-packages, the Apple-supplied
system Python site-packages directory, to sys.path for macOS framework
builds in case Apple ships a version of Python 3. A similar change
was made earlier to Python 2.7 where it was found that the coupling
between the system Python and a user-installed framework Python often
caused confusion or pip install failures.
2018-01-30 05:14:09 -05:00
John Jolly 066df4fd45 bpo-22908: Add seek and tell functionality to ZipExtFile (GH-4966)
This allows for nested zip files, tar files within zip files, zip files within tar files, etc.

Contributed by: John Jolly
2018-01-30 00:51:35 -08:00
Christian Heimes 2e0ecde8d7
bpo-28134: Ignore proto in unknown socket test (GH-5435)
Band-aid for macOS: Some platforms seem to ignore unknown protocols.

Signed-off-by: Christian Heimes <christian@python.org>
2018-01-30 08:55:46 +01:00
Anders Lorentsen dd42cb71f2 bpo-31961: subprocess now accepts path-like args (GH-4329)
Allow os.PathLike args in subprocess APIs.
2018-01-29 23:27:28 -08:00
Eric Appelt 14e976e00e closes bpo-30117: fix lib2to3 ParserIdempotency test (GH-1242)
Fix two (in my opinion) spurious failure conditions in the lib2to3.tests.test_parser.TestParserIdempotency test_parser test.

    Use the same encoding found in the initial file to write a temp file for a diff. This retains the BOM if the encoding was initially utf-8-sig.

    If the file cannot be parsed using the normal grammar, try again with no print statement which should succeed for valid files using future print_function

For case (1), the driver was correctly handling a BOM in a utf-8 file, but then the test was not writing a comparison file using 'utf-8-sig' to diff against, so the BOM got removed. I don't think that is the fault of the parser, and lib2to3 will retain the BOM.

For case (2), lib2to3 pre-detects the use of from __future__ import print_function or allows the user to force this interpretation with a -p flag, and then selects a different grammar with the print statement removed. That makes the test cases unfair to this test as the driver itself doesn't know which grammar to use. As a minimal fix, the test will try using a grammar with the print statement, and if that fails fall back on a grammar without it. A more thorough handling of the idempotency test would to be to parse all files using both grammars and ignore if one of the two failed but otherwise check both. I didn't think this was necessary but can change.
2018-01-29 23:13:03 -08:00
Bo Bayles ce0f33d045 bpo-32102 Add "capture_output=True" to subprocess.run (GH-5149)
Add "capture_output=True" option to subprocess.run, this is equivalent to
setting stdout=PIPE, stderr=PIPE but is much more readable.
2018-01-29 22:40:39 -08:00
Benjamin Peterson 95441809ef
closes bpo-32721: do not fail test_hashlib if _md5 isn't available (GH-5441) 2018-01-29 22:14:17 -08:00
Bo Bayles ce237c7d58 bpo-21417: Add compresslevel= to the zipfile module (GH-5385)
This allows the compression level to be specified when writing zipfiles
(for the entire file *and* overridden on a per-file basis).

Contributed by Bo Bayles
2018-01-29 21:54:07 -08:00
Gregory P. Smith f4d644f36f
bpo-25942: make subprocess more graceful on ^C (GH-5026)
Do not allow receiving a SIGINT to cause the subprocess module to trigger an
immediate SIGKILL of the child process.  SIGINT is normally sent to all child
processes by the OS at the same time already as was the established normal
behavior in 2.7 and 3.2.  This behavior change was introduced during the fix to https://bugs.python.org/issue12494 and is generally surprising to command line
tool users who expect other tools launched in child processes to get their own
SIGINT and do their own cleanup.

In Python 3.3-3.6 subprocess.call and subprocess.run would immediately
SIGKILL the child process upon receiving a SIGINT (which raises a
KeyboardInterrupt).  We now give the child a small amount of time to
exit gracefully before resorting to a SIGKILL.

This is also the case for subprocess.Popen.__exit__ which would
previously block indefinitely waiting for the child to die.  This was
hidden from many users by virtue of subprocess.call and subprocess.run
sending the signal immediately.

Behavior change: subprocess.Popen.__exit__ will not block indefinitely
when the exiting exception is a KeyboardInterrupt.  This is done for
user friendliness as people expect their ^C to actually happen.  This
could cause occasional orphaned Popen objects when not using `call` or
`run` with a child process that hasn't exited.

Refactoring involved: The Popen.wait method deals with the
KeyboardInterrupt second chance, existing platform specific internals
have been renamed to _wait().
Also fixes comment typos.
2018-01-29 21:27:39 -08:00
Benjamin Peterson 77526f05fa replace dynamic import with 'exec' with importlib.import_module (#5433) 2018-01-29 18:03:01 -08:00
Eric Snow 7f8bfc9b9a
bpo-32604: Expose the subinterpreters C-API in a "private" stdlib module. (gh-1748)
The module is primarily intended for internal use in the test suite.  Building the module under Windows will come in a follow-up PR.
2018-01-29 18:23:44 -07:00
Mark Shannon 332cd5ee4f bpo-32550. Remove the STORE_ANNOTATION bytecode. (GH-5181) 2018-01-29 16:41:04 -08:00
Christian Heimes b6e43af669
bpo-28134: Auto-detect socket values from file descriptor (#1349)
Fix socket(fileno=fd) by auto-detecting the socket's family, type,
and proto from the file descriptor. The auto-detection can be overruled
by passing in family, type, and proto explicitly.

Without the fix, all socket except for TCP/IP over IPv4 are basically broken:

>>> s = socket.create_connection(('www.python.org', 443))
>>> s
<socket.socket fd=3, family=AddressFamily.AF_INET6, type=SocketKind.SOCK_STREAM, proto=6, laddr=('2003:58:bc4a:3b00:56ee:75ff:fe47:ca7b', 59730, 0, 0), raddr=('2a04:4e42:1b::223', 443, 0, 0)>
>>> socket.socket(fileno=s.fileno())
<socket.socket fd=3, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('2003:58:bc4a:3b00::%2550471192', 59730, 0, 2550471192), raddr=('2a04:4e42:1b:0:700c:e70b:ff7f:0%2550471192', 443, 0, 2550471192)>

Signed-off-by: Christian Heimes <christian@python.org>
2018-01-29 22:37:58 +01:00
Pablo Galindo 72a0d218dc bpo-31356: Add context manager to temporarily disable GC (GH-4224) 2018-01-29 12:37:09 -08:00
Yury Selivanov 2a2270db9b
bpo-32703: Fix coroutine resource warning in case where there's an error (GH-5410)
The commit removes one unnecessary "if" clause in genobject.c.  That "if" clause was masking un-awaited coroutines warnings just to make writing unittests more convenient.
2018-01-29 14:31:47 -05:00
jayyyin aa218d1649 bpo-27931: Fix email address header parsing error (#5329)
Correctly handle addresses whose username is an empty quoted string.
2018-01-29 13:07:44 -05:00
Raymond Hettinger e6d342156d
bpo-25988: Deprecate exposing collections.abc in collections GH-5414 2018-01-29 08:27:49 -08:00
Andrew Svetlov 4f4ef0acba
Add a test for pdb until command in coroutine (#5427) 2018-01-29 16:17:45 +02:00
Christian Heimes 66e5742bec
bpo-28414: ssl module idna test (#5395)
Add test cases for IDNA 2003 and 2008 host names. IDNA 2003
internationalized host names are working since bpo-31399 has landed. IDNA
2008 deviations are still broken and will be fixed in another patch.

Signed-off-by: Christian Heimes <christian@python.org>
2018-01-29 14:25:13 +01:00
Christian Heimes 892d66e422
bpo-31429: Define TLS cipher suite on build time (#3532)
Until now Python used a hard coded white list of default TLS cipher
suites. The old approach has multiple downsides. OpenSSL's default
selection was completely overruled. Python did neither benefit from new
cipher suites (ChaCha20, TLS 1.3 suites) nor blacklisted cipher suites.
For example we used to re-enable 3DES.

Python now defaults to OpenSSL DEFAULT cipher suite selection and black
lists all unwanted ciphers. Downstream vendors can override the default
cipher list with --with-ssl-default-suites.

Signed-off-by: Christian Heimes <christian@python.org>
2018-01-29 14:10:18 +01:00
Victor Stinner d951157268
bpo-20891: Reenable test_embed.test_bpo20891() (GH-5420) 2018-01-29 14:04:44 +01:00
Victor Stinner 51500f3745
bpo-32706: Skip test_ftplib.test_check_hostname() (#5422)
This test is unstable and currently prevents to make any new change
since the test always fails on Travis CI.

Skip the test to get more time to fix it.
2018-01-29 13:21:34 +01:00
Nathaniel J. Smith 95e214713a
bpo-32591: silence deprecation warnings in test_coroutine (GH-5412) 2018-01-28 23:34:26 -08:00
Yury Selivanov 1e5b25b8c0
bpo-23749: Make start-tls tests more stable on win7 buildbot (GH-5409)
To mitigate the situation when the buildbot is under load
and is unable to send/receive data fast enough:

* reduce the size of the payload
* set a generous timeout for socket ops
2018-01-29 00:25:05 -05:00
Yury Selivanov 07627e9a6a
bpo-32251: Fix docs (#5408) 2018-01-28 23:51:08 -05:00
Yury Selivanov 9ee1bf9ab5
bpo-32650: Add an asyncgen pdb test (#5406) 2018-01-28 22:43:46 -05:00
embg 1e34da49ef bpo-28685: Optimize sorted() list.sort() with type-specialized comparisons (#582) 2018-01-28 19:03:23 -08:00
Pablo Galindo 6c6ddf97c4 bpo-20104: Expose `posix_spawn` in the os module (GH-5109)
Add os.posix_spawn to wrap the low level POSIX API of the same name.

Contributed by Pablo Galindo.
2018-01-28 17:56:10 -08:00
Pablo Galindo c7ab581db2 bpo-32650 Add support for async generators and more test for coroutines in pdb (#5403) 2018-01-28 20:31:00 -05:00
Pablo Galindo 4687702442 bpo-32650: Add native coroutine support to bdb when stepping over line (GH-5400) 2018-01-29 02:25:05 +02:00
Eric V. Smith 7c99e931a9
Fix trivial typo in test_dataclasses.py. (GH-5398) 2018-01-28 19:18:55 -05:00
Yury Selivanov f11b460d87
bpo-32373: Add socket.getblocking() method. (#4926) 2018-01-28 17:27:38 -05:00
Yury Selivanov 631fd38dbf
bpo-32251: Implement asyncio.BufferedProtocol. (#4755) 2018-01-28 16:30:26 -05:00
Yury Selivanov 0ceb717689
Revert "bpo-32221: makeipaddr(): remove interface part + speedup (GH-4724)" (#5394)
This reverts commit 47c0b1f7d4.
2018-01-28 16:08:32 -05:00
larryhastings f36ba12809
bpo-32697: Definition order of kwonly params is now guaranteed preserved. (#5391)
Definition order of kwonly params is now guaranteed preserved.
2018-01-28 11:13:09 -08:00
Yury Selivanov bec2372b7e
bpo-32327: Revert loop.run_in_executor behaviour: return a Future. (#5392)
I've run some tests on 3.7 asyncio and it appears that too many
things assume that run_in_executor returns a Future.
2018-01-28 14:09:40 -05:00
Nitish Chandra 059f58ce93 bpo-32228: Reset raw_pos after unwinding the raw stream (#4858)
Ensure that ``truncate()`` preserves the file position (as reported by ``tell()``) after writes longer than the buffer size.
2018-01-28 17:00:09 +01:00
Nitish Chandra 43c0f1ac5e bpo-32685: Improve suggestion for print statement (GH-5375)
Better account for single-line compound statements and
semi-colon separated statements when suggesting
Py3 replacements for Py2 print statements.

Initial patch by Nitish Chandra.
2018-01-28 20:56:02 +10:00
Mario Corchero fcf8b4c102 bpo-32206: Update pdb usage to include new module option (GH-5111) 2018-01-28 14:58:47 +10:00
Martin Teichmann dd0e087edc bpo-30306: release arguments of contextmanager (GH-1500)
The arguments to a generator function which is declared as a
contextmanager are stored inside the context manager, and
thus are kept alive, even when it is used as a regular context
manager, and not as a function decorator (where it needs
the original arguments to recreate the generator on each
call).

This is a possible unnecessary memory leak, so this changes
contextmanager.__enter__ to release the saved arguments,
as that method being called means that particular CM instance
isn't going to need to recreate the underlying generator.

Patch by Martin Teichmann.
2018-01-28 14:17:46 +10:00
INADA Naoki bea57060c8
bpo-32677: Optimize str.isascii() (GH-5356) 2018-01-28 09:59:12 +09:00
Eric V. Smith ea8fc52e75
bpo-32513: Make it easier to override dunders in dataclasses. (GH-5366)
Class authors no longer need to specify repr=False if they want to provide a custom __repr__ for dataclasses. The same thing applies for the other dunder methods that the dataclass decorator adds. If dataclass finds that a dunder methods is defined in the class, it will not overwrite it.
2018-01-27 19:07:40 -05:00
Yury Selivanov 2a2247ce5e
bpo-32622: Normalize ENOTCONN to ConnectionError on macOS (GH-5369)
On mac, sendfile throws ENOTCONN on a repeated sendfile call if
the connection is closed. Normalize it to behave like other systems.
2018-01-27 17:22:01 -05:00
Коренберг Марк 47c0b1f7d4 bpo-32221: makeipaddr(): remove interface part + speedup (GH-4724) 2018-01-27 17:20:50 -05:00
Andrew Svetlov 0f54e00e96
Fix tests if Python compiled without SSL (#5367) 2018-01-28 00:00:37 +02:00
Yury Selivanov b1a6ac4c40
bpo-32622: Enforce sendfile fallback policy for FALLBACK transports (#5364) 2018-01-27 15:52:52 -05:00
Andrew Svetlov 7c684073f9
bpo-32622: Implement loop.sendfile() (#5271) 2018-01-27 21:22:47 +02:00
Yury Selivanov f13f12d8da
bpo-32630: Use contextvars in decimal (GH-5278) 2018-01-27 13:46:46 -05:00
Pablo Galindo 4defba3b95 bpo-31368: Expose preadv and pwritev in the os module (#5239) 2018-01-27 17:16:37 +01:00
Christian Heimes 61d478c71c
bpo-31399: Let OpenSSL verify hostname and IP address (#3462)
bpo-31399: Let OpenSSL verify hostname and IP

The ssl module now uses OpenSSL's X509_VERIFY_PARAM_set1_host() and
X509_VERIFY_PARAM_set1_ip() API to verify hostname and IP addresses.

* Remove match_hostname calls
* Check for libssl with set1_host, libssl must provide X509_VERIFY_PARAM_set1_host()
* Add documentation for OpenSSL 1.0.2 requirement
* Don't support OpenSSL special mode with a leading dot, e.g. ".example.org" matches "www.example.org". It's not standard conform.
* Add hostname_checks_common_name

Signed-off-by: Christian Heimes <christian@python.org>
2018-01-27 15:51:38 +01:00
Mads Jensen 746cc75541 bpo-31853: Replaced socket.method calls with super() in SSLSocket. (#4048) 2018-01-27 13:34:28 +01:00
Christian Heimes d0e31b980f
bpo-32454: socket closefd (#5048)
Add close(fd) function to the socket module

Signed-off-by: Christian Heimes <christian@python.org>
2018-01-27 09:54:13 +01:00
Christian Heimes 2f050c7e1b
bpo-32433: Optimized HMAC digest (#5023)
The hmac module now has hmac.digest(), which provides an optimized HMAC
digest for short messages. hmac.digest() is up to three times faster
than hmac.HMAC().digest().

Signed-off-by: Christian Heimes <christian@python.org>
2018-01-27 09:53:43 +01:00
INADA Naoki a49ac99029
bpo-32677: Add .isascii() to str, bytes and bytearray (GH-5342) 2018-01-27 14:06:21 +09:00
INADA Naoki 37420deb80
bpo-32678: inspect: Import ast lazily (GH-5344) 2018-01-27 10:10:06 +09:00
Yury Selivanov 43c47fe096
bpo-32670: Enforce PEP 479. (#5327) 2018-01-26 15:24:24 -05:00
Nathaniel J. Smith dba976b8a2 bpo-32591: fix abort in _PyErr_WarnUnawaitedCoroutine during shutdown (#5337)
When an unawaited coroutine is collected very late in shutdown --
like, during the final GC at the end of PyImport_Cleanup -- then it
was triggering an interpreter abort, because we'd try to look up the
"warnings" module and not only was it missing (we were prepared for
that), but the entire module system was missing (which we were not
prepared for).

I've tried to fix this at the source, by making the utility function
get_warnings_attr robust against this in general. Note that it already
has the convention that it can return NULL without setting an error,
which is how it signals that the attribute it was asked to fetch is
missing, and that all callers already check for NULL returns.

There's a similar check for being late in shutdown at the top of
warn_explicit, which might be unnecessary after this fix, but I'm not
sure so I'm going to leave it.
2018-01-26 14:28:31 -05:00
Guido van Rossum 95e4d58913 String annotations [PEP 563] (#4390)
* Document `from __future__ import annotations`
* Provide plumbing and tests for `from __future__ import annotations`
* Implement unparsing the AST back to string form

This is required for PEP 563 and as such only implements a part of the
unparsing process that covers expressions.
2018-01-26 08:20:18 -08:00
bennorth d7773d92bd bpo-18533: Avoid RecursionError from repr() of recursive dictview (#4823)
dictview_repr(): Use a Py_ReprEnter() / Py_ReprLeave() pair to check
for recursion, and produce "..." if so.

test_recursive_repr(): Check for the string rather than a
RecursionError.  (Test cannot be any tighter as contents are
implementation-dependent.)

test_deeply_nested_repr(): Add new test, replacing the original
test_recursive_repr().  It checks that a RecursionError is raised in
the case of a non-recursive but deeply nested structure.  (Very
similar to what test_repr_deep() in test/test_dict.py does for a
normal dict.)

OrderedDictTests: Add new test case, to test behavior on OrderedDict
instances containing their own values() or items().
2018-01-26 07:46:01 -08:00
Yury Selivanov 4112c5b97d
bpo-32662: Try making test_asyncio.test_server more reliable (#5338) 2018-01-26 01:30:57 -05:00
mwidjaja 863b1e4d0e bpo-29237: Create enum for pstats sorting options (GH-5103) 2018-01-25 20:49:56 -08:00
INADA Naoki 4666ec597c
bpo-32596: Make lazy-load portable (GH-5316)
Global variables should not used as import target.
Use temporary variable instead.
2018-01-26 10:53:31 +09:00
Bo Bayles 2fc98ae115 bpo-32304: Fix distutils upload for sdists ending with \x0d (GH-5264)
Patch by Bo Bayles.
2018-01-25 19:02:03 -05:00
José Melero Fernández c47dacb690 bpo-32574: Fix leaks in asyncio.Queue.put() and .get() (#5208) 2018-01-25 18:45:43 -05:00
Yury Selivanov c9070d03f5
bpo-32662: Implement Server.start_serving() and Server.serve_forever() (#5312)
* bpo-32662: Implement Server.start_serving() and Server.serve_forever()

New methods:

* Server.start_serving(),
* Server.serve_forever(), and
* Server.is_serving().

Add 'start_serving' keyword parameter to loop.create_server() and
loop.create_unix_server().
2018-01-25 18:08:09 -05:00
Ilya Kulakov 1aa094f740 bpo-29302: Implement contextlib.AsyncExitStack. (#4790) 2018-01-25 15:51:18 -05:00
Victor Stinner b31206a223
bpo-32667: Fix tests when $PATH contains a file (#5322)
Some tests failed when the PATH environment variable contained a path
to an existing file. Fix tests to ignore also NotADirectoryError, not
only FileNotFoundError and PermissionError.
2018-01-25 19:06:05 +01:00
INADA Naoki 2812d3d992
bpo-32360: Remove OrderedDict usage from json.tool (GH-5315)
`object_pairs_hook=OrderedDict` idiom is deprecated.
2018-01-25 19:52:58 +09:00
Victor Stinner 2b822a0bb1
bpo-32652: Defer pymain_set_global_config() call (#5303)
In Py_Main(), don't call pymain_set_global_config() early: only call
it when the whole configuration has been read.

Add an unit test to prevent future regression.
2018-01-25 09:18:36 +01:00
Andrew Svetlov fe133aad52
bpo-32391: Implement StreamWriter.wait_closed() (#5281) 2018-01-25 00:30:30 +02:00
Paul Ganssle 04af5b1ba9 bpo-10381: Add timezone to datetime C API (#5032)
* Add timezone to datetime C API

* Add documentation for timezone C API macros

* Add dedicated tests for datetime type check macros

* Remove superfluous C API test

* Drop support for TimeZoneType in datetime C API

* Expose UTC singleton to the datetime C API

* Update datetime C-API documentation to include links

* Add reference count information for timezone constructors
2018-01-24 17:29:30 -05:00
Bernhard M. Wiedemann ccbe5818af bpo-29708: Setting SOURCE_DATE_EPOCH forces hash-based .pyc files (GH-5200)
To support reproducible builds, the setting of of SOURCE_DATE_EPOCH triggers the py_compile module -- and by extension, compileall -- to forcibly compile with hash-based .pyc files. This eliminates the possibility of timestamp-based .pyc files which vary between builds.
2018-01-24 13:26:18 -08:00
Barry Warsaw 6f6eb35f9b
bpo-32248 - Implement `ResourceReader` and `get_resource_reader()` for zipimport (#5248) 2018-01-24 15:36:21 -05:00
Victor Stinner 789e359f51 bpo-32636: Fix two bugs in test_asyncio (#5302) 2018-01-24 15:15:14 -05:00
Nathaniel J. Smith fb5a7ad421 bpo-32636: Fix @asyncio.coroutine debug mode bug exposed by gh-5250 (#5291) 2018-01-24 15:14:33 -05:00
Andrew Svetlov 0a5e71b4c7
bpo-32410: Improve sock_sendfile tests (#5294)
* Rename sock_sendfile test methods
* Make sock_sendfile tests more stable
2018-01-24 21:40:35 +02:00
Yury Selivanov 22feeb88b4
bpo-32643: Drop support for a few private Task and Future APIs. (#5293)
Specifically, it's not possible to subclass Task/Future classes
and override the following methods:

* Future._schedule_callbacks
* Task._step
* Task._wakeup
2018-01-24 11:31:01 -05:00
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) 018e1b7aad bpo-32360: unittest.util: Use Counter instead of custom count function (GH-4994) 2018-01-24 16:49:58 +09:00
Bo Bayles 6b273f7f40 bpo-32502: Discard 64-bit (and other invalid) hardware addresses (#5254) 2018-01-23 20:11:44 -05:00
Xiang Zhang 370d04d1dc
bpo-32618: Fix test_mutatingdecodehandler not testing test.mutating (#5269)
* bpo-32618: Fix test_mutatingdecodehandler not testing test.mutating

It should test both test.replacing and test.mutating instead of test test.replacing twice.
2018-01-23 22:50:50 +08:00
Nathaniel J. Smith 6934831e43 bpo-32633: Fix some warnings in test_asyncio.test_tasks (#5280) 2018-01-23 11:09:31 +02:00
Yury Selivanov f23746a934
bpo-32436: Implement PEP 567 (#5027) 2018-01-22 19:11:18 -05:00
Victor Stinner 13ff24582c
bpo-32593: Drop FreeBSD 9 and older support (#5232)
Drop support of FreeBSD 9 and older.
2018-01-22 18:32:50 +01:00
Yury Selivanov b0a7a037b8
bpo-31179: Make dict.copy() up to 5.5 times faster. (#3067) 2018-01-22 11:54:41 -05:00
Ethan Furman a4b1bb4801
bpo-31801: Enum: add _ignore_ as class option (#5237)
* bpo-31801:  Enum:  add _ignore_ as class option

_ignore_ is a list, or white-space seperated str, of names that will not
be candidates for members; these names, and _ignore_ itself, are removed
from the final class.

* bpo-31801:  Enum:  add documentation for _ignore_

* bpo-31801: Enum: remove trailing whitespace

* bpo-31801: Enum: fix bulleted list format

* bpo-31801: add version added for _ignore_
2018-01-22 07:56:37 -08:00
INADA Naoki 579e0b80b9
urllib.request: Remove unused import (GH-5268) 2018-01-22 16:45:31 +09:00
Yury Selivanov a4afcdfa55
bpo-32314: Fix asyncio.run() to cancel runinng tasks on shutdown (#5262) 2018-01-21 14:56:59 -05:00
Nathaniel J. Smith fc2f407829 bpo-32591: Add native coroutine origin tracking (#5250)
* Add coro.cr_origin and sys.set_coroutine_origin_tracking_depth
* Use coroutine origin information in the unawaited coroutine warning
* Stop using set_coroutine_wrapper in asyncio debug mode
* In BaseEventLoop.set_debug, enable debugging in the correct thread
2018-01-21 09:44:07 -05:00
Serhiy Storchaka 1211c9a989
bpo-32503: Avoid creating too small frames in pickles. (#5127) 2018-01-20 16:42:44 +02:00
Christian Heimes bd5c7d238c
bpo-32602: Test ECDSA certs (#5247)
Add test certs and test for ECDSA cert and EC/RSA dual mode.

I'm also adding certs for IDNA 2003/2008 tests and simplify some test
data handling.

Signed-off-by: Christian Heimes <christian@python.org>
2018-01-20 15:16:30 +01:00
Ivan Levkivskyi d911e40e78
bpo-32226: PEP 560: improve typing module (#4906)
This PR re-designs the internal typing API using the new PEP 560 features.
However, there are only few minor changes in the public API.
2018-01-20 11:23:59 +00:00
Sanyam Khurana d57f26c753 bpo-32028: Fix suggestions for indented print statements (GH-4688)
The suggested replacement for print statements previously failed to account
for leading whitespace and hence could end up including unwanted text in
the proposed call to the print builtin.

Patch by Sanyam Khurana.
2018-01-20 13:12:22 +10:00
INADA Naoki 6690bb9f17
bpo-32596: Lazy import concurrent.futures.process and thread (GH-5241) 2018-01-20 09:54:42 +09:00
Andrew Svetlov 7464e87a65
bpo-32410: Make SendfileNotAvailableError exception public (#5243) 2018-01-19 20:04:29 +02:00
Steve Dower 2507e29a9e
bpo-32588: Move _findvs into its own module and add missing _queue module to installer (#5227) 2018-01-19 09:09:36 +11:00
Antoine Pitrou ab74504346
bpo-32576: use queue.SimpleQueue in critical places (#5216)
Where a queue may be invoked from a weakref callback, we need
to use the reentrant SimpleQueue.
2018-01-18 10:38:03 +01:00
Gregory P. Smith 3941499d6c
Use assertCountEqual instead of assertEqual. (#5223)
This test doesn't care about order, the underlying filesystem APIs do not
guarantee directory listings on subsequent calls will be in the same order.
2018-01-17 14:57:57 -08:00
Victor Stinner 7d91c02504
pythoninfo: add time.time and datetime.datetime.now (#5214) 2018-01-17 16:35:45 +01:00
Victor Stinner 3a0cf93179
bpo-32248: Fix test_importlib.test_open() (#5213)
Use the binary.file instead of utf-8.file to avoid issues with
Unix newlines vs Windows newlines.
2018-01-17 15:21:50 +01:00
Paul Ganssle 9f1b7b93f5 bpo-32403: Faster date and datetime constructors (#4993)
* Add tests for date subclass alternate constructors

* Switch over alternate date constructors to fast path

* Switch datetime constructors to fastpath, fix bpo-32404

* Add fast path for datetime in date subclass constructor

* Set fold in constructor in datetime.combine

* Add news entries.
2018-01-16 13:06:31 -05:00
Andrew Svetlov 6b5a27975a
bpo-32410: Implement loop.sock_sendfile() (#4976) 2018-01-16 19:59:34 +02:00
Victor Stinner c495e799ed
Skip test_readline.test_nonascii() on C locale (#5203)
bpo-29240: On FreeBSD, if the LC_CTYPE locale is "C" or "POSIX",
writing and reading non-ASCII bytes into/from a TTY works,
but readline or ncurses ignores non-ASCII bytes on read.
2018-01-16 17:34:34 +01:00
Antoine Pitrou 94e1696d04
bpo-14976: Reentrant simple queue (#3346)
Add a queue.SimpleQueue class, an unbounded FIFO queue with a reentrant C implementation of put().
2018-01-16 00:27:16 +01:00
Barry Warsaw 5ec0feeeec
Implement the get_resource_reader() API for file system imports (#5168) 2018-01-15 15:07:11 -08:00
Yury Selivanov 21102f0dc2
Make asyncio tests run when there's no SSL module (#5196) 2018-01-15 17:56:32 -05:00
Raymond Hettinger d37258dd2e
Add itertools recipe for directly finding the n-th combination (#5161) 2018-01-13 10:35:40 -08:00
Brett Cannon bca42186b6
bpo-32248: Introduce the concept of Loader.get_resource_reader() (GH-5108) 2018-01-12 15:08:59 -08:00
Serhiy Storchaka 5b76bdba07
bpo-31993: Do not use memoryview when pickle large strings. (#5154)
PyMemoryView_FromMemory() created a memoryview referring to
the internal data of the string.  When the string is destroyed
the memoryview become referring to a freed memory.
2018-01-13 00:28:31 +02:00
yahya-abou-imran ae12f5d4c9 bpo-32473: Improve ABCMeta._dump_registry() readability (GH-5091) 2018-01-12 18:18:44 +09:00
Raymond Hettinger 05565ed27e
OrderedDict import is no longer needed (#4890) 2018-01-11 22:20:33 -08:00
Raymond Hettinger 02556fbade
bpo-32467: Let collections.abc.ValuesView inherit from Collection (#5152) 2018-01-11 21:53:49 -08:00