Commit Graph

99365 Commits

Author SHA1 Message Date
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 76a3e51a40 bpo-30243: Fixed the possibility of a crash in _json. (#1420)
It was possible to get a core dump by using uninitialized
_json objects. Now __new__ methods create initialized objects.
__init__ methods are removed.
2017-05-05 10:08:49 +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
Brett Cannon 647c3d381e Make code coverage less strict (GH-1438)
Set the target to be 90% since there is enough OS-specific code and things that require manual testing that we will never hit 100%. Also turn off the status checks since they are so inconsistent in terms of flagging a PR as passing/failing that they aren't useful and can actually block merging from a phone.
2017-05-04 14:58:54 -07: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 dbaf746b6d bpo-29956: Improve the math.exp() related documentation. (#1073) 2017-05-04 12:25:09 +03:00
Serhiy Storchaka 7e4db2f253 bpo-30166: Import command-line parsing modules only when needed. (#1293) 2017-05-04 08:17:47 +03:00
Victor Stinner 1c4670ea0c bpo-30225: Fix is_valid_fd() on macOS Tiger (#1443)
is_valid_fd() now uses fstat() instead of dup() on macOS to return 0
on a pipe when the other side of the pipe is closed. fstat() fails
with EBADF in that case, whereas dup() succeed.
2017-05-04 00:45:56 +02:00
Serhiy Storchaka 5f161fd86d bpo-30184: Add tests for invalid use of PyArg_ParseTupleAndKeywords. (#1316) 2017-05-04 00:03:23 +03:00
Christian Heimes feec3dc9c3 Add myself to mention-bot's alwaysNotifyForPaths for ssl/hashlib (#1425)
Signed-off-by: Christian Heimes <christian@python.org>
2017-05-03 20:17:54 +02:00
Brett Cannon 7fdd30975e Explicitly mention what should (not) be discussed on GitHub (GH-1437) 2017-05-03 10:51:55 -07:00
UltimateCoder 8856940cf2 bpo-28315: Improve code examples in docs (GH-1372)
Replace
   File "<stdin>", line 1, in ? 
with 
   File "<stdin>", line 1, in <module>
2017-05-03 09:46:45 -07:00
Victor Stinner a5c62a8e9f bpo-23404: make touch becomes make regen-all (#1405)
Don't rebuild generated files based on file modification time
anymore, the action is now explicit. Replace "make touch"
with "make regen-all".

Changes:

* Remove "make touch", Tools/hg/hgtouch.py and .hgtouch
* Add a new "make regen-all" command to rebuild all generated files
* Add subcommands to only generate specific files:

  - regen-ast: Include/Python-ast.h and Python/Python-ast.c
  - regen-grammar: Include/graminit.h and Python/graminit.c
  - regen-importlib: Python/importlib_external.h and Python/importlib.h
  - regen-opcode: Include/opcode.h
  - regen-opcode-targets: Python/opcode_targets.h
  - regen-typeslots: Objects/typeslots.inc

* Rename PYTHON_FOR_GEN to PYTHON_FOR_REGEN
* pgen is now only built by by "make regen-grammar"
* Add $(srcdir)/ prefix to paths to source files to handle correctly
  compilation outside the source directory

Note: $(PYTHON_FOR_REGEN) is no more used nor needed by "make"
default target building Python.
2017-05-03 18:21:48 +02: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
Victor Stinner 9ed34a8953 bpo-30232: Regenerate configure (#1396)
Run autoconf.
2017-05-02 22:35:58 +02:00
Victor Stinner 5facdbb291 bpo-30232: Support Git worktree in configure.ac (#1391)
Don't test if .git/HEAD file exists, but only if the .git file (or
directory) exists.
2017-05-02 21:42:48 +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
Tong SHEN b0d8203654 Fix typo in selectors.rst (#1383)
decriptor -> descriptor
2017-05-02 06:27:57 -07:00
Victor Stinner 9997073736 bpo-30228: FileIO seek() and tell() set seekable (#1384)
FileIO.seek() and FileIO.tell() method now set the internal seekable
attribute to avoid one syscall on open() (in buffered or text mode).

The seekable property is now also more reliable since its value is
set correctly on memory allocation failure.
2017-05-02 15:10:39 +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
Nathaniel J. Smith d4069de511 Clean up some confusing text left by PROTOCOL_SSLv23 -> PROTOCOL_TLS transition (#1355) 2017-05-01 22:43:31 -07: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
Xiang Zhang 1374dbb694 restore *data* parameter of binascii.b2a_base64 to positional-only (#1352) 2017-05-01 13:12:07 +08:00
Jelle Zijlstra 2e624690bd bpo-29679: Implement @contextlib.asynccontextmanager (#360) 2017-04-30 18:25:58 -07:00
csabella 9dc2b3809f bpo-30208: DOC: fix small typos in IDLE (#1354) 2017-04-29 18:28:36 -04: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
Neil Schemenauer 6c991bdee7 Check that Python is 64-bit before enabling BLAKE2_USE_SSE. (#1332) 2017-04-28 09:56:48 -07: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
Wieland Hoffmann 80a3da4d4a Improve the grammar in windows.rst (GH-1330) 2017-04-28 09:12:57 -07:00
Victor Stinner 826f83f1d5 bpo-30104: Only use -fno-strict-aliasing on dtoa.c (#1340)
On clang, only compile dtoa.c with -fno-strict-aliasing, use strict
aliasing to compile all other C files.
2017-04-28 15:07:10 +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
Marco Buttu e65fcde85a bpo-27200: Fix several doctests (GH-604) 2017-04-27 15:23:34 +03:00
Jesse Gonzalez 6fde770e4e Use the correct name for ISO in Unicode HOWTO. (#1312) 2017-04-26 22:12:17 -07:00
Louie Lu 88c38b32b7 bpo-28415: Note 0 conversion different between Python and C (#885) 2017-04-27 11:36:35 +08:00
Dong-hee Na a90b990480 bpo-30142: Remove "callable" from the 2to3fixer documentation. (GH-1296) 2017-04-26 09:16:21 -07:00
Eijebong ab7886b785 bpo-30101: Add support for curses.A_ITALIC. (#1015) 2017-04-26 23:17:12 +08: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 6e676954de timemodule.c: Cast PyUnicode_AsUTF8() to char* (#1294)
bpo-28769 changed PyUnicode_AsUTF8() return type from const char* to
char* in Python 3.7, but tm_zone field type of the tm structure is
char* on FreeBSD.

Cast PyUnicode_AsUTF8() to char* in gettmarg() to fix the warning:

    Modules/timemodule.c:443:20: warning: assigning to 'char *'
    from 'const char *' discards qualifiers
2017-04-26 13:51:48 +02:00
Mathias Rav 87c07fe9d9 bpo-29974: Improve typing.TYPE_CHECKING example (GH-982)
* Fix PEP 8 (SomeType instead of some_type)
* Add a function parameter annotation
* Explain, using wording from PEP 484 and PEP 526,
  why one annotation is in quotes and another is not.

Suggested by Ivan Levkevskyi.
2017-04-26 13:49:45 +03:00
Louie Lu 0d637e236d bpo-28698: Fix c_wchar_p doc example (GH-1160) 2017-04-26 11:15:05 +03:00
csabella c6db4811f9 bpo-30052: Link `bytes` & `bytearray` to stdtypes not functions (GH-1271)
Builtin container types have two potential link targets in the docs:

- their entry in the list of builtin callables
- their type documentation

This change brings `bytes` and `bytearray` into line with other
container types by having cross-references default to linking to
their type documentation, rather than their builtin callable entry.
2017-04-26 15:47:01 +10: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