Commit Graph

92888 Commits

Author SHA1 Message Date
Raymond Hettinger 1ce6885f8a Fix compiler warning about obviously unreachable code. 2016-01-24 22:15:20 -08:00
Raymond Hettinger 306d6b1ea6 Convert another post-decrement while-loop to pre-decrement for consistency
and better generated code (on both GCC and CLang).
2016-01-24 12:40:42 -08:00
Raymond Hettinger 165eee214b Convert two other post-decrement while-loops to pre-decrements for consistency
and for better code generation.
2016-01-24 11:32:07 -08:00
Raymond Hettinger d84ec225bd Miscellaneous refactorings
* Add comment to the maxlen structure entry about the meaning of maxlen == -1
* Factor-out code common to deque_append(left) and deque_extend(left)
* Factor inner-loop in deque_clear() to use only 1 test per loop instead of 2
* Tighten inner-loops for deque_item() and deque_ass_item() so that the
  compiler can combine the decrement and test into a single step.
2016-01-24 09:12:06 -08:00
Victor Stinner 1aa78938b0 Issue #26146: marshal.loads() now uses the empty frozenset singleton 2016-01-23 14:15:48 +01:00
Victor Stinner 5ebe2c89fe Cleanup test_dict
* Write one import per line
* Sort imports by name
* Add an empty line: 2 empty lines between code blocks at the module level (PEP 8)
2016-01-23 13:52:05 +01:00
Victor Stinner 843a1fb1e7 test_gc: remove unused imports 2016-01-23 13:29:02 +01:00
Brett Cannon 9fa812668f Issue #18018: Raise an ImportError if a relative import is attempted
with no known parent package.

Previously SystemError was raised if the parent package didn't exist
(e.g., __package__ was set to '').
Thanks to Florent Xicluna and Yongzhi Pan for reporting the issue.
2016-01-22 16:39:02 -08:00
Brett Cannon 4b18dd339a Issue #25234: Skip test_eintr.test_open() under OS X to avoid hanging 2016-01-22 15:55:56 -08:00
Brett Cannon b0db3718d4 whitespace cleanup 2016-01-22 15:26:56 -08:00
Brett Cannon 849113af6b Issue #25791: Warn when __package__ != __spec__.parent.
In a previous change, __spec__.parent was prioritized over
__package__. That is a backwards-compatibility break, but we do
eventually want __spec__ to be the ground truth for module details. So
this change reverts the change in semantics and instead raises an
ImportWarning when __package__ != __spec__.parent to give people time
to adjust to using spec objects.
2016-01-22 15:25:50 -08:00
Brett Cannon 52c854a838 Merge from 3.5 2016-01-22 14:05:41 -08:00
Brett Cannon 3bf1d87bbd Fix a typo in a code example 2016-01-22 14:03:27 -08:00
Victor Stinner bf980797af Merge 3.5 (i18n doc, issue #25907) 2016-01-22 18:00:31 +01:00
Victor Stinner 875f29aa69 doc: i18n HTML templates
Issue #25907: Use {% trans %} tags in HTML templates to ease the translation of
the documentation. The tag comes from Jinja templating system, used by Sphinx.

Patch written by Julien Palard.
2016-01-22 18:00:05 +01:00
Victor Stinner fd9ccaea03 Null merge 3.5 (change already applied to default) 2016-01-22 15:59:02 +01:00
Victor Stinner 5a701f0304 Issue #25876: Fix also test_set() of test_gdb when -E command line is used 2016-01-22 15:04:27 +01:00
Victor Stinner 22756f18bc Issue #25876: test_gdb: use subprocess._args_from_interpreter_flags() to test
Python with more options.
2016-01-22 14:16:47 +01:00
Victor Stinner b02ef715a3 Use Py_uintptr_t for atomic pointers
Issue #26161: Use Py_uintptr_t instead of void* for atomic pointers in
pyatomic.h. Use atomic_uintptr_t when <stdatomic.h> is used.

Using void* causes compilation warnings depending on which implementation of
atomic types is used.
2016-01-22 14:09:55 +01:00
Victor Stinner 3cdd5fb970 code_richcompare() now uses the constants types
Issue #25843: When compiling code, don't merge constants if they are equal but
have a different types. For example, "f1, f2 = lambda: 1, lambda: 1.0" is now
correctly compiled to two different functions: f1() returns 1 (int) and f2()
returns 1.0 (int), even if 1 and 1.0 are equal.

Add a new _PyCode_ConstantKey() private function.
2016-01-22 12:33:12 +01:00
Victor Stinner efb2413ce8 code_richcompare() now uses the constants types
Issue #25843: When compiling code, don't merge constants if they are equal but
have a different types. For example, "f1, f2 = lambda: 1, lambda: 1.0" is now
correctly compiled to two different functions: f1() returns 1 (int) and f2()
returns 1.0 (int), even if 1 and 1.0 are equal.

Add a new _PyCode_ConstantKey() private function.
2016-01-22 12:33:12 +01:00
Victor Stinner e3560a7dc9 site: error on sitecustomize import error
Issue #26099: The site module now writes an error into stderr if sitecustomize
module can be imported but executing the module raise an ImportError. Same
change for usercustomize.
2016-01-22 12:22:07 +01:00
Benjamin Peterson ae8c078dbb merge 3.5 2016-01-21 22:04:04 -08:00
Benjamin Peterson d52513cb22 merge 3.4 2016-01-21 22:03:55 -08:00
Benjamin Peterson b1db758061 reject negative data_size 2016-01-21 22:02:46 -08:00
Senthil Kumaran cbde4a6924 merge from 3.5
minor clarification on Zipfile 'x' mode - exclusive creation of a file.

(Based on the feedback from docs@python.org list)
2016-01-21 21:08:25 -08:00
Senthil Kumaran e5c05cc8c0 minor clarification on Zipfile 'x' mode - exclusive creation of a file. 2016-01-21 21:06:47 -08:00
Donald Stufft a7baa106cd Merge update to pip 2016-01-21 21:56:28 -05:00
Donald Stufft 38150e0d85 Merge update to pip 2016-01-21 21:56:06 -05:00
Donald Stufft 5d0124623c Upgrade pip to 8.0.2 2016-01-21 21:55:32 -05:00
Berker Peksag 2e15d60b83 Issue #18620: Improve Pool examples in multiprocessing documentation
A single call to Pool.apply_async() will create only one process. To use all
of the pool's processes, it should be invoked multiple times:

    with Pool(processes=4) as pool:
        results = [pool.apply_async(func, ()) for i in range(4)]

Patch by Davin Potts.
2016-01-22 00:00:06 +02:00
Berker Peksag 7405c16533 Issue #18620: Improve Pool examples in multiprocessing documentation
A single call to Pool.apply_async() will create only one process. To use all
of the pool's processes, it should be invoked multiple times:

    with Pool(processes=4) as pool:
        results = [pool.apply_async(func, ()) for i in range(4)]

Patch by Davin Potts.
2016-01-21 23:59:49 +02:00
Senthil Kumaran dce4ae8ffe merge from 3.5
issue25909 - Correct the documentation of PyMapping_Items, PyMapping_Keys and
PyMapping_Values in Include/abstract.h and Doc/c-api/mapping.rst.

Patch contributed by Sonali Gupta.
2016-01-21 09:38:02 -08:00
Senthil Kumaran 1538b3d3df issue25909 - Correct the documentation of PyMapping_Items, PyMapping_Keys and
PyMapping_Values in Include/abstract.h and Doc/c-api/mapping.rst.

Patch contributed by Sonali Gupta.
2016-01-21 09:37:28 -08:00
Victor Stinner 9f78939552 Issue #26107: Fix typo in Objects/lnotab_notes.txt
Double parenthesis
2016-01-21 18:12:29 +01:00
Victor Stinner 875dde4387 Merge 3.5 (doc) 2016-01-21 08:58:44 +01:00
Victor Stinner d99cd333fe Issue #26106: doc: Move text of licenses to parsed literal block
This change helps to ignore text of PSF, BEOPEN.com and CNRI licenses when
translating the documentation. Patch written by Julien Palard who is
translating Python 3.5 doc to french. Text of other licenses already used
preformatted format.
2016-01-21 08:56:00 +01:00
Benjamin Peterson 2b0b5ac5a0 merge 3.5 (#26171) 2016-01-20 22:25:40 -08:00
Benjamin Peterson 47b8ba22e3 merge 3.4 (#26171) 2016-01-20 22:25:06 -08:00
Benjamin Peterson c4032da201 prevent buffer overflow in get_data (closes #26171) 2016-01-20 22:23:44 -08:00
Benjamin Peterson ba77788bba merge 3.5 2016-01-20 22:07:50 -08:00
Benjamin Peterson d4d7737c3f merge 3.4 2016-01-20 22:07:43 -08:00
Benjamin Peterson ef9cf08352 fix refleak in error condition 2016-01-20 22:06:43 -08:00
Benjamin Peterson e45abae08f merge 3.5 (#26172) 2016-01-20 22:03:00 -08:00
Benjamin Peterson b57eaeadff merge 3.4 (#26172) 2016-01-20 22:02:47 -08:00
Benjamin Peterson c836f717cd remove script from epub (closes #26172) 2016-01-20 22:02:30 -08:00
Victor Stinner c3ea8d2268 Merge 3.5 (issue #24520) 2016-01-20 22:28:10 +01:00
Victor Stinner 7172f507e1 Replace fpgetmask() with fedisableexcept()
Issue #24520: On FreeBSD, fpgetmask() was deprecated long time ago.
fedisableexcept() is now preferred.
2016-01-20 22:27:34 +01:00
Victor Stinner f3914eb16d co_lnotab supports negative line number delta
Issue #26107: The format of the co_lnotab attribute of code objects changes to
support negative line number delta.

Changes:

* assemble_lnotab(): if line number delta is less than -128 or greater than
  127, emit multiple (offset_delta, lineno_delta) in co_lnotab
* update functions decoding co_lnotab to use signed 8-bit integers

  - dis.findlinestarts()
  - PyCode_Addr2Line()
  - _PyCode_CheckLineNumber()
  - frame_setlineno()

* update lnotab_notes.txt
* increase importlib MAGIC_NUMBER to 3361
* document the change in What's New in Python 3.6
* cleanup also PyCode_Optimize() to use better variable names
2016-01-20 12:16:21 +01:00
Senthil Kumaran 316fcc867b merge from 3.5
issue25982 - Add a class definition for managers.Namespace in the multiprocessing docs.
2016-01-20 03:11:52 -08:00