Commit Graph

3338 Commits

Author SHA1 Message Date
INADA Naoki 2942b909d9
bpo-32616: Disable computed gotos by default for clang < 5 (GH-5574) 2018-02-07 19:09:36 +09:00
Mariatta 9b7b3a6456
bpo-32674: Improve the docstring for __import__ (GH-5339) (GH-5494)
Clarify that the level argument is used to determine whether to
perform absolute or relative imports: 0 is absolute, while a positive number
is the number of parent directories to search relative to the current module..
(cherry picked from commit 461d225b19)

Co-authored-by: oldk <oldk1331@users.noreply.github.com>
2018-02-02 11:23:53 -05:00
Benjamin Peterson e13698172f
[2.7] advance copyright years to 2018 (GH-5094). (#5105)
(cherry picked from commit 65f2a6dcc2)
2018-01-04 23:02:11 -08:00
Serhiy Storchaka 65d1887170
[2.7] bpo-10544: Deprecate "yield" in comprehensions and generator expressions in Py3k mode. (GH-4579) (#4676) 2017-12-02 21:00:09 +02:00
Victor Stinner be6b74c079
bpo-20891: Fix PyGILState_Ensure() (#4650) (#4657)
When PyGILState_Ensure() is called in a non-Python thread before
PyEval_InitThreads(), only call PyEval_InitThreads() after calling
PyThreadState_New() to fix a crash.

(cherry picked from commit b4d1e1f7c1)
2017-11-30 23:35:14 +01:00
Benjamin Peterson 88d5e2c938 fix marshal uninitialized variable warnings (#4114)
GCC says:
../cpython/Python/marshal.c: In function ‘PyMarshal_WriteLongToFile’:
../cpython/Python/marshal.c:70:35: warning: ‘wf.ptr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                       else if ((p)->ptr != (p)->end) *(p)->ptr++ = (c); \
                                   ^~
../cpython/Python/marshal.c:70:47: warning: ‘wf.end’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                       else if ((p)->ptr != (p)->end) *(p)->ptr++ = (c); \
                                               ^~
../cpython/Python/marshal.c:77:10: warning: ‘wf.str’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (p->str == NULL)
         ~^~~~~

This isn't a real problem because if the file pointer is not NULL, the
string-related fields are never touched. But, it doesn't hurt to set the unused
fields to NULL.
2017-10-24 23:09:55 -07:00
Victor Stinner 7b4ba62e38 [2.7] bpo-31692: Add PYTHONSHOWALLOCCOUNT env var (GH-3927)
bpo-31692, bpo-19527:

* Add a new PYTHONSHOWALLOCCOUNT environment variable, similar to
  the Python 3 "-X showalloccount" option
* When Python is compiled with COUNT_ALLOCS, the new
  PYTHONSHOWALLOCCOUNT environment variable now has to be set to dump
  allocation counts into stderr on shutdown. Moreover, allocations
  statistics are now dumped into stderr rather than stdout.
* Add @test.support.requires_type_collecting decorator: skip test if
  COUNT_ALLOCS is defined
* Fix tests for COUNT_ALLOCS: decorate some methods with
  @requires_type_collecting
* test_sys.test_objecttypes(): update object type when COUNT_ALLOCS
  is defined
2017-10-17 02:25:23 -07:00
Victor Stinner 3c082a7fdb bpo-31733: Add PYTHONSHOWREFCOUNT env var (GH-3932)
Add a new PYTHONSHOWREFCOUNT environment variable. In debug mode,
Python now only print the total reference count if PYTHONSHOWREFCOUNT
is set.
2017-10-17 01:35:19 -07:00
Miss Islington (bot) 2fb8e93859 [2.7] remove tabs from getcompiler.c (GH-3892) (#3894)
(cherry picked from commit a8ed11742b)
2017-10-05 08:41:31 -07:00
Oren Milman 40d736bcf4 [2.7] bpo-31285: Don't raise a SystemError in warnings.warn_explicit() in case __loader__.get_source() has a bad splitlines() method. (GH-3219) (#3823)
(cherry picked from commit 91fb0af)
2017-09-30 17:06:55 +03:00
Serhiy Storchaka 004547f970 [2.7] bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is not a dictionary. (GH-3485). (#3493)
(cherry picked from commit 252033d50e)
2017-09-11 10:01:31 +03:00
Serhiy Storchaka 6ed7aff894 [2.7] bpo-29526: Add reference to help('FORMATTING') in format() builtin (GH-166). (#3492)
(cherry picked from commit 2e6bb4484e)
2017-09-11 09:26:39 +03:00
Yuan Chao Chou 5fbb8e367d Fix a shadow-compatible-local warning (#2182)
Change the shadowing naming, 'value' (Python-ast.c:3814), to 'val'
to prevent the variables from being misused.
2017-08-04 10:54:27 -07:00
Antoine Pitrou 828488393c [2.7] bpo-30765: Avoid blocking when PyThread_acquire_lock() is asked not to (GH-2403) (#2420)
* [2.7] bpo-30765: Avoid blocking when PyThread_acquire_lock() is asked not to (GH-2403)

* bpo-30765: Avoid blocking when PyThread_acquire_lock() is asked not to lock

This is especially important if PyThread_acquire_lock() is called reentrantly
(for example from a signal handler).

* Update 2017-06-26-14-29-50.bpo-30765.Q5iBmf.rst

* Avoid core logic when taking the mutex failed.
(cherry picked from commit f84ac420c2)

* Remove test undef
2017-06-26 22:13:39 +02:00
Mariatta 536209ef92 bpo-23787: Change sum() docstring from sequence to iterable (GH-1859)
* bpo-23787: Change sum() docstring from sequence to iterable

Original patch by Raymond Hettinger.
2017-06-06 09:12:03 -07:00
Xiang Zhang 05469fa1c0 bpo-30281: Fix the default value for stop in PySlice_Unpack() (#1531) (#1480) 2017-05-10 19:20:28 +08:00
Victor Stinner 2c7085fd7b bpo-27593: Get SCM build info from git instead of hg (#1327)
Based on commit 5c4b0d063a by Ned
Deily, which is based on original patches by Brett Cannon and Steve
Dower.

Remove also the private _Py_svnversion() function and SVNVERSION
variable.

Note: Py_SubversionRevision() and Py_SubversionShortBranch() are
unchanged, they are part of the public API.
2017-05-02 16:55:50 +02:00
Serhiy Storchaka 079f21f873 bpo-29935: Fixed error messages in the index() method of tuple and list (#887) (#907) (#910)
when pass indices of wrong type.
(cherry picked from commit d4edfc9abf)
(cherry picked from commit bf4bb2e430)
2017-03-30 20:32:18 +03:00
Serhiy Storchaka 9fbb65e646 bpo-29655: Fixed possible reference leaks in `import *`. (#301) (#510)
Original patch by Matthias Bussonnier.
(cherry picked from commit 160edb4357)
2017-03-08 13:44:33 +02:00
Xiang Zhang b4f0e980b6 bpo-28598: Support __rmod__ for RHS subclasses of str in % string formatting operations (GH-366) 2017-03-01 14:28:14 +08:00
Mark Dickinson ea82972ec8 Issue #14376: sys.exit now accepts longs as well as ints. Thanks Gareth Rees. 2017-02-02 19:31:53 +00:00
Victor Stinner 01bdbad3e9 Don't use getentropy() on Linux
Issue #29188: Support glibc 2.24 on Linux: don't use getentropy() function but
read from /dev/urandom to get random bytes, for example in os.urandom().  On
Linux, getentropy() is implemented which getrandom() is blocking mode, whereas
os.urandom() should not block.
2017-01-09 11:10:41 +01:00
Benjamin Peterson 2f7d13c662 only include sys/random.h if it seems like it might have something useful (#29057) 2017-01-01 22:29:36 -06:00
Benjamin Peterson ea02cdc7ec ring in 2017 for Python 2017-01-01 22:04:13 -06:00
Benjamin Peterson 6b1c909c08 add a specific configure check for sys/random.h (closes #28932) 2016-12-19 23:54:25 -08:00
Ned Deily 09231e657a Issue #28676: Prevent missing 'getentropy' declaration warning on macOS.
Initial patch by Gareth Rees.
2016-11-12 16:34:25 -05:00
Ned Deily 0caaa6c94d Issue #28616: Correct help for sys.version_info releaselevel component.
Patch by Anish Tambe.
2016-11-04 17:05:59 -04:00
Berker Peksag 05b84439a3 Issue #21720: Improve exception message when the type of fromlist is unicode 2016-10-17 01:05:04 +03:00
Serhiy Storchaka 08995a3390 Issue #24098: Fixed possible crash when AST is changed in process of
compiling it.
2016-10-07 21:51:09 +03:00
Martin Panter ca56dd4767 Issue #28139: Fix messed up indentation
Also update the classmethod and staticmethod doc strings and comments to
match the RST documentation.
2016-09-17 07:54:55 +00:00
sashk fd2f85d6e4 Issue #27806: Fix 32-bit builds on macOS Sierra 10.12 broken by removal of
deprecated QuickTime/QuickTime.h header file.  Patch by sashk.
2016-09-16 09:08:45 -04:00
Martin Panter 5f75502a2e Issue #24366: Fix indentation
Backports changes by Victor Stinner, Hirokazu Yamamoto, li4ick and Benjamin
Peterson.
2016-09-15 01:50:53 +00:00
Benjamin Peterson e4668aade9 fix misleading indentation (closes #28139) 2016-09-13 21:48:57 -07:00
Raymond Hettinger e62a694fee Issue #26020: Fix evaluation order for set literals 2016-09-08 15:25:19 -07:00
Eric Snow bf00bc783f Issue #15578: Correctly incref the parent module while importing. 2016-09-07 19:08:02 -07:00
Martin Panter 3d36f0f712 Spelling and grammar fixes in code comments and documentation 2016-07-28 02:37:04 +00:00
Benjamin Peterson 6c4fa70da6 make too many nested blocks be a SyntaxError instead of a SystemError (closes #27514)
Patch by Ammar Askar.
2016-07-14 22:00:03 -07:00
Martin Panter b362f75f6e Issue #25523: Correct "a" article to "an" article
This changes the main documentation, doc strings, source code comments, and a
couple error messages in the test suite. In some cases the word was removed
to fix the grammar.
2015-11-02 03:37:02 +00:00
Benjamin Peterson 64c82753de reduce marshal stack size in debug mode on windows (closes #27019) 2016-07-06 23:37:02 -07:00
Serhiy Storchaka 3c9ce74c21 Issue #23908: os functions, open() and the io.FileIO constructor now reject
unicode paths with embedded null character on Windows instead of silently
truncate them.
2016-07-01 23:34:44 +03:00
Serhiy Storchaka 34cb3f026b Issue #27301: Fixed incorrect return code for error in compile.c. 2016-06-15 20:06:29 +03:00
Martin Panter 7740c406bc Fix typo in comment 2016-06-10 08:07:11 +00:00
Martin Panter b5f487a090 Fix typo in code comment 2016-06-04 04:57:19 +00:00
Martin Panter b1d867f149 Issue #27076: Doc, comment and test function name spelling fixes
Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
2016-05-26 05:28:50 +00:00
Serhiy Storchaka 12cf60c7fa Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N"
format unit.
2016-05-20 22:31:24 +03:00
Zachary Ware fd58349556 Issue #26874: Simplify the divmod docstring.
Now it actually matches the prose docs.
2016-04-28 14:38:48 -05:00
Zachary Ware 64f8c7ec4f Issue #26874: Make divmod docstring and full doc match 2016-04-28 14:23:48 -05:00
Serhiy Storchaka 9a118f1dc3 Issue #26778: Fixed "a/an/and" typos in code comment and documentation. 2016-04-17 09:37:36 +03:00
Martin Panter 0bb165ecc1 Issue #4806: Avoid masking TypeError when *-unpacking a generator
Based on patch by Hagen Fürstenau.
2016-01-31 06:30:56 +00:00
Martin Panter 6a8163a928 Correct “an” → “a” with “Unicode”, “user”, “UTF”, etc
This affects documentation and code comments.
2016-04-15 02:14:19 +00:00