Commit Graph

108442 Commits

Author SHA1 Message Date
Pablo Galindo 27ac19cca2
bpo-41976: Fix the fallback to gcc of ctypes.util.find_library when using gcc>9 (GH-22598) 2020-10-08 19:31:19 +01:00
E-Paine aecf036738
bpo-41306: Allow scale value to not be rounded (GH-21715)
This fixes the test failure with Tk 6.8.10 which is caused by changes to how Tk rounds the `from`, `to` and `tickinterval` arguments. This PR uses `noconv` if the patchlevel is greater than or equal to 8.6.10 (credit to Serhiy for this idea as it is much simpler than what I previously proposed).

Going into more detail for those who want it, the Tk change was made in [commit 591f68c](591f68cb38) and means that the arguments listed above are rounded relative to the value of `from`. However, when rounding the `from` argument ([line 623](591f68cb38/generic/tkScale.c (L623))), it is rounded relative to itself (i.e. rounding `0`) and therefore the assigned value for `from` is always what is given (no matter what values of `from` and `resolution`).

Automerge-Triggered-By: @pablogsal
2020-10-08 06:30:13 -07:00
Pablo Galindo 4a9f82f50d
bpo-41970: Avoid test failure in test_lib2to3 if the module is already imported (GH-22595)
…

Automerge-Triggered-By: @pablogsal
2020-10-08 06:24:28 -07:00
Phil Elson 35f041dd01
bpo-41376: Fix the documentation of `site.getusersitepackages()` (GH-21602)
`site.getusersitepackages()` returns the location of the user-specific site-packages directory
even when the user-specific site-packages is disabled.

```
$ python -s -m site
sys.path = [
    '/home/user/conda/lib/python37.zip',
    '/home/user/conda/lib/python3.7',
    '/home/user/conda/lib/python3.7/lib-dynload',
    '/home/user/conda/lib/python3.7/site-packages',
]
USER_BASE: '/home/user/.local' (exists)
USER_SITE: '/home/user/.local/lib/python3.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: False
```

It was not practical to prevent the function from returning None if user-specific site-packages are disabled, since there are other uses of the function which are relying on this behaviour (e.g. `python -m site`).
2020-10-08 15:37:46 +09:00
Raymond Hettinger 4e0ce82058
Revert "bpo-26680: Incorporate is_integer in all built-in and standard library numeric types (GH-6121)" (GH-22584)
This reverts commit 58a7da9e12.
2020-10-07 16:43:44 -07:00
Mikhail Golubev 4f3c25043d
bpo-41923: PEP 613: Add TypeAlias to typing module (#22532)
This special marker annotation is intended to help in distinguishing
proper PEP 484-compliant type aliases from regular top-level variable
assignments.
2020-10-07 14:44:31 -07:00
Stefan Pochmann f90dc36c15
Fix comment about PyObject_IsTrue. (GH-22343)
The `for` statement doesn't use a condition and this function, the `while` statement does.
2020-10-07 09:12:52 -05:00
Batuhan Taskaya 044a1048ca
bpo-38605: Make 'from __future__ import annotations' the default (GH-20434)
The hard part was making all the tests pass; there are some subtle issues here, because apparently the future import wasn't tested very thoroughly in previous Python versions.

For example, `inspect.signature()` returned type objects normally (except for forward references), but strings with the future import. We changed it to try and return type objects by calling `typing.get_type_hints()`, but fall back on returning strings if that function fails (which it may do if there are future references in the annotations that require passing in a specific namespace to resolve).
2020-10-06 13:03:02 -07:00
Ben Avrahami bef7d299eb
bpo-41905: Add abc.update_abstractmethods() (GH-22485)
This function recomputes `cls.__abstractmethods__`.
Also update `@dataclass` to use it.
2020-10-06 10:40:50 -07:00
Florian Bruhin a8bf44d049
bpo-41944: No longer call eval() on content received via HTTP in the UnicodeNames tests (GH-22575)
Similarly to GH-22566, those tests called eval() on content received via
HTTP in test_named_sequences_full. This likely isn't exploitable because
unicodedata.lookup(seqname) is called before self.checkletter(seqname,
None) - thus any string which isn't a valid unicode character name
wouldn't ever reach the checkletter method.

Still, it's probably better to be safe than sorry.
2020-10-06 16:21:56 +02:00
Serhiy Storchaka 2ef5caa58f
bpo-41944: No longer call eval() on content received via HTTP in the CJK codec tests (GH-22566) 2020-10-06 15:14:51 +03:00
Pablo Galindo 91e3339066
Post 3.10.0a1 2020-10-05 21:16:35 +01:00
Pablo Galindo 8e9afaf822
Python 3.10.0a1 2020-10-05 18:30:18 +01:00
Brett Cannon d02d824e05
bpo-41584: clarify when the reflected method of a binary arithemtic operator is called (#22505) 2020-10-05 09:42:21 -07:00
Victor Stinner 1fce240d6c
bpo-41939: Fix test_site.test_license_exists_at_url() (#22559)
Call urllib.request.urlcleanup() to reset the global
urllib.request._opener.
2020-10-05 18:24:00 +02:00
Terry Jan Reedy 060937da98
bpo-41774: Tweak new programming FAQ entry (GH-22562)
Remove mention of space in "remove multiple items from list".
2020-10-05 10:31:44 -04:00
Serhiy Storchaka dcc54215ac
bpo-41936. Remove macros Py_ALLOW_RECURSION/Py_END_ALLOW_RECURSION (GH-22552) 2020-10-05 12:32:00 +03:00
Erlend Egeberg Aasland 9a7642667a
bpo-41557: Update macOS installer to use SQLite 3.33.0 (GH-21959)
https://sqlite.org/releaselog/3_33_0.html
2020-10-05 01:09:16 -07:00
Fidget-Spinner 8e1dd55e63
bpo-41428: Documentation for PEP 604 (gh-22517) 2020-10-04 21:40:52 -07:00
scoder 40db798692
bpo-41892: Clarify that an example in the ElementTree docs explicitly avoids modifying an XML tree while iterating over it. (GH-22464) 2020-10-04 19:13:46 -04:00
Serhiy Storchaka 9ece9cd65c
bpo-41909: Enable previously disabled recursion checks. (GH-22536)
Enable recursion checks which were disabled when get __bases__ of
non-type objects in issubclass() and isinstance() and when intern
strings. It fixes a stack overflow when getting __bases__ leads
to infinite recursion.

Originally recursion checks was disabled for PyDict_GetItem() which
silences all errors including the one raised in case of detected
recursion and can return incorrect result. But now the code uses
PyDict_GetItemWithError() and PyDict_SetDefault() instead.
2020-10-05 00:55:57 +03:00
Manan Kumar Garg 619f98045d
Typo fix (GH-22496)
Multiple typo fixes in code comments

Automerge-Triggered-By: @Mariatta
2020-10-04 14:28:43 -07:00
Pablo Galindo 2cc6dc9896
bpo-41490: Bump vendored pip to version 20.2.3 (#22527) 2020-10-04 18:45:31 +02:00
Hansraj Das a619af43cc
Delete extra 'the' from `Formatter` class docstring (GH-22530) 2020-10-04 17:09:26 +01:00
Irit Katriel 1ed5443526
bpo-41898: add caveat on root logger seeing all messages in assertLogs doc (GH-22526) 2020-10-04 14:16:04 +01:00
Batuhan Taskaya e799aa8b92
bpo-41887: omit leading spaces/tabs on ast.literal_eval (#22469)
Also document that eval() does this (the same way).
2020-10-03 17:46:44 -07:00
Andre Delfino 7f54e563dc
[doc] Use list[int] instead of List[int] (etc.) in a few more places (GH-22524)
This changes a few occurrences left behind by #22340.

Automerge-Triggered-By: @gvanrossum
2020-10-03 15:10:59 -07:00
Pablo Galindo fb0a4651f1
bpo-41840: Report module-level globals as both local and global in the symtable module (GH-22391) 2020-10-03 20:45:55 +01:00
Dong-hee Na d646e91f5c
bpo-41922: Use PEP 590 vectorcall to speed up reversed() (GH-22523) 2020-10-04 02:16:56 +09:00
Andre Delfino 3fe6148937
[doc] Fix link to abc.collections.Iterable (GH-22520)
Missed this occurrence before, sorry. Also changed "the PEP" to "PEP".

Automerge-Triggered-By: @gvanrossum
2020-10-03 08:51:13 -07:00
Jason R. Coombs ebbe8033b1
bpo-40564: Avoid copying state from extant ZipFile. (GH-22371)
bpo-40564: Avoid copying state from extant ZipFile.
2020-10-03 10:58:39 -04:00
Pablo Galindo c111355480
bpo-41826: Fix compiler warnings in test_peg_generator (GH-22455)
Co-authored-by: Skip Montanaro
2020-10-03 17:28:51 +03:00
Ram Rachum 52301312bb
bpo-41867: List options for timespec in docstrings of isoformat methods (GH-22418) 2020-10-03 13:43:47 +03:00
Ram Rachum f97e42ef4d
bpo-40833: Clarify Path.rename doc-string regarding relative paths (GH-20554) 2020-10-03 12:52:13 +03:00
scoder 6a412c94b6
bpo-41900: C14N 2.0 serialisation failed for unprefixed attributes when a default namespace was defined. (GH-22474) 2020-10-03 08:07:07 +02:00
Andre Delfino d4b9edd505
[doc] Fix link to abc.collections.Iterable (GH-22502)
Automerge-Triggered-By: @gvanrossum
2020-10-02 16:15:28 -07:00
Andre Delfino bd71a43340
Fix is_typeddict markup (#22501) 2020-10-02 15:36:26 -07:00
Hansraj Das 9cd01ece78
Typo fix - "mesasge" should be "message" (GH-22498)
* Correct at 2 places in email module
2020-10-02 13:21:45 -07:00
Campbell Barton 20ce62f009
bpo-41802: Document 'PyDict_DelItem' can raise a 'KeyError' (GH-22291) 2020-10-02 19:18:01 +03:00
Victor Stinner 583ee5a5b1
bpo-41692: Deprecate PyUnicode_InternImmortal() (GH-22486)
The PyUnicode_InternImmortal() function is now deprecated and will be
removed in Python 3.12: use PyUnicode_InternInPlace() instead.
2020-10-02 14:49:00 +02:00
Raymond Hettinger 497126f7ea
Update link to supporting references (GH-22488) 2020-10-01 19:30:54 -07:00
Andre Delfino c8bb24166e
[doc] Update references to NumPy (GH-22458)
Numeric(al) Python to NumPy. It seems the old name hasn't been used for some time.
2020-10-01 16:22:14 -07:00
Victor Stinner bd0a08ea90
bpo-21955: Change my nickname in BINARY_ADD comment (GH-22481) 2020-10-01 18:57:37 +02:00
Robert Smallshire 58a7da9e12
bpo-26680: Incorporate is_integer in all built-in and standard library numeric types (GH-6121)
* bpo-26680: Adds support for int.is_integer() for compatibility with float.is_integer().

The int.is_integer() method always returns True.

* bpo-26680: Adds a test to ensure that False.is_integer() and True.is_integer() are always True.

* bpo-26680: Adds Real.is_integer() with a trivial implementation using conversion to int.

This default implementation is intended to reduce the workload for subclass
implementers. It is not robust in the presence of infinities or NaNs and
may have suboptimal performance for other types.

* bpo-26680: Adds Rational.is_integer which returns True if the denominator is one.

This implementation assumes the Rational is represented in it's
lowest form, as required by the class docstring.

* bpo-26680: Adds Integral.is_integer which always returns True.

* bpo-26680: Adds tests for Fraction.is_integer called as an instance method.

The tests for the Rational abstract base class use an unbound
method to sidestep the inability to directly instantiate Rational.
These tests check that everything works correct as an instance method.

* bpo-26680: Updates documentation for Real.is_integer and built-ins int and float.

The call x.is_integer() is now listed in the table of operations
which apply to all numeric types except complex, with a reference
to the full documentation for Real.is_integer().  Mention of
is_integer() has been removed from the section 'Additional Methods
on Float'.

The documentation for Real.is_integer() describes its purpose, and
mentions that it should be overridden for performance reasons, or
to handle special values like NaN.

* bpo-26680: Adds Decimal.is_integer to the Python and C implementations.

The C implementation of Decimal already implements and uses
mpd_isinteger internally, we just expose the existing function to
Python.

The Python implementation uses internal conversion to integer
using to_integral_value().

In both cases, the corresponding context methods are also
implemented.

Tests and documentation are included.

* bpo-26680: Updates the ACKS file.

* bpo-26680: NEWS entries for int, the numeric ABCs and Decimal.

Co-authored-by: Robert Smallshire <rob@sixty-north.com>
2020-10-01 17:30:08 +01:00
Erlend Egeberg Aasland 256e54acdb
bpo-41861: Convert _sqlite3 CursorType and ConnectionType to heap types (GH-22478) 2020-10-01 16:03:21 +02:00
Erlend Egeberg Aasland 9031bd4fa4
bpo-41861: Convert _sqlite3 RowType and StatementType to heap types (GH-22444) 2020-10-01 15:24:31 +02:00
Dong-hee Na fa7ce08017
bpo-41870: Avoid the test when nargs=0 (GH-22462) 2020-10-01 13:50:40 +09:00
Max Smolens 63298930fb
Fix grammar in secrets module documentation (GH-22467)
From `In particularly,` to `In particular,`
2020-09-30 15:05:51 -07:00
Mark Shannon 17b5be0c0a
bpo-41670: Remove outdated predict macro invocation. (GH-22026)
Remove PREDICTion of POP_BLOCK from FOR_ITER.
2020-09-29 10:09:13 +01:00
Terry Jan Reedy 5b0181d1f6
bpo-41774: Add programming FAQ entry (GH-22402)
In the "Sequences (Tuples/Lists)" section, add
"How do you remove multiple items from a list".
2020-09-29 01:02:44 -04:00