Commit Graph

41978 Commits

Author SHA1 Message Date
Serhiy Storchaka 753bca3934 bpo-27945: Fixed various segfaults with dict. (#1657)
Based on patches by Duane Griffin and Tim Mitchell.
2017-05-20 12:30:02 +03:00
Serhiy Storchaka d896985bb2 bpo-25794: Fix `type.__setattr__()` for non-interned attribute names. (#1652)
Based on patch by Eryk Sun.
2017-05-20 08:48:06 +03:00
delirious-lettuce 3378b2062c Fix typos in multiple `.rst` files (#1668) 2017-05-19 23:37:57 +03:00
remitamine a632d00a1c Remove duplicate line in Lib/http/client.py (#1665) 2017-05-19 15:28:35 +03:00
Victor Stinner fcdd9b6b7e bpo-27103: regrtest disables -W if -R is used (#1651)
Workaround for a regrtest bug.
2017-05-18 13:03:24 -07:00
Jon Dufresne 3972628de3 bpo-30296 Remove unnecessary tuples, lists, sets, and dicts (#1489)
* Replaced list(<generator expression>) with list comprehension
* Replaced dict(<generator expression>) with dict comprehension
* Replaced set(<list literal>) with set literal
* Replaced builtin func(<list comprehension>) with func(<generator
  expression>) when supported (e.g. any(), all(), tuple(), min(), &
  max())
2017-05-18 07:35:54 -07:00
Senthil Kumaran 906f5330b9 bpo-29976: urllib.parse clarify '' in scheme values. (GH-984) 2017-05-17 21:48:59 -07:00
terryjreedy 295304d412 IDLE test_textview: add comments and test, increase coverage to 100% (#1641) 2017-05-17 22:59:46 -04:00
Louie Lu ba365da9ce bpo-30303: IDLE: Add _utest argument to textview (#1499) 2017-05-17 17:51:31 -04:00
Nathaniel J. Smith ab4413a7e9 bpo-30039: Don't run signal handlers while resuming a yield from stack (#1081)
If we have a chain of generators/coroutines that are 'yield from'ing
each other, then resuming the stack works like:

- call send() on the outermost generator
- this enters _PyEval_EvalFrameDefault, which re-executes the
  YIELD_FROM opcode
- which calls send() on the next generator
- which enters _PyEval_EvalFrameDefault, which re-executes the
  YIELD_FROM opcode
- ...etc.

However, every time we enter _PyEval_EvalFrameDefault, the first thing
we do is to check for pending signals, and if there are any then we
run the signal handler. And if it raises an exception, then we
immediately propagate that exception *instead* of starting to execute
bytecode. This means that e.g. a SIGINT at the wrong moment can "break
the chain" – it can be raised in the middle of our yield from chain,
with the bottom part of the stack abandoned for the garbage collector.

The fix is pretty simple: there's already a special case in
_PyEval_EvalFrameEx where it skips running signal handlers if the next
opcode is SETUP_FINALLY. (I don't see how this accomplishes anything
useful, but that's another story.) If we extend this check to also
skip running signal handlers when the next opcode is YIELD_FROM, then
that closes the hole – now the exception can only be raised at the
innermost stack frame.

This shouldn't have any performance implications, because the opcode
check happens inside the "slow path" after we've already determined
that there's a pending signal or something similar for us to process;
the vast majority of the time this isn't true and the new check
doesn't run at all.
2017-05-17 13:33:23 -07:00
Dong-hee Na 378d70642a bpo-30149: Fix partialmethod without explicit self parameter (#1308) 2017-05-17 12:00:51 -07:00
Victor Stinner f8d05b3a24 bpo-30387: Fix warning in test_threading (#1634)
test_is_alive_after_fork() now joins directly the thread to avoid the
following warning added by bpo-30357:

Warning -- threading_cleanup() failed to cleanup 0 threads
after 2 sec (count: 0, dangling: 21)

Use also a different exit code to catch generic exit code 1.
2017-05-17 11:58:50 -07:00
Xiang Zhang 6f75bc003a bpo-30301: Fix AttributeError when using SimpleQueue.empty() (#1601)
Under  *spawn* and *forkserver* start methods, SimpleQueue.empty() could
raise AttributeError due to not setting _poll in __setstate__.
2017-05-17 21:04:00 +08:00
csabella 0774e79b93 bpo-30211: bdb: add docstrings (#1350) 2017-05-16 18:28:02 -04:00
Serhiy Storchaka c7ac7280c3 bpo-30375: Correct the stacklevel of regex compiling warnings. (#1595)
Warnings emitted when compile a regular expression now always point
to the line in the user code.  Previously they could point into inners
of the re module if emitted from inside of groups or conditionals.
2017-05-16 15:16:15 +03:00
Senthil Kumaran 1bd7d299bd Remove unused variable in test_urllibnet. (#1598) 2017-05-15 23:08:07 -07:00
Victor Stinner 7d6320ba47 bpo-30339: test_multiprocessing_main_handling timeout (#1593)
test_multiprocessing_main_handling: increase the test_source timeout
from 10 seconds to 60 seconds, since the test fails randomly on busy
buildbots.
2017-05-15 18:14:42 +02:00
Victor Stinner 79ef7f8e88 bpo-30357: test_thread now uses threading_cleanup() (#1592)
test_thread: setUp() now uses support.threading_setup() and
support.threading_cleanup() to wait until threads complete to avoid
random side effects on following tests.

Co-Authored-By:  Grzegorz Grzywacz <grzegorz.grzywacz@nazwa.pl>
2017-05-15 17:55:32 +02:00
Victor Stinner 83a2c28798 bpo-30329: Catch Windows error 10022 on shutdown() (#1538)
Catch the Windows socket WSAEINVAL error (code 10022) in imaplib and
poplib on shutdown(SHUT_RDWR): An invalid operation was attempted

This error occurs sometimes on SSL connections.
2017-05-15 17:33:45 +02:00
Serhiy Storchaka edef358ed6 bpo-29196: Removed old-deprecated classes Plist, Dict and _InternalDict (#488)
in the plistlib module.  Dict values in the result of functions
readPlist() and readPlistFromBytes() are now exact dicts.
2017-05-15 13:21:31 +03:00
Victor Stinner 89a1c93f04 bpo-9850: Deprecate the macpath module (#1540)
Co-Authored-By: Chi Hsuan Yen <yan12125@gmail.com>.
2017-05-15 11:01:21 +02:00
Xiang Zhang 7c278a5eeb bpo-30110: fix resource leak in test_asyncio.test_events (#1413) 2017-05-15 11:56:40 +08:00
Zachary Ware d48214f22c bpo-29763: Clean up _pth tests (GH-954) 2017-05-14 15:49:46 -05:00
Serhiy Storchaka 4ab6abfca4 bpo-30299: Display a bytecode when compile a regex in debug mode. (#1491)
`re.compile(..., re.DEBUG)` now displays the compiled bytecode in
human readable form.
2017-05-14 09:05:13 +03:00
Serhiy Storchaka 821a9d146b bpo-30340: Enhanced regular expressions optimization. (#1542)
This increased the performance of matching some patterns up to 25 times.
2017-05-14 08:32:33 +03:00
csabella f111fd2e65 bpo-30308: Code coverage for argument in random.shuffle (#1504)
* bpo-30308: Code coverage for argument in random.shuffle

* bpo-30308: Code coverage for argument in random.shuffle

* bpo-30308: Code coverage for argument in random.shuffle
2017-05-11 08:19:35 -07:00
INADA Naoki 991adca012 bpo-30048: asyncio: fix Task.cancel() was ignored. (GH-1097)
when there are no more `await` or `yield (from)` before return in coroutine,
cancel was ignored.

example:

    async def coro():
        asyncio.Task.current_task().cancel()
        return 42
    ...
    res = await coro()  # should raise CancelledError
2017-05-11 21:18:38 +09:00
Giampaolo Rodola c4750959ac #30190: fix invalid escape sequence warnings (#1534) 2017-05-10 20:13:20 +02:00
Serhiy Storchaka 305ccbe27e bpo-30298: Weaken the condition of deprecation warnings for inline modifiers. (#1490)
Now allowed several subsequential inline modifiers at the start of the
pattern (e.g. '(?i)(?s)...').  In verbose mode whitespaces and comments
now are allowed before and between inline modifiers (e.g.
'(?x) (?i) (?s)...').
2017-05-10 06:05:20 +03:00
Victor Stinner 211a392cc1 bpo-30320: test_eintr now uses pthread_sigmask() (#1523)
Rewrite sigwaitinfo() and sigtimedwait() unit tests for EINTR using
pthread_sigmask() to fix a race condition between the child and the
parent process.

Remove the pipe which was used as a weak workaround against the race
condition.

sigtimedwait() is now tested with a child process sending a signal
instead of testing the timeout feature which is more unstable
(especially regarding to clock resolution depending on the platform).
2017-05-10 02:37:42 +02:00
Serhiy Storchaka 6d336a0279 bpo-30285: Optimize case-insensitive matching and searching (#1482)
of regular expressions.
2017-05-09 23:37:14 +03:00
Serhiy Storchaka f93234bb8a bpo-30024: Circular imports involving absolute imports with binding (#1264)
a submodule to a name are now supported.
2017-05-09 22:31:05 +03:00
Jeremy Kloth dbdea629e2 bpo-30273: update distutils.sysconfig for venv's created from Python (#1515)
compiled out-of-tree (builddir != srcdir). (see also bpo-15366)
2017-05-09 17:24:13 +02:00
Victor Stinner 74683fc624 bpo-30258: regrtest: Fix run_tests_multiprocess() (#1479)
If the child process exited with a non-zero code, don't strip the
last line of stdout anymore.

Add also a sanity check in accumulate_result().
2017-05-09 11:34:01 +02:00
Xiang Zhang 9da408d15b bpo-29990: Fix range checking in GB18030 decoder (#1495)
When decoding a 4-byte GB18030 sequence, the first and third byte cannot exceed 0xFE.
2017-05-09 11:38:32 +08:00
Pierre Quentel cc3fa204d3 bpo-29979: Rewrite cgi.parse_multipart to make it consistent with FieldStorage (#991) 2017-05-08 05:08:34 -07:00
Serhiy Storchaka 3763ea865c Revert bpo-26293 for zipfile breakage. See also bpo-29094. (#1484) 2017-05-06 14:46:01 +03:00
Jelle Zijlstra a12df7b7d4 bpo-30218: support path-like objects in shutil.unpack_archive() (GH-1367)
Thanks to Jelle Zijlstra for the patch.
2017-05-05 14:27:12 -07:00
Victor Stinner ef9c0e732f bpo-30264: ExpatParser closes the source on error (#1451)
ExpatParser.parse() of xml.sax.xmlreader now always closes the
source: close the file object or the urllib object if source is a
string (not an open file-like object). The change fixes a
ResourceWarning on parsing error.

Add test_parse_close_source() unit test.
2017-05-05 09:46:47 +02:00
Serhiy Storchaka 7186cc29be bpo-30277: Replace _sre.getlower() with _sre.ascii_tolower() and _sre.unicode_tolower(). (#1468) 2017-05-05 10:42:46 +03:00
Serhiy Storchaka 898ff03e1e bpo-30215: Make re.compile() locale agnostic. (#1361)
Compiled regular expression objects with the re.LOCALE flag no longer
depend on the locale at compile time.  Only the locale at matching
time affects the result of matching.
2017-05-05 08:53:40 +03:00
Victor Stinner b109a1d336 bpo-30273: Update sysconfig (#1464)
The AST_H_DIR variable was removed from Makefile.pre.in by the commit
a5c62a8e9f (bpo-23404).

AST_H_DIR was hardcoded to "Include", so replace the removed variable
by its content.

Remove also ASDLGEN variable from sysconfig example since this
variable was also removed.
2017-05-04 23:29:09 +02:00
Antoine Pitrou 6dd4d734ed bpo-30185: avoid KeyboardInterrupt tracebacks in forkserver (#1319)
* bpo-30185: avoid KeyboardInterrupt tracebacks in forkserver

* Tweak comment
2017-05-04 16:44:53 +02:00
Victor Stinner 3d0056842c bpo-30263: regrtest: log system load (#1452)
* bpo-30263: regrtest: log system load

* regrtest: log the number of CPUs

Log the number of CPUs in the header. --verbose now imply --header.
2017-05-04 15:21:12 +02:00
Serhiy Storchaka 7e4db2f253 bpo-30166: Import command-line parsing modules only when needed. (#1293) 2017-05-04 08:17:47 +03:00
Serhiy Storchaka 5f161fd86d bpo-30184: Add tests for invalid use of PyArg_ParseTupleAndKeywords. (#1316) 2017-05-04 00:03:23 +03:00
Xiang Zhang 13f1f423fa bpo-30103: Allow Uuencode in Python using backtick as zero instead of space (#1326) 2017-05-03 11:16:21 +08:00
Antoine Pitrou 0360a9d015 Fix tests: getsockname() can return None on OS X on unbound sockets (#1400) 2017-05-02 23:48:26 +02:00
Jim Fasarakis-Hilliard 094909ad69 Remove outdated tests in test_isinstance (GH-1393)
There is no need to test for new-style classes versus classic classes in Python 3.
2017-05-02 10:17:18 -07:00
Ivan Levkivskyi f06e0218ef bpo-28556: Routine updates to typing (#1366)
- Add NoReturn type
- Use WrapperDescriptorType (original PR by Jim Fasarakis-Hilliard)
- Minor bug-fixes
2017-05-02 10:14:07 -07:00
Antoine Pitrou 495b5021e7 bpo-30205: Fix getsockname() for unbound AF_UNIX sockets on Linux (#1370)
* bpo-30205: Fix getsockname() for unbound AF_UNIX sockets on Linux

* Add NEWS entry
2017-05-02 17:20:00 +02:00
Victor Stinner 1dae7450c6 bpo-30199: test_ssl closes all asyncore channels (#1381)
AsyncoreEchoServer of test_ssl now calls
asyncore.close_all(ignore_all=True) to ensure that
asyncore.socket_map is cleared once the test completes, even if
ConnectionHandler was not correctly unregistered.

Fix the following warning:

Warning -- asyncore.socket_map was modified by test_ssl
  Before: {}
  After:  {6: <test.test_ssl.AsyncoreEchoServer.EchoServer.ConnectionHandler>}
2017-05-02 13:12:02 +02:00
Victor Stinner 92fd6c9ef5 bpo-30132: distutils BuildExtTestCase use temp_cwd (#1380)
BuildExtTestCase of test_distutils now uses support.temp_cwd() in
setUp() to remove files created in the current working in all
BuildExtTestCase unit tests, not only test_build_ext().

Move also tearDown() just after setUp().
2017-05-02 13:11:50 +02:00
Giampaolo Rodola 5d7a8d0c13 bpo-30190: improved error msg for assertAlmostEqual(delta=...) (#1331)
* #30190 / unittest / assertAlmostEqual(delta=...) / error msg: show the difference between the 2 numbers in case of failure

* safe_repr() diff

* also show difference when passing 'places' argument

* refactoring

* update Misc/NEWS
2017-05-01 18:18:56 +02:00
Jelle Zijlstra 2e624690bd bpo-29679: Implement @contextlib.asynccontextmanager (#360) 2017-04-30 18:25:58 -07:00
Serhiy Storchaka 3cc8259b71 bpo-30158: Fix deprecation warnings in test_importlib introduced by bpo-29576. (#1285) 2017-04-29 07:06:49 +03:00
Serhiy Storchaka d1a1def7bf bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. (#1341)
* bpo-30197: Enhance functions swap_attr() and swap_item() in test.support.

They now work when delete replaced attribute or item inside the with
statement.  The old value of the attribute or item (or None if it doesn't
exist) now will be assigned to the target of the "as" clause, if there is
one.

* Update docstrings.
2017-04-28 18:17:26 +02:00
Jelle Zijlstra 5a4e3d8f9c bpo-30174: Remove duplicate definition from pickletools (#1301)
There were two almost identical definitions of bytes1.
2017-04-27 19:05:26 +03:00
Victor Stinner 5bccca58b9 bpo-30175: Skip client cert tests of test_imaplib (#1320)
* bpo-30175: Skip client cert tests of test_imaplib

The IMAP server cyrus.andrew.cmu.edu doesn't accept our randomly
generated client x509 certificate anymore.

* bpo-30188: Catch EOFError in NetworkedNNTPTests

test_nntplib fails randomly with EOFError in
NetworkedNNTPTests.setUpClass(). Catch EOFError to skip tests in that
case.
2017-04-27 17:30:13 +02:00
Victor Stinner 8ca2f2faef bpo-30131: test_logging now joins queue threads (#1298)
QueueListenerTest of test_logging now closes the multiprocessing
Queue and joins its thread to prevent leaking dangling threads to
following tests.

Add also @support.reap_threads to detect earlier if a test leaks
threads (and try to "cleanup" these threads).
2017-04-26 15:56:25 +02:00
Victor Stinner d819ad9832 bpo-30107: Make SuppressCrashReport quiet on macOS (#1279)
On macOS, SuppressCrashReport now redirects /usr/bin/defaults command
stderr into a pipe to not pollute stderr. It fixes a
test_io.test_daemon_threads_shutdown_stderr_deadlock() failure when
the CrashReporter domain doesn't exists. Message logged into stderr:

2017-04-24 16:57:21.432 defaults[41046:2462851]
The domain/default pair of (com.apple.CrashReporter, DialogType) does not exist
2017-04-26 00:55:08 +02:00
Jim Fasarakis-Hilliard 08c16016e2 bpo:29950: Rename SlotWrapperType to WrapperDescriptorType (GH-926) 2017-04-25 21:26:36 +03:00
INADA Naoki 3e2ad8ec61 bpo-29617: Remove Python 3.3 support from asyncio (GH-232) 2017-04-25 10:57:18 +09:00
Victor Stinner f6448e5d65 bpo-30132: distutils test_build_ext() uses temp_cwd() (#1278)
test_build_ext() of test_distutils now uses support.temp_cwd() to
prevent the creation of a pdb file in the current working directory
on Windows.
2017-04-25 02:11:09 +02:00
Victor Stinner 4bcfa3a236 bpo-30131: Cleanup threads in test_logging (#1275)
* Use @support.reap_threads on unit tests creating threads
* Call TestCase.fail() on thread.join(timeout) failure
2017-04-25 00:41:36 +02:00
Nate fcfe80ec25 bpo-29822: Make inspect.isabstract() work during __init_subclass__. (#678)
At the time when an abstract base class' __init_subclass__ runs,
ABCMeta.__new__ has not yet finished running, so in the presence of
__init_subclass__, inspect.isabstract() can no longer depend only on
TPFLAGS_IS_ABSTRACT.
2017-04-24 20:06:15 +03:00
Serhiy Storchaka 2e576f5aec bpo-30144: Import collections ABC from collections.abc rather than collections. (#1263) 2017-04-24 09:05:00 +03:00
bladebryan 9616a82e78 bpo-29960 _random.Random corrupted on exception in setstate(). (#1019) 2017-04-22 09:10:46 +03:00
Victor Stinner a36e939aeb bpo-30125: disable faulthandler in ctypes test_SEH (#1237)
Disable faulthandler to run test_SEH() of test_ctypes to prevent the
following log with a traceback:

    Windows fatal exception: access violation

Add support.disable_faulthandler() context manager.
2017-04-22 00:31:13 +02:00
Charles Renwick ae5b3260dd bpo-30098: Clarify that run_coroutine_threadsafe expects asyncio.Future (GH-1170) 2017-04-21 13:49:48 -07:00
Victor Stinner 46c2b81026 bpo-30125: Fix faulthandler.disable() on Windows (#1240)
* bpo-30125: Cleanup faulthandler.c

* Use size_t type for iterators
* Add { ... }

* bpo-30125: Fix faulthandler.disable() on Windows

On Windows, faulthandler.disable() now removes the exception handler
installed by faulthandler.enable().
2017-04-21 18:06:13 +02:00
Victor Stinner 2a1aed04b0 bpo-30107: don't dump core on expected test_io crash (#1235)
test_io has two unit tests which trigger a deadlock:

* test_daemon_threads_shutdown_stdout_deadlock()
* test_daemon_threads_shutdown_stderr_deadlock()

These tests call Py_FatalError() if the expected bug is triggered
which calls abort(). Use test.support.SuppressCrashReport to prevent
the creation on a core dump, to fix the warning:

Warning -- files was modified by test_io
  Before: []
  After:  ['python.core']
2017-04-21 17:59:23 +02:00
Victor Stinner a2c877c398 bpo-30106: Fix test_asyncore.test_quick_connect() (#1234)
test_quick_connect() runs a thread up to 50 seconds, whereas the
socket is connected in 0.2 second and then the thread is expected to
end in less than 3 second. On Linux, the thread ends quickly because
select() seems to always return quickly. On FreeBSD, sometimes
select() fails with timeout and so the thread runs much longer than
expected.

Fix the thread timeout to fix a race condition in the test.
2017-04-21 13:51:53 +02:00
Serhiy Storchaka 40db90c1ce bpo-29802: Fix reference counting in module-level struct functions (#1213)
when pass arguments of wrong type.
2017-04-20 21:19:31 +03:00
Victor Stinner d20324a7fa support.threading_cleanup() log a warning on fail (#1195)
The @reap_threads decorator and the threading_cleanup() function of
test.support now log a warning if they fail to clenaup threads.

Fix also the usage of support.threading_cleanup() in
test_urllib2_localnet.

The log may help to debug such other warning seen on the AMD64
FreeBSD CURRENT Non-Debug 3.x buildbot:

Warning -- threading._dangling was modified by test_logging
2017-04-20 13:40:08 +02:00
Victor Stinner b85c136903 bpo-30108: Restore sys.path in test_site (#1197)
Add setUpModule() and tearDownModule() functions to test_site to
save/restore sys.path at the module level to prevent warning if the
user site directory is created, since site.addsitedir() modifies
sys.path.
2017-04-20 13:39:39 +02:00
Dong-hee Na b4dc6af7a7 bpo-12414: Update code_sizeof() to take in account co_extra memory. (#1168) 2017-04-20 10:31:17 +03:00
Mariatta 58f3c9dc8f bpo-30109: Fix reindent.py (GH-1207)
Skip the file if it has bad encoding.
2017-04-19 22:59:20 -07:00
Louie Lu f7e62cf8ad bpo-30078: Add an example of passing a path to unittest (#1178) 2017-04-20 06:46:59 +03:00
Victor Stinner 11470b6dcd bpo-30106: Fix tearDown() of test_asyncore (#1194)
Call asyncore.close_all() with ignore_all=True in the tearDown()
method of the test_asyncore base test case. It should prevent keeping
alive sockets in asyncore.socket_map if close() fails with an
unexpected error.

Revert also an unwanted change of my previous commit: remove name
parameter of Thread in test_quick_connect().
2017-04-20 02:55:39 +02:00
Victor Stinner d13d54748d bpo-29887: test_normalization handles PermissionError (#1196)
Skip test_normalization.test_main() if download raises a permission
error.
2017-04-20 02:39:59 +02:00
Victor Stinner ec4b17239d regrtest: always show before/after of modified env (#1192)
Buildbots don't run tests with -vv and so only log "xxx was modified
by test_xxx" which is not enough to debug such random issue. In many
cases, I'm unable to reproduce the warning and so unable to fix it.

Always logging the value before and value after should help to debug
such warning on buildbots.
2017-04-20 00:57:30 +02:00
Victor Stinner 7b9619ae24 Fix/optimize test_asyncore.test_quick_connect() (#1188)
Don't use addCleanup() in test_quick_connect() because it keeps the
Thread object alive and so @reap_threads fails on its timeout of 1
second. "./python -m test -v test_asyncore -m test_quick_connect"
now takes 185 ms, instead of 11 seconds.

Other minor changes:

* Use "with sock:" to close the socket instead of
  try/finally: sock.close()
* Use self.skipTest() in test_quick_connect() to remove one
  indentation level and notice user that the test is specific to
  AF_INET and AF_INET6
2017-04-19 23:42:46 +02:00
Victor Stinner 1e62bf145b bpo-30030: Revert f50354ad (tempfile) (#1187)
Revert f50354adaaafebe95ad09d09b825804a686ea843: it introduced a
regression in test_threadedtempfile.
2017-04-19 22:59:51 +02:00
Serhiy Storchaka 66bffd1663 bpo-30065: Fixed arguments validation in _posixsubprocess.fork_exec(). (#1110) 2017-04-19 21:12:46 +03:00
Serhiy Storchaka a79f4c2195 bpo-30070: Fixed leaks and crashes in errors handling in the parser module. (#1131) 2017-04-19 21:09:21 +03:00
Serhiy Storchaka d90045f319 bpo-22352: Adjust widths in the output of dis.dis() for large line numbers and (#1153)
instruction offsets.

Add tests for widths of opcode names.
2017-04-19 20:36:31 +03:00
Serhiy Storchaka bf623ae884 bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() (#1096)
raised an error.

Replace them with using concrete types API that never fails if appropriate.
2017-04-19 20:03:52 +03:00
Victor Stinner c209b70d61 bpo-29925: Skip test_uuid1_safe() on OS X Tiger (#971) 2017-04-19 13:01:03 +02:00
cocoatomo 992ae6444c Fix minor typos (GH-1173) 2017-04-18 17:38:26 -07:00
Eric Appelt d6d344d833 bpo-29514: Check magic number for bugfix release (#54)
* bpo-29514: Check magic number for micro release

Add a dict importlib.util.EXPECTED_MAGIC_NUMBERS which
details the initial and expected pyc magic number for
each minor release. This gives a mechanism for users to
check if the magic number has changed within a release and
for a test to ensure procedure is followed if a change is
necessary.

Add a test to check the current MAGIC_NUMBER against the
expected number for the release if the current release is
at candidate or final level. On test failure, describe to
the developer the procedure for changing the magic number.

* Simplify magic number release test

Simplify the magic number release test by removing
EXPECTED_MAGIC_NUMBERS table and making the expected
magic number self-contained within the test.

BPO: 29514

* Improve magic number test execution and message

Improve the execution of the magic number test by
using skipUnless for alpha and beta releases, and
directly inheriting from unittest.TestCase rather than
using the machinery for the other tests. Also improve
the error message to explain the reason for caution in
changing the magic number.

BPO: 29514
2017-04-17 11:35:43 -07:00
Serhiy Storchaka 55fe1ae970 bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051) 2017-04-16 10:46:38 +03:00
Serhiy Storchaka fdbd01151d bpo-10076: Compiled regular expression and match objects now are copyable. (#1000) 2017-04-16 10:16:03 +03:00
Serhiy Storchaka baf9f29811 bpo-29839: Raise ValueError rather than OverflowError in len() for negative values. (#701) 2017-04-16 09:37:18 +03:00
Xiang Zhang 026435ce49 bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is present (#1130) 2017-04-15 12:47:28 +08:00
Jack McCracken ce040f6c1e Fix misplaced positional argument in OS X support library (#1134) 2017-04-14 15:28:55 +03:00
Antoine Pitrou 685cdb9acc Relax test timing (bpo-29861) to avoid sporadic failures (#1120) 2017-04-14 13:10:00 +02:00
Ryan Gonzalez f9f87f0934 bpo-11913: Add README.rst to the distutils standard READMEs list (#563) 2017-04-14 11:00:25 +02:00
Armin Rigo 22a594a004 bpo-29694: race condition in pathlib mkdir with flags parents=True (GH-1089) 2017-04-13 11:08:15 -07:00
Serhiy Storchaka 5908300e4b bpo-29995: re.escape() now escapes only special characters. (#1007) 2017-04-13 21:06:43 +03:00
Nevada Sanchez a6e395dffa bpo-29869: Allow underscores in numeric literals in lib2to3. (GH-1119)
* Allow underscores in numeric literals in lib2to3.
* Stricter literal parsing for Python 3.6 in lib2to3.pgen2.tokenize.
* Add test case for underscores in literals in Python 3.
2017-04-13 10:32:54 -07:00
Xiang Zhang a6902e662c bpo-26985: Add missing info of code object in inspect documentation (GH-1090) 2017-04-13 10:38:28 +08:00
Serhiy Storchaka 4c0d9ea995 bpo-30017: Allowed calling the close() method of the zip entry writer object (#1041)
multiple times.  Writing to closed zip entry writer object now always produce
a ValueError.
2017-04-12 16:03:23 +03:00
Alex Gaynor c7cc14a825 Remove two legacy constants which hopefully have no consumers (#1087)
The data contained in them is nonsensical
2017-04-11 22:41:42 -04:00
Serhiy Storchaka f50354adaa Reimplement tempfile._RandomNameSequence using a generator function. (#1075) 2017-04-11 22:45:59 +03:00
svelankar 00c75e9a45 bpo-29692: contextlib.contextmanager may incorrectly unchain RuntimeError (GH-949)
contextlib._GeneratorContextManager.__exit__ includes a special case to deal with
PEP 479 RuntimeErrors created when `StopIteration` is thrown into the context
manager body.

Previously this check was too permissive, and undid one level of chaining on *all*
RuntimeError instances, not just those that wrapped a StopIteration instance.
2017-04-11 19:11:13 +10:00
Senthil Kumaran 6fab78e902 Remove superfluous comment in urllib.error. (#1076) 2017-04-10 21:08:35 -07:00
Senthil Kumaran 6dfcc81f6b Remove OSError related comment in urllib.request. (#1070) 2017-04-09 19:49:34 -07:00
Aviv Palivoda 0e6cb2ea62 bpo-26187: Test that set_trace_callback() is not called multiple times (GH-461)
conn.set_trace_callback() shouldn't be called multiple times when the
schema is changing.

This has indirectly been fixed by using sqlite3_prepare_v2() in bpo-9303.
2017-04-09 12:11:59 +03:00
Michael Seifert 64c8f705c0 bpo-29951: Include function name for some error messages in `PyArg_ParseTuple*` (#916)
Also changed format specifier for function name from "%s" to "%.200s"
and exception messages should start with lowercase letter.
2017-04-09 10:47:12 +03:00
Senthil Kumaran a2a9ddd923 Remove invalid comment in urllib.request. (#1054) 2017-04-08 23:27:25 -07:00
Serhiy Storchaka b785396ab4 bpo-29998: Pickling and copying ImportError now preserves name and path (#1010)
attributes.
2017-04-08 09:55:07 +03:00
Serhiy Storchaka 205e00c5cf bpo-29914: Fix default implementations of __reduce__ and __reduce_ex__(). (#843)
object.__reduce__() no longer takes arguments, object.__reduce_ex__() now
requires one argument.
2017-04-08 09:52:59 +03:00
Serhiy Storchaka 150cd1916a bpo-29958: Minor improvements to zipfile and tarfile CLI. (#944) 2017-04-07 18:56:12 +03:00
Senthil Kumaran fd0cd07a5a Remove Invalid comment in test_urllib2.py (#1020) 2017-04-07 00:19:08 -07:00
Stuart Berg 93b4b47e3a bpo-28837: Fix lib2to3 handling of map/zip/filter calls when followed with a 'trailer', e.g. zip()[x] (#24) 2017-04-05 22:19:40 -07:00
Mark Dickinson a0ce375e10 bpo-29962: add math.remainder (#950)
* Implement math.remainder.

* Fix markup for arguments; use double spaces after period.

* Mark up function reference in what's new entry.

* Add comment explaining the calculation in the final branch.

* Fix out-of-order entry in whatsnew.

* Add comment explaining why it's good enough to compare m with c, in spite of possible rounding error.
2017-04-05 18:34:27 +01:00
Serhiy Storchaka 5affd23e6f bpo-29762: More use "raise from None". (#569)
This hides unwanted implementation details from tracebacks.
2017-04-05 09:37:24 +03:00
Senthil Kumaran 257b980b31 correct parse_qs and parse_qsl test case descriptions. (#968)
* correct parse_qs and parse_qsl test case descriptions.
2017-04-04 21:19:43 -07:00
Andrew Nester f78b119364 bpo-29649: Improve struct.pack_into() boundary error messages (#424) 2017-04-04 13:46:25 +03:00
Victor Stinner 5de85a1702 bpo-29972: Skip tests known to fail on AIX (#979)
* bpo-29972: Fix test_eintr on AIX

On AIX, sigtimedwait(0.2) sleeps 199.8 ms, whereas the test expects
200 ms or longer.

* bpo-29972: Skip some inet_pton() tests on AIX

Skip some inet_pton() tests of test_socket on AIX.

inet_pton() on AIX is less strict than on Linux and doesn't reject
some invalid IP addresses. The unit tests test more the libc than
Python itself.

* bpo-29972: Skip tests known to fail on AIX

* test_locale.test_strcoll_with_diacritic()
* test_locale.test_strxfrm_with_diacritic()
* test_strptime.test_week_of_year_and_day_of_week_calculation()
* test_tools.test_POT_Creation_Date()
2017-04-04 10:35:15 +02:00
Victor Stinner 9acc6a03f1 test_locale now ignores the DeprecationWarning (#977)
Don't fail anymore if test run with python3 -Werror.

Fix also deprecation message: add a space.
2017-04-03 18:09:55 +02:00
Pierre Quentel 351adda54b bpo-29654 : Support If-Modified-Since HTTP header (browser cache) (#298)
Return 304 response if file was not modified.
2017-04-02 13:26:12 +03:00
Senthil Kumaran efbd4ea65d Minor spell fix and formatting fixes in urllib tests. (#959) 2017-04-01 23:47:35 -07:00
Michael Selik 11fa3c7cd1 bpo-29957: change LBYL key lookup to dict.setdefault (#938)
* change LBYL key lookup to dict.setdefault

The ``results`` was constructed as a defaultdict and we could simply
delete the check ``if key not in results``. However, I think it's safer
to use dict.setdefault as I'm not sure whether the caller expects a
regular dict or defaultdict.

* add name to the acknowledgements file

* use defaultdict to make the key-lookup cleaner
2017-04-01 23:02:31 -07:00
Zachary Ware cd815edf01 Revert "bpo-29763: Use unittest cleanup in test_site (GH-841)" (GH-942)
This reverts commit b94d7fd4ef.
2017-04-01 01:29:31 -05:00
s-sanjay 7bd8d3e794 bpo-29931 fix __lt__ check in ipaddress.ip_interface for both v4 and v6. (#879)
the original logic was just comparing the network address
but this is wrong because if the network address is equal then
we need to compare the ip address for breaking the tie

add more ip_interface comparison tests
2017-04-01 09:09:53 +03:00
Senthil Kumaran 1f5425ff69 Add helpful explaination to test_password_manager tests. (#936)
Also uncomment and fix a path test.
2017-03-31 22:27:27 -07:00
Zachary Ware b94d7fd4ef bpo-29763: Use unittest cleanup in test_site (GH-841) 2017-04-01 00:18:23 -05:00
Serhiy Storchaka 314d6fca36 bpo-29953: Fix memory leaks in the replace() method of datetime and time (#927)
objects when pass out of bound fold argument.
2017-03-31 22:48:16 +03:00
Senthil Kumaran ed3dd1c02a Remove catching OSError in ftphandler test. Only URLError is raised in urllib.request module. (#918) 2017-03-30 22:43:05 -07:00
T. Wouters 5466d4af5f bpo-29942: Fix the use of recursion in itertools.chain.from_iterable. (#889)
Fix the use of recursion in itertools.chain.from_iterable. Using recursion
is unnecessary, and can easily cause stack overflows, especially when
building in low optimization modes or with Py_DEBUG enabled.
2017-03-30 09:58:35 -07:00
Serhiy Storchaka 06e522521c bpo-10030: Sped up reading encrypted ZIP files by 2 times. (#550) 2017-03-30 19:09:08 +03:00
Serhiy Storchaka 762ec97ea6 bpo-29204: Emit warnings for already deprecated ElementTree features. (#773)
Element.getiterator() and the html parameter of XMLParser() were
deprecated only in the documentation (since Python 3.2 and 3.4 correspondintly).
Now using them emits a deprecation warning.

* Don’t need check_warnings any more.
2017-03-30 18:12:06 +03:00
Victor Stinner 722a3af092 bpo-29887: Test normalization now fails if download fails (#905)
* test_normalization fails if download fails

bpo-29887. The test is still skipped if "-u urlfetch" option is not
passed to regrtest (python3 -m test -u urlfetch test_normalization).

* Fix ResourceWarning in test_normalization

bpo-29887: Fix ResourceWarning in test_normalization if tests are
interrupted by CTRL+c.
2017-03-30 17:06:53 +02:00
Serhiy Storchaka f15c4d374a bpo-20548: Use specific asserts in warnings and exceptions tests (#788) 2017-03-30 18:05:08 +03:00
Serhiy Storchaka 576def096e bpo-27863: Fixed multiple crashes in ElementTree. (#765) 2017-03-30 09:47:31 +03:00
Serhiy Storchaka 918403cfc3 bpo-29816: Shift operation now has less opportunity to raise OverflowError. (#680)
ValueError always is raised rather than OverflowError for negative counts.
Shifting zero with non-negative count always returns zero.
2017-03-30 09:47:07 +03:00
Serhiy Storchaka ea720fe7e9 bpo-25996: Added support of file descriptors in os.scandir() on Unix. (#502)
os.fwalk() is sped up by 2 times by using os.scandir().
2017-03-30 09:12:31 +03:00
Senthil Kumaran e6911a44f6 Remove an unrequired TODO in test_urllib2. (#897) 2017-03-29 23:02:29 -07:00
Xiang Zhang 794623bdb2 bpo-28699: fix abnormal behaviour of pools in multiprocessing.pool (GH-693)
an exception raised at the very first of an iterable would cause pools behave abnormally
(swallow the exception or hang)
2017-03-29 11:58:54 +08:00
Vajrasky Kok ec1f5df46e bpo-19791: Use functions from test support to check the symlink support. (GH-822) 2017-03-28 12:32:35 -07:00
Garvit Khatri 1cf93a76c2 bpo-10379: add 'monetary' to format_string, deprecate format
Add the 'monetary' parameter to format_string so that all
uses of format can be converted to format_string.  Adjust
the documentation accordingly, and add a deprecation
warning when format is used.
2017-03-28 11:43:38 -04:00
Victor Stinner bbd3cf8f1e Fix ref cycles in TestCase.assertRaises() (#193)
bpo-23890: unittest.TestCase.assertRaises() now manually breaks a
reference cycle to not keep objects alive longer than expected.
2017-03-28 00:56:28 +02:00
Jim Fasarakis-Hilliard d702c50049 bpo-29912: Remove redundant tests in list_tests that are found in seq_tests (GH-847) 2017-03-27 12:35:52 -07:00
Victor Stinner d6debb24e0 bpo-29919: Remove unused imports found by pyflakes (#137)
Make also minor PEP8 coding style fixes on modified imports.
2017-03-27 16:05:26 +02:00
Serhiy Storchaka 604e74c6be bpo-20552: Use specific asserts in bytes tests (#790) 2017-03-27 12:59:07 +02:00
Zachary Ware b8a7daf077 Minor test cleanup (GH-837)
* Remove unused test file

* Remove duplicated text in sndhdrdata README
2017-03-27 00:08:31 -05:00
Jelle Zijlstra 0579e81f30 import sys before we use it on line 9 (#828) 2017-03-26 22:17:39 -04:00
Jim Fasarakis-Hilliard 1e73dbbc29 Fix small exception typos in Lib (#818) 2017-03-26 13:59:08 -07:00
Serhiy Storchaka 62a9951530 bpo-29900: Simplify pathlib implementation. (#814)
Since functions in the os module support path-like objects, explicit
converting Path to str no longer needed.
2017-03-25 13:42:11 +02:00
Serhiy Storchaka 4aec9a8be2 bpo-29901: Improve support of path-like objects in zipapp. (#815)
Now general path-like objects are supported, not just pathlib.Path.
2017-03-25 13:05:23 +02:00
Mandeep Bhutani 9f0aa4843f bpo-29862: Fix grammar in importlib.reload() exception (GH-809) 2017-03-24 21:51:21 -07:00
Serhiy Storchaka 671079ef60 bpo-29894: Deprecate returning an instance of complex subclass from __complex__. (#798)
In a future versions of Python this can be an error.
2017-03-24 21:28:43 +02:00
Serhiy Storchaka af7b9ec5c8 bpo-25803: Avoid incorrect errors raised by Path.mkdir(exist_ok=True) (#805)
when the OS gives priority to errors such as EACCES over EEXIST.
2017-03-24 20:51:53 +02:00
Antoine Pitrou 8988945cdc bpo-29861: release references to multiprocessing Pool tasks (#743)
* bpo-29861: release references to multiprocessing Pool tasks

Release references to tasks, their arguments and their results as soon
as they are finished, instead of keeping them alive until another task
arrives.

* Comments in test
2017-03-24 13:52:11 +01:00
Serhiy Storchaka e304e33c16 bpo-19930: The mode argument of os.makedirs() no longer affects the file (#799)
permission bits of newly-created intermediate-level directories.
2017-03-24 13:27:42 +02:00
Serhiy Storchaka aefa7ebf0f bpo-6532: Make the thread id an unsigned integer. (#781)
* bpo-6532: Make the thread id an unsigned integer.

From C API side the type of results of PyThread_start_new_thread() and
PyThread_get_thread_ident(), the id parameter of
PyThreadState_SetAsyncExc(), and the thread_id field of PyThreadState
changed from "long" to "unsigned long".

* Restore a check in thread_get_ident().
2017-03-23 14:48:39 +01:00
Jelle Zijlstra 75b6cf879f fix function name in tabnanny documentation (GH-759) 2017-03-22 14:53:57 +08:00
Benjamin Peterson df8280838f bpo-20087: Revert "make the glibc alias table take precedence over the X11 one (#422)" (#713)
This reverts commit 02371e0ed1.
2017-03-19 23:49:43 -07:00
4kir4 e46fb86118 bpo-28876: bool of large range raises OverflowError (#699) 2017-03-20 08:44:46 +02:00
Serhiy Storchaka 24c738a9e9 bpo-29845: Mark tests that use _testcapi as CPython-only (#711) 2017-03-19 20:20:10 +02:00
Serhiy Storchaka a5af6e1af7 bpo-25455: Fixed crashes in repr of recursive buffered file-like objects. (#514) 2017-03-19 19:25:29 +02:00
Serhiy Storchaka bdf6b910f9 bpo-29776: Use decorator syntax for properties. (#585) 2017-03-19 08:40:32 +02:00
Jim Fasarakis-Hilliard cb5297a9e6 bpo-29836: Remove nturl2path from test_sundry and amend the module docstring (GH-694)
The module is implicitly tested through test_urllib.
2017-03-17 11:16:20 -07:00
Коренберг Марк 1b038e0738 bpo-29808: SysLogHandler: Do not fail if initial connect to syslog failed (#663) (#663) 2017-03-17 15:25:05 +00:00
Marco Buttu 3f2155ffe6 bpo-16355: Clarify when inspect.getcomments() returns None (#428)
Initial patch by Vajrasky Kok.
2017-03-17 11:50:23 +03:00
Nate bd583ef985 bpo-29581: Make ABCMeta.__new__ pass **kwargs to type.__new__ (#527)
Many metaclasses in the standard library don't play nice with
__init_subclass__. This bug makes ABCMeta in particular with
__init_subclass__, which is an 80/20 solution for me personally.
AFAICT, a general solution to this problem requires updating all
metaclasses in the standard library to make sure they pass **kwargs to
type.__new__, whereas this PR only fixes ABCMeta. For context, see
https://bugs.python.org/issue29581.

* added a test combining ABCMeta and __init_subclass__
* Added NEWS item
2017-03-15 11:39:22 -07:00
Daniel Himmelstein b4e9087e7b Fix stderr bug in json.tool test (#346)
See https://github.com/python/cpython/pull/201#discussion_r103229425.
2017-03-15 17:31:06 +03:00
Michael Seifert 6c3d527468 bpo-29800: Fix crashes in partial.__repr__ if the keys of partial.keywords are not strings (#649) 2017-03-15 07:26:33 +02:00
Jim Fasarakis-Hilliard d4914e9041 Add ELLIPSIS and RARROW. Add tests (#666) 2017-03-14 21:16:15 +01:00
INADA Naoki 2e4e011795 bpo-29592: site: skip abs_paths() when it's redundant (GH-167)
Call abs_paths() only if removeduppaths() changed sys.path
2017-03-15 00:52:19 +09:00
Xiang Zhang 7e2a54cdd9 bpo-28856: Let %b format for bytes support objects that follow the buffer protocol (GH-546) 2017-03-14 15:07:15 +08:00
Yury Selivanov b7c9150b68 Fix wrapping into StopIteration of return values in generators and coroutines (#644) 2017-03-12 15:53:07 -04:00
Nikolay Kim 2b27e2e6a3 bpo-29742: asyncio get_extra_info() throws exception (#525) 2017-03-12 15:23:30 -04:00
Serhiy Storchaka f6595983e0 bpo-28692: Deprecate using non-integer value for selecting a plural form in gettext. (#507) 2017-03-12 13:15:01 +02:00
Nick Coghlan d2977a3ae2 bpo-29723: Consistently configure sys.path[0] (#575)
Directory and zipfile execution previously added
the parent directory of the directory or zipfile
as sys.path[0] and then subsequently overwrote
it with the directory or zipfile itself.

This caused problems in isolated mode, as it
overwrote the "stdlib as a zip archive" entry
in sys.path, as the parent directory was
never added.

The attempted fix to that issue in bpo-29319
created the opposite problem in *non*-isolated
mode, by potentially leaving the parent
directory on sys.path instead of overwriting it.

This change fixes the root cause of the problem
by removing the whole "add-and-overwrite" dance
for sys.path[0], and instead simply never adds
the parent directory to sys.path in the first
place.
2017-03-12 20:38:32 +10:00
Zachary Ware 93710c152e bpo-29763: Use support.unlink instead of os.unlink (GH-624)
support.unlink waits for the files to be removed before returning
2017-03-11 22:10:07 -06:00
Serhiy Storchaka fdd42c481e bpo-20185: Convert list object implementation to Argument Clinic. (#542) 2017-03-11 09:19:20 +02:00
Serhiy Storchaka 9e6ac83aca bpo-29773: Add more cases for testing string to float conversion errors. (#580) 2017-03-09 20:07:58 +02:00
Serhiy Storchaka feccdb2a24 bpo-29774: Improve error reporting for corrupted extra field in ZIP file. (#583) 2017-03-09 17:34:03 +01:00
orenmn 964281af59 bpo-28298: make array 'Q', 'L' and 'I' accept big intables as elements (#570) 2017-03-09 11:35:28 +02:00
Serhiy Storchaka a7cba27aea bpo-29645: Speed up importing the webbrowser module. (#484) 2017-03-08 17:15:54 +02:00
Serhiy Storchaka 8606e9524a bpo-28231: The zipfile module now accepts path-like objects for external paths. (#511) 2017-03-08 14:37:51 +02:00
Serhiy Storchaka c45cd167d4 bpo-28230: Document the pathlib support in tarfile and add tests. (#512) 2017-03-08 10:32:44 +02:00
Benjamin Peterson 21a74312f2 Revert "bpo-29571: Use correct locale encoding in test_re (#149)" (#554)
This reverts commit ace5c0fdd9.
2017-03-07 22:48:09 -08:00
Benjamin Peterson 02371e0ed1 make the glibc alias table take precedence over the X11 one (#422)
bpo-20087
2017-03-07 22:03:13 -08:00
Serhiy Storchaka 9f8ad3f39e bpo-29568: Disable any characters between two percents for escaped percent "%%" in the format string for classic string formatting. (GH-513) 2017-03-08 11:51:19 +08:00
Xiang Zhang c393ee8589 bpo-24329: allow __qualname__ and __classcell__ in __slots__ (GH-495) 2017-03-08 11:18:49 +08:00
Xiang Zhang d5d3249e8a bpo-26915: Test identity first in membership operation in index() and count() methods of collections.abc.Sequence (GH-503) 2017-03-08 11:04:24 +08:00
Serhiy Storchaka 8f6b344d36 bpo-28682: Added support for bytes paths in os.fwalk(). (#489) 2017-03-07 14:33:21 +02:00
Xiang Zhang d36a71637c bpo-28728: clarify possible test failure due to ISP (GH-412) 2017-03-07 11:06:09 +08:00
Serhiy Storchaka d908fd9ee1 bpo-29695: Fixed tests after removing keyword args support in some basic type constructors. (GH-520) 2017-03-06 11:08:59 -08:00
Serhiy Storchaka 2e5642422f bpo-29695: Remove bad keyword parameters in int(), bool(), float(), list() and tuple(). (#518) 2017-03-06 17:01:06 +02:00
Xiang Zhang b76ad5121e bpo-29714: Fix a regression that bytes format may fail when containing zero bytes inside. (GH-499) 2017-03-06 17:17:05 +08:00
Serhiy Storchaka 58d23e6806 bpo-29695: Deprecated using bad named keyword arguments in builtings: (#486)
int(), bool(), float(), list() and tuple().  Specify the value as a
positional argument instead.
2017-03-06 00:53:39 +02:00
Ivan Levkivskyi 7acffa23c9 bpo-29638: Fix spurious refleaks after typing is imported (#469) 2017-03-05 20:15:20 +02:00
Dillon Brock c6b448b36d Change assertRaises to assertRaisesRegex in test_xmlrpc (#481) 2017-03-05 19:27:06 +02:00
Ned Deily de04644627 bpo-28087: Skip test_asyncore and test_eintr poll failures on macOS. (#462)
* bpo-28087: Skip test_asyncore and test_eintr poll failures on macOS

Skip some tests of select.poll when running on macOS due to unresolved
issues with the underlying system poll function on some macOS versions.
2017-03-04 06:00:37 -05:00
Ned Deily 5c4b0d063a bpo-27593: Get SCM build info from git instead of hg. (#446)
sys.version and the platform module python_build(),
python_branch(), and python_revision() functions now use
git information rather than hg when building from a repo.

Based on original patches by Brett Cannon and Steve Dower.
2017-03-04 00:19:55 -05:00
David Ellis 85b8d01c91 bpo-29623: Make PathLike objects work with ConfigParser.read() (#242) 2017-03-03 20:14:27 +03:00
Anish Shah 15aa4c88f6 bpo-29693: Fix for DeprecationWarning in test_import (#421)
Patch by Anish Shah.
2017-03-03 10:12:03 +02:00
Yury Selivanov 902e9c50e3 asyncio: Optimize _get_running_loop() to call getpid() only when there's a loop 2017-03-02 23:58:07 -05:00
Yury Selivanov 84af903f3b bpo-28963: Fix out of bound iteration in asyncio.Future.remove_done_callback/C (#408) 2017-03-02 23:46:56 -05:00
Yury Selivanov 2f15645785 asyncio: Fix trailing whitespace/code style 2017-03-02 23:25:31 -05:00
Seth M. Larson 481cb70a72 bpo-29704: Fix asyncio.SubprocessStreamProtocol closing (#405) 2017-03-02 23:21:18 -05:00
Yury Selivanov 398ff91ac0 bpo-28893: Set __cause__ for errors in async iteration protocol (#407) 2017-03-02 22:20:00 -05:00
Yury Selivanov 8d26aa930c bpo-29271: Fix Task.current_task and Task.all_tasks to accept None. (#406) 2017-03-02 22:16:33 -05:00
Yury Selivanov ba7e1f9a4e bpo-29703: asyncio: Fix creating new event loops in child processes. (#404) 2017-03-02 20:07:11 -05:00
orenmn 1bea762d9e bpo-28129: fix ctypes crashes (#386)
* init commit, with initial tests for from_param and fields __set__ and __get__, and some additions to from_buffer and from_buffer_copy

* added the rest of tests and patches. probably only a first draft.

* removed trailing spaces

* replace ctype with ctypes in error messages

* change back from ctypes instance to ctype instance
2017-03-02 18:42:40 +01:00
Matthias Bussonnier c643a967dd Add Python version since deprecation in base64 methods. (#33)
Allow developers to not have to either test on N Python versions or
looked through multiple versions of the docs to know whether they can
easily update.
2017-03-02 17:21:26 +03:00
Benjamin Peterson cb90f26122 fix subprocess on Windows (#391) 2017-03-02 00:03:41 -08:00
Benjamin Peterson afbb5d1cbd require uuid_generate_time_safe for all tests of it (#390)
The way mocking is written in these tests, we need to have the underlying function around.
2017-03-01 23:34:19 -08:00
Benjamin Peterson f52279257e allow path-like objects to be cwd on windows (#389)
#157 added the test, but it's currently (correctly) broken on windows.
2017-03-01 23:04:03 -08:00
Benjamin Peterson 0b8432538a correct check for _uuid_generate_time (#388)
If ctypes is not available, _uuid_generate_time will be None not its restype attribute.
2017-03-01 21:53:14 -08:00
Benjamin Peterson 1e68716fd5 Revert "make the locale_flag fallback code work again (#375)" (#387)
This reverts commit 43f5df5bfa.
2017-03-01 21:53:00 -08:00
Petr Motejlek 3c6314c08d bpo-29615: SimpleXMLRPCDispatcher no longer chains KeyError (#260)
(or any other exception) to exception(s) raised in the dispatched methods.
Patch by Petr Motejlek.
2017-03-01 19:21:28 +02:00
Benjamin Peterson 43f5df5bfa make the locale_flag fallback code work again (#375) 2017-02-28 23:59:12 -08:00
Benjamin Peterson 371963daba use select instead of _opcode for import test (#372) 2017-02-28 23:14:09 -08:00
Benjamin Peterson bee93f2d04 weaken test_from_import_missing_attr_has_name_and_path regular expression (#371)
Windows uses backslashes for separators.
2017-02-28 22:35:00 -08:00
amosonn 680e20beee Clarify exception handler scope in contextlib
Moved explicit raise from inside try to try...else.
2017-03-01 16:18:27 +10:00
Xiang Zhang 267b9d2fa8 bpo-7769: enable xmlrpc.server.SimpleXMLRPCDispatcher.register_function used as decorator (GH-231) 2017-02-28 17:12:52 +08:00
Xiang Zhang ecf39bbc97 bpo-29661: fix contradiction in timeit.Timer.autorange's docstring (GH-331) 2017-02-28 11:06:07 +08:00
Xiang Zhang f3a9faba4b bpo-29376: Fix assertion error in threading._DummyThread.is_alive() (GH-236) 2017-02-27 11:01:30 +08:00
Sayan Chowdhury d5c11f7ace bpo-28624: Add a test that checks that cwd parameter of Popen() accepts PathLike objects (#157) 2017-02-26 20:06:10 +03:00
Berker Peksag 4a926caf8e bpo-28518: Start a transaction implicitly before a DML statement (#245)
Patch by Aviv Palivoda.
2017-02-26 18:22:38 +03:00
INADA Naoki 5dc33eea53 bpo-29110: add test for Aifc_write. (GH-293)
follow up of GH-162
2017-02-26 21:11:58 +09:00
Berker Peksag 5aa3856b4f bpo-28961: Address my comments from earlier code review (#305) 2017-02-26 15:04:11 +03:00
Subhendu Ghosh ae160bba20 bpo-26128: Added __init__to subprocess.STARTUPINFO (#171)
The Windows-specific subprocess.STARTUPINFO class now accepts
keyword-only arguments to its constructor to set the various
data attributes.

Patch by Subhendu Ghosh.
2017-02-26 00:59:05 +10:00
Ratnadeep Debnath 21024f0662 bpo-16285: Update urllib quoting to RFC 3986 (#173)
* bpo-16285: Update urllib quoting to RFC 3986

urllib.parse.quote is now based on RFC 3986, and hence
includes `'~'` in the set of characters that is not escaped
by default.

Patch by Christian Theune and Ratnadeep Debnath.
2017-02-25 19:00:28 +10:00
Nick Coghlan 140792bd51 bpo-29644: suppress subprocess output from webbrowser (#289)
When checking for the default X web browser, xdg-settings
may emit messages on stderr if some components (such as
kreadconfig5) are unavailable. These messages aren't of
interest to Python, so we just ignore them.
2017-02-25 18:40:07 +10:00
Nick Coghlan 56a8eccc43 bpo-24241: Add dedicated webbrowser.register test case (#288) 2017-02-25 18:14:07 +10:00
David Steele e3ce69522f bpo-24241: Improve preferred webbrowser handling (#85)
- Add 'preferred' argument to webbrowser.register
- Use xdg-settings to specify preferred X browser

The first change replaces the existing undocumented tri-state
'try_order' parameter with the documented boolean keyword-only
'preferred' parameter. Setting it to True places the browser at the
front of the list, preferring it as the return to a subsequent get() call.

The second change adds a private `_os_preferred_browser` setting
and then uses that to make the default browser reported by
`xdg-settings` first in the try list when running under X (or
another environment that sets the `DISPLAY` variable).
This avoids the problem where the first entry in the tryorder
queue otherwise defaults to xdg-open, which doesn't support
the "new window" option.
2017-02-25 14:47:38 +10:00
Ivan Levkivskyi 365cb5bb90 bpo-28556: Fix regression that sneaked into recent typing updates (GH-270) 2017-02-24 09:28:26 -08:00
Matthias Bussonnier 6059ce45aa bpo-27788 : synchronise platform.py version number (#246)
Was bumped in the docstring by b9f4feab1b
but not in `__version__`
2017-02-24 11:47:34 +01:00
Matthias Bussonnier 41cea70aa3 bpo-29637: clean docstring only if not None (GH-267) 2017-02-24 15:44:19 +09:00
Ivan Levkivskyi abb3b8ad94 Update to typing: treat subscripted generics as proxies (#265) 2017-02-23 19:03:28 -08:00
INADA Naoki 4c78c527d2 bpo-29622: Make AST constructor to accept less than enough number of positional arguments (GH-249)
bpo-29463 added optional "docstring" field to 4 AST types.
While it is optional, it breaks backward compatibility because AST constructor
requires number of positional argument is same to number of fields.

AST types accepts empty arguments, and incomplete keyword arguments.
But it's not big problem because field can be filled after creation, and checked when compiling.
So stop requiring complete set of fields for positional arguments too.
2017-02-24 02:48:17 +09:00
Arne de Laat 324c5d8ca6 bpo-28911: Clarify the behaviour of assert_called_once_with. (#251) 2017-02-23 15:57:25 +01:00
Martijn Pieters d7e64337ef bpo-28598: Support __rmod__ for RHS subclasses of str in % string formatting operations (#51)
When you use `'%s' % SubClassOfStr()`, where `SubClassOfStr.__rmod__` exists, the reverse operation is ignored as normally such string formatting operations use the `PyUnicode_Format()` fast path. This patch tests for subclasses of `str` first and picks the slow path in that case.

Patch by Martijn Pieters.
2017-02-23 15:38:04 +02:00
INADA Naoki cb41b2766d bpo-29463: Add docstring field to some AST nodes. (#46)
* bpo-29463: Add docstring field to some AST nodes.

ClassDef, ModuleDef, FunctionDef, and AsyncFunctionDef has docstring
field for now.  It was first statement of there body.

* fix document.  thanks travis!

* doc fixes
2017-02-22 16:31:59 +01:00
Matthias Bussonnier 1bc156430b bpo-29546: Improve from-import error message with location (#103)
bpo-29546: Improve from-import error message with location
2017-02-22 10:06:50 -05:00
Anthony Zhang 03f68b60e1 bpo-29110: Fix file object leak in `aifc.open` when given invalid AIFF file. (GH-162) 2017-02-22 16:23:30 +09:00
Matthias Bussonnier 8fb1f6e039 bpo-29554: Improve docs for pstat module and profile. (#88)
Clarify that methods take a string which is interpreted as a regex,
not a regex object.

Also clarify what the old `-1`, `0`, `1` and `2` options were.
2017-02-21 08:30:00 +03:00
Mark Dickinson 112ec38c15 bpo-29602: fix signed zero handling in complex constructor. (#203)
* Fix incorrect handling of signed zeros for complex-related classes.

* Add Misc/NEWS entry.
2017-02-20 20:28:15 +00:00
Serhiy Storchaka 9639e4ab6d bpo-29532: Altering a kwarg dictionary passed to functools.partial() (#190)
no longer affects a partial object after creation.
2017-02-20 14:04:30 +02:00
Vinay Sajip a86339b83f Fixed bpo-29565: Corrected ctypes passing of large structs by value on Windows AMD64. (#168)
* Fixed bpo-29565: Corrected ctypes passing of large structs by value.

Added code and test to check that when a structure passed by value
is large enough to need to be passed by reference, a copy of the
original structure is passed. The callee updates the passed-in value,
and the test verifies that the caller's copy is unchanged. A similar
change was also added to the test added for bpo-20160 (that test was
passing, but the changes should guard against regressions).

* Reverted unintended whitespace changes.
2017-02-20 00:16:33 +00:00
Barry Warsaw 8c130d7f81 bpo-22807: Expose platform UUID generation safety information. (#138)
bpo-22807: Expose platform UUID generation safety information.
2017-02-18 15:45:49 -05:00
Nick Coghlan ace5c0fdd9 bpo-29571: Use correct locale encoding in test_re (#149)
``local.getlocale(locale.LC_CTYPE)`` and
``locale.getpreferredencoding(False)`` may give different answers
in some cases (such as the ``en_IN`` locale).

``re.LOCALE`` uses the latter, so update the test case to match.
2017-02-18 15:01:22 +05:30
Senthil Kumaran b2ee40ed9c Change some mercurial/ hg.python.org references. (#8) 2017-02-16 07:18:42 -08:00