Commit Graph

11915 Commits

Author SHA1 Message Date
Berker Peksag 5c0eed7375
bpo-12178: Fix escaping of escapechar in csv.writer() (GH-13710)
Co-authored-by: Itay Elbirt <anotahacou@gmail.com>
2020-09-20 09:38:07 +03:00
Peter McCormick bfee9fad84
bpo-41815: SQLite: segfault if backup called on closed database (GH-22322)
# [bpo-41815](): SQLite: fix segfault if backup called on closed database

Attempting to backup a closed database will trigger segfault:

```python
import sqlite3
target = sqlite3.connect(':memory:')
source = sqlite3.connect(':memory:')
source.close()
source.backup(target)
```
2020-09-19 20:40:46 -07:00
Vladimir Matveev 2b05361bf7
bpo-41756: Introduce PyGen_Send C API (GH-22196)
The new API allows to efficiently send values into native generators
and coroutines avoiding use of StopIteration exceptions to signal 
returns.

ceval loop now uses this method instead of the old "private"
_PyGen_Send C API. This translates to 1.6x increased performance
of 'await' calls in micro-benchmarks.

Aside from CPython core improvements, this new API will also allow 
Cython to generate more efficient code, benefiting high-performance
IO libraries like uvloop.
2020-09-18 18:38:38 -07:00
Raymond Hettinger ec8a15b034
Make fractional value accumulation consistent inside and outside the loop. (GH-22315) 2020-09-18 17:57:28 -07:00
Serhiy Storchaka 0b419b7910
bpo-41662: Fix bugs in binding parameters in sqlite3 (GH-21998)
* When the parameters argument is a list, correctly handle the case
  of changing it during iteration.
* When the parameters argument is a custom sequence, no longer
  override an exception raised in ``__len__()``.
2020-09-17 10:35:44 +03:00
Raymond Hettinger 457d4e97de
bpo-41513: Add docs and tests for hypot() (GH-22238) 2020-09-13 23:33:41 -07:00
Mohamed Koubaa f76d894dc5
bpo-1635741: Port cmath to multi-phase init (PEP 489) (GH-22165) 2020-09-10 16:09:04 +02:00
Jakub Kulík fa8c9e7010
bpo-41687: Fix error handling in Solaris sendfile implementation (GH-22128)
I just realized that my recent PR with sendfile on Solaris ([PR 22040](https://github.com/python/cpython/pull/22040)) has broken error handling.

Sorry for that, this simple followup fixes that.

Automerge-Triggered-By: @1st1
2020-09-09 12:29:42 -07:00
Mohamed Koubaa 3ff6975e2c
bpo-1635741: port scproxy to multi-phase init (GH-22164) 2020-09-09 12:28:48 +09:00
Mohamed Koubaa 52a2df135c
bpo-1635741: Convert _sha256 types to heap types (GH-22134)
Convert the _sha256 extension module types to heap types.
2020-09-08 11:16:14 +02:00
Mohamed Koubaa 15dcdb2113
bpo-1635741: Port the termios to multi-phase init (PEP 489) (GH-22139) 2020-09-08 10:59:15 +02:00
Erlend Egeberg Aasland 207c321f13
bpo-40744: Drop support for SQLite pre 3.7.3 (GH-20909)
Remove code required to support SQLite pre 3.7.3.

Co-written-by: Berker Peksag <berker.peksag@gmail.com>
Co-written-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
2020-09-07 22:26:54 +01:00
Mohamed Koubaa 1baf030a90
bpo-1635741 port _curses_panel to multi-phase init (PEP 489) (GH-21986) 2020-09-07 17:14:25 +02:00
Mohamed Koubaa 2aabc3200b
bpo-1635741: Port _overlapped module to multi-phase init (GH-22051)
Port the _overlapped extension module to multi-phase initialization (PEP 489).
2020-09-07 15:12:40 +02:00
Mohamed Koubaa 426f2b4f13
bpo-1635741: Port _opcode module to multi-phase init (PEP 489) (GH-22050) 2020-09-07 10:48:44 +02:00
Mohamed Koubaa 1aaa21ff81
bpo-1635741 port zlib module to multi-phase init (GH-21995)
Port the zlib extension module to multi-phase initialization (PEP 489).
2020-09-07 10:27:55 +02:00
Raymond Hettinger 67c998de24
bpo-41513: Expand comments and add references for a better understanding (GH-22123) 2020-09-06 15:10:07 -07:00
Mohamed Koubaa 63f102fe07
bpo-1635741: Port _sha1, _sha512, _md5 to multiphase init (GH-21818)
Port the _sha1, _sha512, and _md5 extension modules
to multi-phase initialization API (PEP 489).
2020-09-06 12:09:51 +02:00
Erlend Egeberg Aasland 7f331c898a
bpo-40318: Migrate to SQLite3 trace v2 API (GH-19581)
Ref. https://sqlite.org/c3ref/trace_v2.html

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-09-05 21:43:31 +01:00
Jakub Kulík 8c0be6fd91
bpo-41687: Fix sendfile implementation to work with Solaris (#22040) 2020-09-05 12:10:01 -07:00
Serhiy Storchaka 8171580871
bpo-41638: Improve ProgrammingError message for absent parameter. (GH-21999)
It contains now the name of the parameter instead of its index when parameters
are supplied as a dict.
2020-09-04 20:55:41 +03:00
Victor Stinner 4b8032e5a4
bpo-41713: _signal doesn't use multi-phase init (GH-22087)
Partially revert commit 71d1bd9569c8a497e279f2fea6fe47cd70a87ea3:
don't use multi-phase initialization (PEP 489) for the _signal
extension module.
2020-09-04 14:51:05 +02:00
Mohamed Koubaa 71d1bd9569
bpo-1635741: Port _signal module to multi-phase init (PEP 489) (GH-22049) 2020-09-03 10:21:06 +02:00
Benjamin Peterson 3940333637
closes bpo-41689: Preserve text signature from tp_doc in C heap type creation. (GH-22058) 2020-09-02 11:29:06 -05:00
Pablo Galindo f9c5e3f5f6
bpo-41675: Modernize siginterrupt calls (GH-22028)
siginterrupt is deprecated:

./Modules/signalmodule.c:667:5: warning: ‘siginterrupt’ is deprecated: Use sigaction with SA_RESTART instead [-Wdeprecated-declarations]
  667 |     if (siginterrupt(signalnum, flag)<0) {
2020-09-02 15:29:12 +01:00
Mohamed Koubaa 93d50a6a8d
bpo-1635741: Port _sha3 module to multi-phase init (GH-21855)
Port the _sha3 extension module to multi-phase init (PEP 489).
Convert static types to heap types.
2020-09-02 11:55:19 +02:00
Mohamed Koubaa a7f026870d
bpo-1635741: Port _blake2 module to multi-phase init (GH-21856)
Port the _blake2 extension module to the multi-phase
initialization API (PEP 489).
2020-09-02 11:45:13 +02:00
Raymond Hettinger 5b24d1592a
Improve hypot() accuracy with three separate accumulators (GH-22032) 2020-09-01 22:00:50 -07:00
Raymond Hettinger 92c38164a4
Further improve accuracy of math.hypot() (GH-22013) 2020-08-30 10:00:11 -07:00
Raymond Hettinger 27de28607a
bpo-41513: Save unnecessary steps in the hypot() calculation (#21994) 2020-08-29 09:11:04 -07:00
Raymond Hettinger 82e79480d6
Fix typos in comment (GH-21966) 2020-08-26 13:09:40 -07:00
Dong-hee Na 31967fd8d0
bpo-40077: Convert _operator to use PyType_FromSpec (GH-21954) 2020-08-27 02:22:27 +09:00
Raymond Hettinger 8e19c8be87
bpo-41513: More accurate hypot() (GH-21916) 2020-08-24 17:40:08 -07:00
Paul Ganssle c3dd7e45cc
bpo-41568: Fix refleaks in zoneinfo subclasses (GH-21907)
* Fix refleak in C module __init_subclass__

This was leaking a reference to the weak cache dictionary for every
ZoneInfo subclass created.

* Fix refleak in ZoneInfo subclass's clear_cache

The previous version of the code accidentally cleared the global
ZONEINFO_STRONG_CACHE variable (and inducing `ZoneInfo` to create a new
strong cache) on calls to a subclass's `clear_cache()`. This would not
affect guaranteed behavior, but it's still not the right thing to do
(and it caused reference leaks).
2020-08-17 23:40:07 +01:00
Soumendra Ganguly 97003466d4
Update the comment of termios.c (#21886) 2020-08-17 00:51:00 +09:00
Raymond Hettinger fff3c28052
bpo-41513: Improve speed and accuracy of math.hypot() (GH-21803) 2020-08-15 19:38:19 -07:00
Dima Tisnek 495bd03566
bpo-31122: ssl.wrap_socket() now raises ssl.SSLEOFError rather than OSError when peer closes connection during TLS negotiation (GH-18772)
[bpo-31122](): ssl.wrap_socket() now raises ssl.SSLEOFError rather than OSError when peer closes connection during TLS negotiation

Reproducer: http://tiny.cc/f4ztnz (tiny url because some bot keeps renaming b.p.o.-nnn as bpo links)
2020-08-15 10:01:19 -07:00
Stefan Krah 40e700ad04
bpo-40878: xlc cannot handle C99 extern inline. (GH-21887)
This applies to the default "extc99" mode.  Python does not compile with "stdc99".
2020-08-15 16:06:21 +02:00
Paul Ganssle 87d8287865
bpo-41025: Fix subclassing for zoneinfo.ZoneInfo (GH-20965)
Prior to this change, attempting to subclass the C implementation of
zoneinfo.ZoneInfo gave the following error:

    TypeError: unbound method ZoneInfo.__init_subclass__() needs an argument

https://bugs.python.org/issue41025
2020-08-13 22:38:30 -04:00
Mohamed Koubaa e087f7cd43
bpo-1635741: Port _winapi ext to multi-stage init (GH-21371) 2020-08-13 16:22:48 +02:00
Stefan Krah 6e0b788881
Catch all skip_handler cases (GH-21842) 2020-08-12 16:00:05 +02:00
Stefan Krah b5f87b93a5
Call randseed() before other imports in deccheck.py (GH-21834) 2020-08-11 21:14:51 +02:00
Mohamed Koubaa 1d541c25c8
bpo-1635741: Port multiprocessing ext to multiphase init (GH-21378)
Port the _multiprocessing extension module to multiphase initialization (PEP 489).
2020-08-11 12:32:35 +02:00
Stefan Krah 85fdafa6ea
Replace import_fresh_module in decimal test files (GH-21815) 2020-08-10 21:54:50 +02:00
Stefan Krah 39042e00ab
bpo-41324 Add a minimal decimal capsule API (#21519) 2020-08-10 16:32:21 +02:00
pxinwr 3405e05428
bpo-41440: add os.cpu_count() support for VxWorks RTOS (GH-21685) 2020-08-07 14:21:52 +09:00
Hans Petter Jansson da4e09fff6
bpo-36982: Add support for extended color functions in ncurses 6.1 (GH-17536)
Co-authored-by: Jeffrey Kintscher <websurfer@surf2c.net>
2020-08-03 23:51:33 -04:00
linchiwei123 52bf4706a3
Fix atexitmodule doc (GH-21456) 2020-07-26 20:33:00 -03:00
Stefan Krah 9b9f158275
bpo-41369 Update to libmpdec-2.5.1: new features (GH-21593) 2020-07-22 21:54:42 +02:00
Zackery Spytz eca2549f5a
bpo-41336: Fix the error handling in zoneinfo_new_instance() (GH-21546)
Do not call PyObject_CallMethod() with a live exception (like
KeyboardInterrupt).
2020-07-20 15:51:26 +03:00
Serhiy Storchaka b4c98ed41e
bpo-41288: Refactor of unpickling NEWOBJ and NEWOBJ_EX opcodes. (GH-21472)
* Share code for NEWOBJ and NEWOBJ_EX.
* More detailed error messages.
2020-07-18 11:11:21 +03:00
Mark Shannon cb9879b948
bpo-40941: Unify implicit and explicit state in the frame and generator objects into a single value. (GH-20803)
* Merge gen and frame state variables into one.

* Replace stack pointer with depth in PyFrameObject. Makes code easier to read and saves a word of memory.
2020-07-17 11:44:23 +01:00
matthewhughes934 8e836bb21c
bpo-41195: Add getter for Openssl security level (GH-21282)
Add an accessor under SSLContext.security_level as a wrapper around
SSL_CTX_get_security_level, see:
https://www.openssl.org/docs/manmaster/man3/SSL_CTX_get_security_level.html


------
This is my first time contributing, so please pull me up on all the things I missed or did incorrectly.

Automerge-Triggered-By: @tiran
2020-07-17 01:59:15 -07:00
Zackery Spytz af4eda46d1
bpo-40150: Fix mismatched argument in RegisterWaitForSingleObject() call (GH-19686) 2020-07-15 21:43:00 +03:00
Benjamin Peterson 0108b2a240
Fix -Wstring-prototypes warnings in _zoneinfo.c. (GH-21478) 2020-07-15 12:02:14 -05:00
Felix Yan 015efdbef7
bpo-41302: Fix build with system libmpdec (GH-21481)
Move definition of UNUSED from modified headers of libmpdec to
_decimal.c itself. This makes the vendored source closer to the
standalone library and fixes build with --with-system-libmpdec.

Tested to build fine with either system libmpdec or the vendored one.
2020-07-15 14:14:11 +02:00
Zackery Spytz bbceef6851
bpo-20183: Convert _locale to the Argument Clinic (GH-14201) 2020-07-15 12:07:34 +03:00
Serhiy Storchaka 4f309abf55
bpo-41288: Fix a crash in unpickling invalid NEWOBJ_EX. (GH-21458)
Automerge-Triggered-By: @tiran
2020-07-13 05:49:26 -07:00
Serhiy Storchaka b0689ae7f9
bpo-41146: Convert signal.default_int_handler() to Argument Clinic (GH-21197) 2020-07-12 19:15:20 +03:00
Zackery Spytz 545b54d2ab
bpo-20175: Convert Modules/_multiprocessing to the Argument Clinic (GH-14245) 2020-07-12 19:11:11 +03:00
Zackery Spytz b7047e59a4
bpo-20181: Convert the readline module to the Argument Clinic (#14326) 2020-07-12 19:01:03 +03:00
Serhiy Storchaka 4c8f09d7ce
bpo-36346: Make using the legacy Unicode C API optional (GH-21437)
Add compile time option USE_UNICODE_WCHAR_CACHE. Setting it to 0
makes the interpreter not using the wchar_t cache and the legacy Unicode C API.
2020-07-10 23:26:06 +03:00
Zackery Spytz 9650fe0197
bpo-20179: Convert the _overlapped module to the Argument Clinic (GH-14275) 2020-07-10 20:43:37 +03:00
Victor Stinner 8182cc2e68
bpo-39573: Use the Py_TYPE() macro (GH-21433)
Replace obj->ob_type with Py_TYPE(obj).
2020-07-10 12:40:38 +02:00
Serhiy Storchaka d878349bac
bpo-36346: Do not use legacy Unicode C API in ctypes. (#21429) 2020-07-10 11:17:21 +03:00
Zackery Spytz ee96f32ca2
bpo-41252: Fix incorrect refcounting in _ssl.c's _servername_callback() (GH-21407) 2020-07-09 03:00:21 -07:00
Tony Solomonik 529f42645d
bpo-41247: asyncio.set_running_loop() cache running loop holder (GH-21401)
The running loop holder cache variable was always set to NULL when
calling set_running_loop.

Now set_running_loop saves the newly created running loop holder in the
cache variable for faster access in get_running_loop.

Automerge-Triggered-By: @1st1
2020-07-08 12:27:31 -07:00
Zackery Spytz aebc049557
closes bpo-41235: Fix the error handling in SSLContext.load_dh_params() (GH-21385) 2020-07-07 23:21:58 -05:00
Victor Stinner 8f42748ded
bpo-29778: test_embed tests the path configuration (GH-21306) 2020-07-08 00:20:37 +02:00
Steve Dower dcbaa1b49c
bpo-29778: Ensure python3.dll is loaded from correct locations when Python is embedded (GH-21297)
Also enables using debug build of `python3_d.dll`
Reference: CVE-2020-15523
2020-07-06 17:32:00 +01:00
Pablo Galindo e51dd9dad6
bpo-29727: Register array.array as a MutableSequence (GH-21338) 2020-07-05 22:43:14 +01:00
Serhiy Storchaka b3dd5cd4a3
bpo-36346: Undeprecate private function _PyUnicode_AsUnicode(). (GH-21336) 2020-07-05 18:53:45 +03:00
Inada Naoki 13c90e82b6
Uncomment Py_DEPRECATED for Py_UNICODE APIs (GH-21318)
PyUnicode_EncodeDecimal and PyUnicode_TransformDecimalToASCII
are deprecated since Python 3.3.
But Py_DEPRECATED(3.3) was commented out.
2020-07-05 11:01:54 +09:00
Dong-hee Na c0b214bc08
bpo-1635741: Port faulthandler module to multiphase initialization (GH-21294) 2020-07-04 01:36:47 +09:00
Mohamed Koubaa 9d006977d7
bpo-1635741: Port sha256 module to multiphase init (PEP 489) (GH-21189) 2020-07-03 17:59:47 +09:00
scoder 148f329135
bpo-39960: Allow heap types in the "Carlo Verre" hack check that override "tp_setattro()" (GH-21092)
Automerge-Triggered-By: @gvanrossum
2020-07-02 17:09:28 -07:00
Rémi Lapeyre 004e64e805
bpo-40967: Remove deprecated asyncio.Task.current_task() and asyncio.Task.all_tasks() (GH-20874) 2020-07-01 20:41:21 -07:00
Lawrence D'Anna 604d95e235
bpo-41100: fix _decimal for arm64 Mac OS (GH-21228)
Patch by Lawrence Danna.
2020-06-30 11:15:46 +02:00
Serhiy Storchaka 349f76c6aa
bpo-36346: Prepare for removing the legacy Unicode C API (AC only). (GH-21223) 2020-06-30 09:03:15 +03:00
Stefan Krah 8bea91b5e9
bpo-40874 Update the required libmpdec version for the decimal module (GH-21202) 2020-06-28 22:01:01 +02:00
Zackery Spytz cd3c2bdd5d
bpo-31082: Use "iterable" in the docstring for functools.reduce() (GH-20796) 2020-06-28 15:40:54 +09:00
Guido van Rossum 9d197c7d48
bpo-35975: Only use cf_feature_version if PyCF_ONLY_AST in cf_flags (#21021) 2020-06-27 17:33:49 -07:00
Christian Heimes 9cfcdb7d6e
Remove dead code from tracemalloc (GH-21029)
tracemalloc_get_frame() checked filename == NULL two times in a row.

Signed-off-by: Christian Heimes <christian@python.org>
2020-06-27 14:13:47 +02:00
Serhiy Storchaka 700cfa8c90
bpo-41069: Make TESTFN and the CWD for tests containing non-ascii characters. (GH-21035) 2020-06-25 17:56:31 +03:00
Serhiy Storchaka a7dc714701
bpo-41094: Additional fix for PYTHONSTARTUP. (GH-21119) 2020-06-24 19:46:30 +03:00
Serhiy Storchaka 6c6810d989
bpo-41094: Fix decoding errors with audit when open files. (GH-21095) 2020-06-24 08:46:05 +03:00
Anthony Sottile d051801052
bpo-31938: Fix default-value signatures of several functions in the select module (GH-21066) 2020-06-23 23:49:56 +02:00
Raymond Hettinger 930f4518ae
On path with known exact float, extract the double with the fast macro. (GH-21072) 2020-06-23 11:45:25 -07:00
Raymond Hettinger 32f2eda859
bpo-40521: Remove freelist from collections.deque() (GH-21073) 2020-06-23 06:50:15 -07:00
WildCard65 1d3dad5f96
bpo-41085: Fix array.array.index() on 64-bit Windows (GH-21071)
Fix integer overflow in the :meth:`array.array.index` method on 64-bit Windows
for index larger than ``2**31``.
2020-06-23 15:21:16 +02:00
Victor Stinner b4e85cadfb
bpo-40521: Make dict free lists per-interpreter (GH-20645)
Each interpreter now has its own dict free list:

* Move dict free lists into PyInterpreterState.
* Move PyDict_MAXFREELIST define to pycore_interp.h
* Add _Py_dict_state structure.
* Add tstate parameter to _PyDict_ClearFreeList() and _PyDict_Fini().
* In debug mode, ensure that the dict free lists are not used after
  _PyDict_Fini() is called.
* Remove "#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS".
2020-06-23 11:33:18 +02:00
Dong-hee Na 1937edd376
bpo-1635741: Port _lzma module to multiphase initialization (GH-19382) 2020-06-23 00:53:07 +09:00
Victor Stinner c45dbe93b7
bpo-41078: Add pycore_list.h internal header file (GH-21057)
* Move _PyList_ITEMS() to pycore_list.h.
* The C extension "_heapq" is now built with Py_BUILD_CORE_MODULE
  macro defined to access the internal C API.
2020-06-22 17:39:32 +02:00
Victor Stinner 384621c42f
bpo-41078: Rename pycore_tupleobject.h to pycore_tuple.h (GH-21056) 2020-06-22 17:27:35 +02:00
Serhiy Storchaka c88239f864
bpo-26407: Do not mask errors in csv. (GH-20536)
Unexpected errors in calling the __iter__ method are no longer
masked by TypeError in csv.reader(), csv.writer.writerow() and
csv.writer.writerows().
2020-06-22 11:21:59 +03:00
Christian Heimes 4901ea9526
bpo-41061: Fix incorrect expressions in hashtable (GH-21028)
Signed-off-by: Christian Heimes <christian@python.org>
2020-06-22 00:41:48 -07:00
Gregory P. Smith d780fa7931
bpo-41056: Fix a possible MemoryError leak within zoneinfo. (GH-21007)
This was detected by our Coverity scan as a REVERSE_INULL issue.

Automerge-Triggered-By: @gpshead
2020-06-22 00:39:28 -07:00
Dong-hee Na 6989af0bc7
bpo-41052: Opt out serialization/deserialization for _random.Random (GH-21002) 2020-06-21 18:44:58 +09:00
Gregory P. Smith 3ccb96c978
bpo-41056: Use the fildes converter for fd to please Coverity. (GH-21011)
There are a bunch of other fd: int uses in this file, I expect many if not
all of them would be better off using the fildes converter.  This particular
one was flagged by Coverity as it presumably flags fpathconf as not accepting
negative fds.  I'd expect the other fd's to have been flagged as well
otherwise.

I'm marking this one as skip news as it really is a no-op.
2020-06-20 15:06:48 -07:00
Gregory P. Smith eb0d5c38de
bpo-41056: Fix a NULL pointer dereference on MemoryError within the ssl module. (GH-21009)
Detected by Coverity.
2020-06-20 12:15:03 -07:00