Commit Graph

20094 Commits

Author SHA1 Message Date
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
Mariatta 600c5ad53c bpo-30178: Add Jim Fasarakis-Hilliard to Misc/ACKS (GH-1572) 2017-05-13 09:59:08 -07:00
Serhiy Storchaka 7e19dbc92e bpo-28974: `object.__format__(x, '')` is now equivalent to `str(x)` (#506)
rather than `format(str(self), '')`.
2017-05-13 12:40:52 +03: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
stratakis f6eae5bf1c bpo-28787: Fix out of tree --with-dtrace builds (#135)
* bpo-28787: Fix out of tree --with-dtrace builds

* Unsilence directory creation

* Add Misc/NEWS and Misc/ACKS entries
2017-05-10 17:08:15 +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
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
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
torsava a1054c3b00 bpo-29243: Fix Makefile with respect to --enable-optimizations (#1478)
* bpo-29243: Fix Makefile with respect to --enable-optimizations

When using the Profile Guided Optimization (./configure --enable-optimizations)
Python is built not only during `make` but rebuilt again during `make test`,
`make install` and others. This patch fixes the issue.

Note that this fix produces no change at all in the Makefile if configure is
run witout --enable-optimizations.

* !squash
2017-05-05 17:35:50 +02: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
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 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
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 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
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
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
Eijebong ab7886b785 bpo-30101: Add support for curses.A_ITALIC. (#1015) 2017-04-26 23:17:12 +08:00
Jim Fasarakis-Hilliard 08c16016e2 bpo:29950: Rename SlotWrapperType to WrapperDescriptorType (GH-926) 2017-04-25 21:26:36 +03: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
Mariatta 9eb5ca0774 bpo-29751: add Cheryl Sabella to Misc/ACKS (GH-1268) 2017-04-23 21:05:19 -07:00
Serhiy Storchaka 7bfd740e3d Remove unneeded Misc/NEWS entry for bpo-29802. (#1251)
The bug was added in still not released version.
2017-04-22 09:24:59 +03:00
bladebryan 9616a82e78 bpo-29960 _random.Random corrupted on exception in setstate(). (#1019) 2017-04-22 09:10:46 +03: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
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
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
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
Mariatta 39f5956ffb bpo-29738: Add Olivier Vielpeau to Misc/ACKS (GH-1146) 2017-04-14 18:33:48 -07:00
Ryan Gonzalez f9f87f0934 bpo-11913: Add README.rst to the distutils standard READMEs list (#563) 2017-04-14 11:00:25 +02:00
Mariatta 947629916a bpo-29869: Add Nevada Sanchez to Misc/ACKS (GH-1125) 2017-04-13 18:30:42 -07: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
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
Nick Coghlan e8a6bb4f39 bpo-29692: Add missing ACKS entry (#1079) 2017-04-11 19:47:39 +10: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
Sanyam Khurana 19e0494256 bpo-29506: Clarify deep copy note in copy module
The reference to administrative data was confusing to readers,
so this simplifies the note to explain that deep copying may copy
more then you intended, such as data that you expected to be
shared between copies.
2017-04-09 20:22:30 +10: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
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
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 a0157b5f11 Miscellaneous minor fixes of Misc/NEWS formatting. (#1002) 2017-04-05 12:07:22 +03:00
Andrew Nester f78b119364 bpo-29649: Improve struct.pack_into() boundary error messages (#424) 2017-04-04 13:46:25 +03:00
cocoatomo e8c763128f bpo-19225: Add a table of warning names and missed exception names in C API doc (#881)
Move the `.. index` directive to more appropriate place.
2017-04-02 13:45:40 +03: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
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
INADA Naoki e82cf8675b bpo-29949: Fix set memory usage regression (GH-943)
Revert "Minor factoring:  move redundant resize scaling logic into the resize function."

This reverts commit 4897300276.
2017-04-01 17:20:25 +09: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
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
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 d4edfc9abf bpo-29935: Fixed error messages in the index() method of tuple, list and deque (#887)
when pass indices of wrong type.
2017-03-30 18:29:23 +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
s-sanjay 16f852345b bpo-29913: deprecate compare_networks() in documentation (GH-865) 2017-03-30 15:44:29 +08: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
Serhiy Storchaka 0a58f72762 bpo-24821: Fixed the slowing down to 25 times in the searching of some (#505)
unlucky Unicode characters.
2017-03-30 09:11:10 +03: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
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
INADA Naoki c8fa45bac2 NEWS: remove duplicated "Build" section (GH-872) 2017-03-29 00:24:30 +09:00
Barry Warsaw 9f74deba78 Improve the documentation for template strings (#856)
bpo-19824
bpo-20314
bpo-12518
2017-03-28 10:02:07 -04:00
Alex Wang 8cea5929f5 bpo-29643: Fix check for --enable-optimizations (GH-129)
The presence of the ``--enable-optimizations`` flag is indicated by the
value of ``$enableval``, but the configure script was checking ``$withval``,
resulting in the ``--enable-optimizations`` flag being effectively ignored.
2017-03-28 21:50:51 +09: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
Michael Seifert 5fb278fd58 Fixes sphinx warning in "changelog" misc/NEWS (#829) 2017-03-26 21:25:57 -04: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
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
Christophe Zeitouny 20fbf8accd faulthandler: Restore the old sigaltstack during teardown (#777) 2017-03-23 18:14:29 +01: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
Nathaniel J. Smith 1e2147b9d7 bpo-29728: Provide socket.TCP_NOTSENT_LOWAT (#477)
* Provide socket.TCP_NOTSENT_LOWAT
* New TCP option available on recent MacOS and Linux.
* Document addition of TCP_NOTSENT_LOWAT
2017-03-22 20:56:55 -07:00
Daniel Birnstiel d7fa6b259e bpo-29859: Fix error messages from return codes for pthread_* calls (GH-741) 2017-03-21 22:06:06 +09:00
Xiang Zhang 4830f581af bpo-29849: fix a memory leak in import_from (GH-712) 2017-03-21 11:13:42 +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 80ec8364f1 bpo-29748: Added the slice index converter in Argument Clinic. (#549) 2017-03-19 19:37:40 +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
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
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
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
Nikolay Kim 2b27e2e6a3 bpo-29742: asyncio get_extra_info() throws exception (#525) 2017-03-12 15:23:30 -04:00
Serhiy Storchaka 4125e5c60e bpo-26121: Revert to using the own implementations of lgamma and gamma on all platforms. (#637) 2017-03-12 14:08:06 +02:00
Serhiy Storchaka c2cf128571 bpo-8256: Fixed possible failing or crashing input() (#517)
if attributes "encoding" or "errors" of sys.stdin or sys.stdout
are not set or are not strings.
2017-03-12 13:50:36 +02:00
Nick Coghlan 27abb0e533 bpo-29723: Add missing NEWS entry (#638) 2017-03-12 21:34:32 +10: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
Serhiy Storchaka 202fda55c2 bpo-24037: Add Argument Clinic converter `bool(accept={int})`. (#485) 2017-03-12 10:10:47 +02:00