Commit Graph

12214 Commits

Author SHA1 Message Date
Christian Heimes 150af75432
bpo-43788: Generate version specific _ssl_data.h (GH-25300)
Signed-off-by: Christian Heimes <christian@python.org>

Automerge-Triggered-By: GH:tiran
2021-04-09 08:02:00 -07:00
Christian Heimes d3b73f32ef
bpo-43789: OpenSSL 3.0.0 Don't call passwd callback again in error case (GH-25303) 2021-04-09 15:23:38 +02:00
Steve Dower 04732ca993
bpo-43105: Importlib now resolves relative paths when creating module spec objects from file locations (GH-25121) 2021-04-07 01:02:07 +01:00
Serhiy Storchaka b1dc1aacf8
bpo-43084: Return bool instead of int from curses.window.enclose() (GH-24398) 2021-04-05 16:50:24 +03:00
Zackery Spytz afd1265058
bpo-31956: Add start and stop parameters to array.index() (GH-25059)
Co-Authored-By: Anders Lorentsen <Phaqui@gmail.com>
2021-04-03 00:28:35 +09:00
Victor Stinner 240bcf82a1
bpo-41111: xxlimited.c defines Py_LIMITED_API (GH-25151)
xxlimited.c and xxlimited_35.c now define the Py_LIMITED_API macro,
rather than having to do it in the build recipe.

Co-authored-by: Hai Shi <shihai1992@gmail.com>
2021-04-02 16:48:11 +02:00
Inada Naoki bec8c787ec
bpo-43510: Fix emitting EncodingWarning from _io module. (GH-25146)
I forget to check PyErr_WarnEx() return value. But it will fail when -Werror is used.
2021-04-02 17:38:59 +09:00
Inada Naoki cfa176685a
Revert "bpo-43510: PEP 597: Accept `encoding="locale"` in binary mode (GH-25103)" (#25108)
This reverts commit ff3c9739bd.
2021-03-31 18:49:41 +09:00
Inada Naoki ff3c9739bd
bpo-43510: PEP 597: Accept `encoding="locale"` in binary mode (GH-25103)
It make `encoding="locale"` usable everywhere `encoding=None` is
allowed.
2021-03-31 14:26:08 +09:00
Antoine Pitrou 73b20ae2fb
bpo-41369: Finish updating the vendored libmpdec to version 2.5.1 (GH-24962)
Complete the update to libmpdec-2.5.1.

Co-authored-by: Stefan Krah <skrah@bytereef.org>
2021-03-30 18:11:06 +02:00
Inada Naoki 068ebf9729
bpo-33164: blake2: Fix Coverity scan (GH-25060) 2021-03-30 12:25:28 +09:00
Pablo Galindo 70cdf1812c
bpo-40645: Fix reference leak in the _hashopenssl extension (GH-25063) 2021-03-29 06:17:40 -07:00
Inada Naoki 4827483f47
bpo-43510: Implement PEP 597 opt-in EncodingWarning. (GH-19481)
See [PEP 597](https://www.python.org/dev/peps/pep-0597/).

* Add `-X warn_default_encoding` and `PYTHONWARNDEFAULTENCODING`.
* Add EncodingWarning
* Add io.text_encoding()
* open(), TextIOWrapper() emits EncodingWarning when encoding is omitted and warn_default_encoding is enabled.
* _pyio.TextIOWrapper() uses UTF-8 as fallback default encoding used when failed to import locale module. (used during building Python)
* bz2, configparser, gzip, lzma, pathlib, tempfile modules use io.text_encoding().
* What's new entry
2021-03-29 12:28:14 +09:00
Christian Heimes 933dfd7504
bpo-40645: use C implementation of HMAC (GH-24920)
- [x] fix tests
- [ ] add test scenarios for old/new code.

Signed-off-by: Christian Heimes <christian@python.org>
2021-03-27 06:55:03 -07:00
Raymond Hettinger 3bb19873ab
Revert "bpo-40521: Remove freelist from collections.deque() (GH-21073)" (GH-24944)
This reverts commit 32f2eda859.
It can be re-applied if the subinterpreter PEP is approved.
Otherwise, the commit degraded performance with no offsetting
benefit.
2021-03-25 13:32:23 -07:00
Ikko Ashimine 232f4cb667
Fix typo in fuzzer.c (GH-25013) 2021-03-25 00:47:21 +09:00
Victor Stinner 94faa0724f
bpo-43244: Remove ast.h, asdl.h, Python-ast.h headers (GH-24933)
These functions were undocumented and excluded from the limited C
API.

Most names defined by these header files were not prefixed by "Py"
and so could create names conflicts. For example, Python-ast.h
defined a "Yield" macro which was conflict with the "Yield" name used
by the Windows <winbase.h> header.

Use the Python ast module instead.

* Move Include/asdl.h to Include/internal/pycore_asdl.h.
* Move Include/Python-ast.h to Include/internal/pycore_ast.h.
* Remove ast.h header file.
* pycore_symtable.h no longer includes Python-ast.h.
2021-03-23 20:47:40 +01:00
Antoine Pitrou cdddc2b742
bpo-43422: Revert _decimal C API addition (GH-24960)
Stefan Krah requested the reversal of these (unreleased) changes, quoting him:
> The capsule API does not meet my testing standards, since I've focused
on the upstream mpdecimal in the last couple of months.
> Additionally, I'd like to refine the API, perhaps together with the
Arrow community.

Automerge-Triggered-By: GH:pitrou
2021-03-21 09:27:54 -07:00
Christian Heimes 77cde5042a
bpo-43577: Fix deadlock with SSLContext._msg_callback and sni_callback (GH-24957)
OpenSSL copies the internal message callback from SSL_CTX->msg_callback to
SSL->msg_callback. SSL_set_SSL_CTX() does not update SSL->msg_callback
to use the callback value of the new context.

PySSL_set_context() now resets the callback and _PySSL_msg_callback()
resets thread state in error path.

Signed-off-by: Christian Heimes <christian@python.org>
2021-03-21 16:13:09 +01:00
Rui Cunha b05b48dd7a
bpo-43571: Add IPPROTO_MPTCP macro (GH-24946)
Add IPPROTO_MPTCP constant when defined in the system headers.
2021-03-20 15:04:56 -07:00
Victor Stinner 28ad12f8fe
bpo-43244: Remove symtable.h header file (GH-24910)
Rename Include/symtable.h to to Include/internal/pycore_symtable.h,
don't export symbols anymore (replace PyAPI_FUNC and PyAPI_DATA with
extern) and rename functions:

* PyST_GetScope() to _PyST_GetScope()
* PySymtable_BuildObject() to _PySymtable_Build()
* PySymtable_Free() to _PySymtable_Free()

Remove PySymtable_Build(), Py_SymtableString() and
Py_SymtableStringObject() functions.

The Py_SymtableString() function was part the stable ABI by mistake
but it could not be used, since the symtable.h header file was
excluded from the limited C API.

The Python symtable module remains available and is unchanged.
2021-03-19 12:41:49 +01:00
Chris Burr e0b4aa0f5c
bpo-39342: Expose X509_V_FLAG_ALLOW_PROXY_CERTS in ssl module (GH-18011)
Exposes the `X509_V_FLAG_ALLOW_PROXY_CERTS` constant as `ssl.VERIFY_ALLOW_PROXY_CERTS` to allow for proxy certificate validation as described in: https://www.openssl.org/docs/man1.1.1/man7/proxy-certificates.html
2021-03-18 01:24:01 -07:00
Dennis Sweeney 448801da96
bpo-41361: Optimized argument parsing for deque_rotate (GH-24796) 2021-03-15 21:02:25 -07:00
Pablo Galindo 9c376bc1c4
bpo-43439: Wrapt the tuple in the audit events for the gc module (GH-24836) 2021-03-14 04:04:47 +01:00
Erlend Egeberg Aasland 2256a2876b
bpo-43444: Move sqlite3 MODULE_NAME from setup.py to module.h (GH-24801) 2021-03-13 17:33:39 +02:00
Antoine Pitrou ba251c2ae6
bpo-43356: Allow passing a signal number to interrupt_main() (GH-24755)
Also introduce a new C API ``PyErr_SetInterruptEx(int signum)``.
2021-03-11 23:35:45 +01:00
Pablo Galindo b4f9089d4a
bpo-43439: Add audit hooks for gc functions (GH-24794) 2021-03-10 00:53:57 +00:00
Antoine Pitrou 68245b7a10
bpo-43406: Fix possible race condition where ``PyErr_CheckSignals`` tries to execute a non-Python signal handler (GH-24756)
We can receive signals (at the C level, in `trip_signal()` in signalmodule.c) while `signal.signal` is being called to modify the corresponding handler.  Later when `PyErr_CheckSignals()` is called to handle the given signal, the handler may be a non-callable object and would raise a cryptic asynchronous exception.
2021-03-05 10:32:50 +01:00
Erlend Egeberg Aasland e161ec5dd7
bpo-43369: sqlite3_column_{text,blob} failures now raise MemoryError (GH-24723) 2021-03-04 11:50:25 +02:00
Brandt Bucher c61ec7e6b8
bpo-43394: Fix -Wstrict-prototypes warnings (GH-24737) 2021-03-03 21:53:59 -08:00
Mariusz Felisiak 3b4b2cf418
bpo-43368: Fix fetching empty bytes in sqlite3 (GH-24706)
Regression introduced in 47feb1feb2.
2021-03-03 16:16:24 +02:00
Alperen Serkan Aksöz 09605ad726
missing multiply symbol in the documentation (GH-24686) 2021-03-03 14:59:52 +01:00
Alex Henrie 25e244c925
bpo-39523: Use do-while loop pysqlite_cursor_executescript() (GH-18305) 2021-03-02 09:40:34 +02:00
Filipe Laíns 0d7ad9fb38
bpo-29753: fix merging packed bitfields in ctypes struct/union (GH-19850)
From the commit message:

> When the structure is packed we should always expand when needed,
> otherwise we will add some padding between the fields. This patch makes
> sure we always merge bitfields together. It also changes the field merging
> algorithm so that it handles bitfields correctly.

Automerge-Triggered-By: GH:jaraco
2021-02-28 14:43:19 -08:00
Erlend Egeberg Aasland 2183d06bc8
bpo-43251: sqlite3_column_name() failures now raise MemoryError (GH-24609) 2021-02-28 19:01:06 +02:00
Dong-hee Na bf9de7ab24
bpo-43335: Update macro to check gcc version (GH-24662) 2021-02-28 09:16:24 +09:00
Erlend Egeberg Aasland 5e48e83688
bpo-43294: Remove unused variables in pysqlite_connection_*() (GH-24658) 2021-02-26 16:30:22 +02:00
Erlend Egeberg Aasland 3150754f91
bpo-43314: Remove SQLITE_OPEN_URI ifdef (GH-24637)
SQLite 3.7.15 is required as by GH-24106. SQLITE_OPEN_URI was added in
SQLite 3.7.7.
2021-02-26 02:48:19 +02:00
Erlend Egeberg Aasland 91ea37c84a
bpo-43290: Remove workaround from pysqlite_step() (GH-24638)
From the SQLite 3.5.3 changelog:

sqlite3_step() returns SQLITE_MISUSE instead of crashing when called
with a NULL parameter.

The workaround no longer needed because we no longer support
SQLite releases older than 3.7.15.
2021-02-26 01:39:34 +02:00
Inada Naoki 01806d5beb
bpo-43260: io: Prevent large data remains in textio buffer. (GH-24592)
When very large data remains in TextIOWrapper, flush() may fail forever.

So prevent that data larger than chunk_size is remained in TextIOWrapper internal
buffer.

Co-Authored-By: Eryk Sun
2021-02-22 08:29:30 +09:00
Erlend Egeberg Aasland 38b6c2acd4
bpo-43269: Remove redundant extern keywords (GH-24605) 2021-02-21 12:07:49 +02:00
Erlend Egeberg Aasland bf838a6e7e
bpo-43269: Clean up sqlite3 file scope (GH-24578) 2021-02-21 02:29:19 +02:00
Victor Stinner 839184f85c
bpo-43268: local_clear() uses _PyInterpreterState_GET() (GH-24583)
Cleanup also the code.
2021-02-19 15:51:36 +01:00
Victor Stinner bcb094b41f
bpo-43268: Pass interp rather than tstate to internal functions (GH-24580)
Pass the current interpreter (interp) rather than the current Python
thread state (tstate) to internal functions which only use the
interpreter.

Modified functions:

* _PyXXX_Fini() and _PyXXX_ClearFreeList() functions
* _PyEval_SignalAsyncExc(), make_pending_calls()
* _PySys_GetObject(), sys_set_object(), sys_set_object_id(), sys_set_object_str()
* should_audit(), set_flags_from_config(), make_flags()
* _PyAtExit_Call()
* init_stdio_encoding()
* etc.
2021-02-19 15:10:45 +01:00
Victor Stinner 5592f2b9da
bpo-43268: Replace _PyThreadState_GET() with _PyInterpreterState_GET() (GH-24576)
Replace _PyThreadState_GET() with _PyInterpreterState_GET() in
functions which only need the current interpreter, but don't need the
current Python thread state.

Replace also _PyThreadState_UncheckedGet() with _PyThreadState_GET()
in faulthandler.c, since _PyThreadState_UncheckedGet() is just an
alias to _PyThreadState_GET() in practice.
2021-02-19 13:21:28 +01:00
Erlend Egeberg Aasland 2bb0bf4dd8
bpo-43258: Make sqlite3 callback functions static (GH-24574) 2021-02-19 13:59:24 +02:00
Erlend Egeberg Aasland 979b23cbe4
bpo-43258: Don't allocate sqlite3 aggregate context for empty queries (GH-24569) 2021-02-19 13:20:32 +02:00
Erlend Egeberg Aasland cc96231f0a
bpo-43249: Improve scoping in _pysqlite_fetch_one_row() (GH-24565) 2021-02-18 19:13:14 +02:00
Erlend Egeberg Aasland 47feb1feb2
bpo-43249: sqlite3_column_bytes() must follow sqlite_column_blob() (GH-24562) 2021-02-18 17:44:43 +02:00
David CARLIER 7be00ee64a
bpo-42960: Add resource.RLIMIT_KQUEUES constant from FreeBSD (GH-24251) 2021-02-18 16:26:20 +01:00
Nicholas Sim 17dbd4078b
bpo-35134, Include: Move pytime.h to cpython/pytime.h (GH-23988)
This change is backward compatible since C extension modules
must not include "pytime.h" directly, but only include "Python.h".
2021-02-16 13:04:38 +01:00
Dustin Rodrigues 755f3c1521
bpo-42819, readline: Disable bracketed paste (GH-24108) 2021-02-16 00:28:24 +01:00
Erlend Egeberg Aasland 1b57426e3a
bpo-43210: Fix byteswap comment in sha512.module.c (GH-24518) 2021-02-14 23:14:26 +09:00
Gregory P. Smith fd053fdd39
bpo-43172: readline now passes its tests when built against libedit (GH-24499)
bpo-43172: readline now passes its tests when built against libedit.

Existing irreconcilable API differences remain in readline.get_begidx
and readline.get_endidx behavior based on libreadline vs libedit use.
A note about that has been documented.
2021-02-12 12:04:46 -08:00
Erlend Egeberg Aasland 5ec7d53558
bpo-43204: Fix LibTomCrypt URL in md5module.c and sha*module.c comments (GH-24507)
Automerge-Triggered-By: GH:tiran
2021-02-12 02:34:11 -08:00
Erlend Egeberg Aasland ea46579067
bpo-40956: Fix segfault when Connection.backup is called without target (GH-24503) 2021-02-11 01:04:02 +02:00
Roland Hieber e1f7769513
bpo-13501: allow choosing between readline and libedit (GH-24189)
In contrast to macOS, libedit is available as its own include file and
library on Linux systems to prevent file name clashes. So if both
libraries are available on the system, readline is currently chosen by
default; and if only libedit is available, it is not found at all. This
patch adds a way to link against libedit by adding the following
arguments to configure:

  --with-readline           link against libreadline (the default)
  --with-readline=editline  link against libeditline
  --with-readline=no        disable building the readline module
  --without-readline        (same)

The runtime detection of libedit vs. readline was already done in commit
7105319ada (2019-12-04, serge-sans-paille: "bpo-38634: Allow
non-apple build to cope with libedit (GH-16986)").

Fixes: GH-12076 ("bpo-13501 Build or disable readline with Editline")
Fixes: bpo-13501 ("Make libedit support more generic; port readline / libedit to FreeBSD")
Co-authored-by: Enji Cooper (ngie-eign)
Co-authored-by: Martin Panter (vadmium)
Co-authored-by: Robert Marshall (kellinm)
2021-02-08 17:05:25 -08:00
Zackery Spytz effaec0bb5
bpo-43132: Fix incorrect handling of PyObject_RichCompareBool() in _zoneinfo (GH-24450)
PyObject_RichCompareBool() returns -1 on error, but this case is
not handled by the find_in_strong_cache() function.  Any exception
raised by PyObject_RichCompareBool() should be propagated.
2021-02-05 10:25:30 +02:00
Dong-hee Na f917c243c5
bpo-43106: Add os.O_EVTONLY/O_FSYNC/O_SYMLINK/O_NOFOLLOW_ANY (GH-24428) 2021-02-04 08:32:55 +09:00
Pablo Galindo bb739ec922
bpo-43108: Fix a reference leak in the curses module (GH-24420) 2021-02-02 20:38:26 +00:00
Ken Jin b5931f1d9f
bpo-42834: Fix _json internal caches for subinterpreters (GH-24121)
Make internal caches of the _json extension module
compatible with subinterpreters.
2021-02-01 17:26:56 +01:00
Anonymous Maarten 3243e8a4b4
bpo-41604: Don't decrement the reference count of the previous user_ptr when set_panel_usertpr fails (GH-21933) 2021-01-31 19:55:15 +02:00
Serhiy Storchaka 9073180db5
bpo-43083: Fix error handling in _sqlite3 (GH-24395) 2021-01-31 17:42:38 +02:00
Victor Stinner 0837f99d33
bpo-42323: Fix math.nextafter() on AIX (GH-24381)
math_nextafter_impl() must return a Python object, not a C double.
2021-01-29 23:04:50 +01:00
Victor Stinner c9b8e9c421
bpo-42979: Enhance abstract.c assertions checking slot result (GH-24352)
* bpo-42979: Enhance abstract.c assertions checking slot result

Add _Py_CheckSlotResult() function which fails with a fatal error if
a slot function succeeded with an exception set or failed with no
exception set: write the slot name, the type name and the current
exception (if an exception is set).
2021-01-27 16:39:16 +00:00
Hai Shi eeb701adc0
bpo-42979: _zoneinfo exec function checks for PyDateTime_IMPORT failure (GH-24333)
Importing datetime can fail.
2021-01-27 11:23:33 +01:00
Zackery Spytz 5327f37034
bpo-43033: Fix the handling of PyObject_SetAttrString() in _zoneinfo.c (GH-24345) 2021-01-27 10:16:20 +02:00
borispopoff c7c3b7db29
Typo in comment (GH-24199)
Automerge-Triggered-By: GH:Mariatta
2021-01-25 14:51:48 -08:00
Hai Shi 2f12a1b7ec
bpo-41798: Allocate the _curses._C_API on the heap memory (GH-24186) 2021-01-22 11:06:43 +01:00
Victor Stinner c1c3493fb7
bpo-42323: Fix math.nextafter() for NaN on AIX (GH-24265) 2021-01-20 15:20:13 +01:00
Erlend Egeberg Aasland 61d26394f9
bpo-41798: Allocate unicodedata CAPI on the heap (GH-24128) 2021-01-20 12:03:53 +01:00
Yunlongs f1ff800db1
bpo-41995: Handle allocation failure in _tracemalloc and _zoneinfo (GH-22635) 2021-01-20 09:38:28 +01:00
Benjamin Peterson 916610ef90
closes bpo-42938: Replace snprintf with Python unicode formatting in ctypes param reprs. (24239) 2021-01-18 14:47:05 -06:00
Victor Stinner 250035d134
bpo-42923: Dump extension modules on fatal error (GH-24207)
The Py_FatalError() function and the faulthandler module now dump the
list of extension modules on a fatal error.

Add _Py_DumpExtensionModules() and _PyModule_IsExtension() internal
functions.
2021-01-18 20:47:13 +01:00
Victor Stinner e232025025
bpo-42923: Add Py_FatalError() test in test_capi (GH-24240)
Move faulthandler._fatal_error() to _testcapi.fatal_error().
2021-01-18 18:24:29 +01:00
Zackery Spytz 14cfa325c2
bpo-39273: Expose BUTTON5_* constants in the curses module if available (GH-17996) 2021-01-14 11:40:09 +02:00
Erlend Egeberg Aasland a330365ca5
bpo-40956: Fix sqlite3.Cursor.fetchmany() default value (GH-24214) 2021-01-14 01:17:33 +02:00
Victor Stinner 11ef53aefb
bpo-42866: Add traverse func to _multibytecodec.MultibyteCodec (GH-24166)
Convert _multibytecodec.MultibyteCodec type to a GC type and adds a
traverse function.
2021-01-08 15:43:59 +01:00
Victor Stinner e542d417b9
bpo-42866: Fix refleak in CJK getcodec() (GH-24165)
Fix a reference leak in the getcodec() function of CJK codecs.
2021-01-08 15:01:38 +01:00
Victor Stinner 07f2cee93f
bpo-42846: Convert CJK codec extensions to multiphase init (GH-24157)
Convert the 6 CJK codec extension modules (_codecs_cn, _codecs_hk,
_codecs_iso2022, _codecs_jp, _codecs_kr and _codecs_tw) to the
multiphase initialization API (PEP 489).

Remove getmultibytecodec() local cache: always import
_multibytecodec. It should be uncommon to get a codec. For example,
this function is only called once per CJK codec module.

Fix a reference leak in register_maps() error path.
2021-01-08 00:15:22 +01:00
Hai Shi 1ab045933b
bpo-41798: Allocate the _datetime.datetime_CAPI on the heap memory (GH-24096) 2021-01-06 20:47:19 +01:00
Erlend Egeberg Aasland f22b7ca1af
bpo-41798: Allocate _socket module C API on the heap (GH-24126) 2021-01-06 20:43:06 +01:00
Erlend Egeberg Aasland fe9f446afe
bpo-41798: Allocate _decimal extension module C API on the heap (GH-24117) 2021-01-06 12:47:28 +01:00
Erlend Egeberg Aasland 203b2493ae
bpo-40959: Remove unused declarations from sqlite3 headers (GH-20828) 2021-01-06 02:56:05 +02:00
Erlend Egeberg Aasland cf0b23908c
bpo-40810: Require SQLite 3.7.15 (GH-24106) 2021-01-06 02:02:43 +02:00
Erlend Egeberg Aasland c7f8d3caf0
bpo-40956: Convert _sqlite3.Cursor to Argument Clinic (GH-24007) 2021-01-06 01:57:25 +02:00
Serhiy Storchaka 59f9b4e450
bpo-42681: Fix test_curses failures related to color pairs (GH-24089)
On ncurses 6.1 pair numbers are limited by SHORT_MAX-1, even
with extended color support.

Improve error reporting and tests for color functions.
2021-01-05 09:13:15 +02:00
Erlend Egeberg Aasland 0b858cdd5d
bpo-1635741: Convert _multibytecodec to multi-phase init (GH-24095)
Convert the _multibytecodec extension module (CJK codecs) to multi-phase
initialization (PEP 489).
2021-01-04 22:33:45 +01:00
Mohamed Koubaa c8a87addb1
bpo-1635741: Port pyexpat to multi-phase init (PEP 489) (GH-22222) 2021-01-04 15:34:26 +01:00
Joshua Root df21f502fd
bpo-42692: fix __builtin_available check on older compilers (GH-23873)
A compiler that doesn't define `__has_builtin` will error out when it is
used on the same line as the check for it.

Automerge-Triggered-By: GH:ronaldoussoren
2021-01-04 02:36:58 -08:00
Serhiy Storchaka 1470edd613
bpo-42681: Fix range checks for color and pair numbers in curses (GH-23874) 2021-01-03 22:51:11 +02:00
Hai Shi 7c83eaa536
bpo-41798: pyexpat: Allocate the expat_CAPI on the heap memory (GH-24061) 2021-01-03 16:47:44 +01:00
Erlend Egeberg Aasland b8eb376590
bpo-40077: Add traverse/clear/free to arraymodule (GH-24066) 2021-01-03 14:11:15 +01:00
Erlend Egeberg Aasland 75bf107c62
bpo-40077: Convert arraymodule to use heap types and establish module state (GH-23124) 2021-01-02 17:38:47 +01:00
Erlend Egeberg Aasland f4936ad1c4
bpo-42393: Raise OverflowError iso. DeprecationWarning on overflow in socket.ntohs and socket.htons (GH-23980) 2020-12-31 15:16:50 +02:00
Victor Stinner ba0e49a464
bpo-40137: Fix refleak in _functools_exec() (GH-24006) 2020-12-30 02:24:43 +01:00
Erlend Egeberg Aasland 84d79cfda9
bpo-40956: Convert _sqlite3.Row to Argument Clinic (GH-23964) 2020-12-29 15:22:55 +02:00
Jakub Kulík 0159e5efee
bpo-42655: Fix subprocess extra_groups gid conversion (GH-23762) 2020-12-29 14:58:27 +02:00
Hai Shi dd39123970
bpo-40137: Convert _functools module to use PyType_FromModuleAndSpec. (GH-23405) 2020-12-29 04:45:07 -08:00
Jero Bado a4258e8cd7
Fix minor typo in comments in readline.c (GH-23911) 2020-12-29 14:26:57 +02:00
Pablo Galindo a6d63a20df
Fix compiler warnings regarding loss of data (GH-23983) 2020-12-29 00:28:09 +00:00
Pablo Galindo 290f5ae997
Use Py_NewRef in Modules/_struct.c (GH-23981) 2020-12-28 23:59:16 +00:00
Erlend Egeberg Aasland bf108bb21e
bpo-40077: Fix typo in simplequeue_get_state_by_type() (GH-23975)
The typo did no damage, but it looks suspicious and confusing.
Introduced by GH-23136.

Skip news.

Automerge-Triggered-By: GH:pitrou
2020-12-28 09:47:16 -08:00
Erlend Egeberg Aasland 897387d2c8
bpo-1635741: sqlite3: Fix ref leak introduced by commit bf64d90 (GH-23972) 2020-12-28 03:09:26 +01:00
Erlend Egeberg Aasland bf64d9064a
bpo-1635741: sqlite3 uses Py_NewRef/Py_XNewRef (GH-23170) 2020-12-27 12:05:33 +01:00
Erlend Egeberg Aasland 3ccef1ca47
bpo-40956: Convert _sqlite3.Connection to Argument Clinic, part 2 (GH-23838) 2020-12-27 17:32:18 +09:00
Victor Stinner 993e88cf08
bpo-42694: Prevent creating _curses_panel.panel (GH-23948)
Fix regression introduced in
commit 1baf030a902392fe92d934ed0fb6a385cf7d8869: restore removed code
to prevent creating a _curses_panel.panel instance directly.
2020-12-26 02:17:46 +01:00
Raymond Hettinger 6b1ac809b9
bpo-25246: Optimize deque.remove() (GH-23898) 2020-12-23 11:45:06 -08:00
Victor Stinner a12491681f
bpo-32381: pymain_run_command() uses PyCF_IGNORE_COOKIE (GH-23724)
The coding cookie (ex: "# coding: latin1") is now ignored in the
command passed to the -c command line option.

Since pymain_run_command() uses UTF-8, pass PyCF_IGNORE_COOKIE
compiler flag to the parser.

pymain_run_python() no longer propages compiler flags between
function calls.
2020-12-23 19:16:56 +01:00
Christian Heimes 6d9ec8bbfa
bpo-1635741: Port resource extension module to module state (GH-23462)
Signed-off-by: Christian Heimes <christian@python.org>
2020-12-23 08:55:11 +01:00
Christian Heimes cf3565ca9a
bpo-42620: Improve socket.getsockname doc string (GH-23742)
Signed-off-by: Christian Heimes <christian@python.org>
2020-12-22 23:25:57 -08:00
Victor Stinner 52a327c1cb
bpo-39465: Add pycore_atomic_funcs.h header (GH-20766)
Add pycore_atomic_funcs.h internal header file: similar to
pycore_atomic.h but don't require to declare variables as atomic.

Add _Py_atomic_size_get() and _Py_atomic_size_set() functions.
2020-12-23 03:41:08 +01:00
erykoff b3c77ecbbe
bpo-42688: Fix ffi alloc/free when using external libffi on macos (GH-23868)
Automerge-Triggered-By: GH:ronaldoussoren
2020-12-22 03:12:07 -08:00
AMIR b8fde8b541
bpo-42008: Fix internal _random.Random() seeding for the one argument case (GH-22668) 2020-12-21 15:45:50 -08:00
Dong-hee Na 2179349d8c
bpo-40956: Fix sqlite3 AC code (GH-23837) 2020-12-19 00:41:33 +09:00
Erlend Egeberg Aasland 1ba82bbc50
bpo-40956: Convert _sqlite3.Connection to Argument Clinic (GH-23341) 2020-12-18 23:25:35 +09:00
Victor Stinner 6104013838
bpo-1635741: Port _thread to multiphase init (GH-23811)
Port the _thread extension module to the multiphase initialization
API (PEP 489) and convert its static types to heap types.

Add a traverse function to the lock type, so the garbage collector
can break reference cycles.
2020-12-18 01:39:00 +01:00
Victor Stinner aefb69b23f
bpo-40686: Fix compiler warnings on _zoneinfo.c (GH-23614)
"uint8_t day" is unsigned and so "day < 0" test is always true.
Remove the test to fix the following warnings on Windows:

modules\_zoneinfo.c(1224): warning C4068: unknown pragma
modules\_zoneinfo.c(1225): warning C4068: unknown pragma
modules\_zoneinfo.c(1227): warning C4068: unknown pragma
2020-12-16 16:26:15 +01:00
Victor Stinner 8203c73f3b
bpo-1635741: Refactor _threadmodule.c (GH-23793)
* Fix ExceptHookArgsType name: "_thread.ExceptHookArgs", instead of
  "_thread._ExceptHookArgs".
* PyInit__thread() no longer intializes interp->num_threads to 0:
  it is already done in PyInterpreterState_New().
* Use PyModule_AddType(), Py_NewRef() and Py_XNewRef().
* Replace str_dict variable with _Py_IDENTIFIER(__dict__).
* Remove assert(Py_IS_TYPE(obj, &Locktype)) from release_sentinel()
  to avoid having to retrive the type from this callback.
* Add thread_bootstate_free()
* Rename t_bootstrap() to thread_run()
* bootstate structure: rename keyw member to kwargs
2020-12-16 12:20:33 +01:00
Victor Stinner 3ca2b8fd75
bpo-42639: atexit._run_exitfuncs() uses sys.unraisablehook (GH-23779)
atexit._run_exitfuncs() now logs callback exceptions using
sys.unraisablehook, rather than logging them directly into
sys.stderr and raising the last exception.

Run GeneralTest of test_atexit in a subprocess since it calls
atexit._clear() which clears all atexit callbacks.

_PyAtExit_Fini() sets state->callbacks to NULL.
2020-12-15 17:12:02 +01:00
Victor Stinner ceb420251c
bpo-32381: pymain_run_file() uses PySys_FormatStderr() (GH-23778)
If config->run_filename doesn't exist, log the error into sys.stderr
using "%R" format, to escape properly unencodable characters (usually
with backslashreplace).
2020-12-15 16:25:27 +01:00
Petr Viktorin 6a02b38475
bpo-14935: Remove static state from the _csv module (GH-23224)
Uses code from: https://github.com/python/cpython/pull/16078

Co-authored-by: Marcel Plch <gmarcel.plch@gmail.com>
Co-authored-by: Eddie Elizondo <eduardo.elizondorueda@gmail.com>
Co-authored-by: Hai Shi <shihai1992@gmail.com>
2020-12-15 15:14:35 +01:00
Victor Stinner b8fa135908
bpo-42639: Move atexit state to PyInterpreterState (GH-23763)
* Add _PyAtExit_Call() function and remove pyexitfunc and
  pyexitmodule members of PyInterpreterState. The function
  logs atexit callback errors using _PyErr_WriteUnraisableMsg().
* Add _PyAtExit_Init() and _PyAtExit_Fini() functions.
* Remove traverse, clear and free functions of the atexit module.

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2020-12-15 14:34:19 +01:00
Victor Stinner 357704c9f2
bpo-42639: atexit now logs callbacks exceptions (GH-23771)
At Python exit, if a callback registered with atexit.register()
fails, its exception is now logged. Previously, only some exceptions
were logged, and the last exception was always silently ignored.

Add _PyAtExit_Call() function and remove
PyInterpreterState.atexit_func member. call_py_exitfuncs() now calls
directly _PyAtExit_Call().

The atexit module must now always be built as a built-in module.
2020-12-14 23:07:54 +01:00
Victor Stinner 83d52044ae
bpo-42639: Cleanup atexitmodule.c (GH-23770)
* Rename "atexitmodule_state" to "struct atexit_state".
* Rename "modstate" to "state".
* Rename "self" parameter to "module".
* test_atexit uses textwrap.dedent().
* Remove _Py_PyAtExit() function: inline it into atexit_exec().
* PyInterpreterState: rename pyexitfunc to atexit_func, rename
  pyexitmodule to atexit_module.
2020-12-14 22:40:40 +01:00
Victor Stinner a82f63f5af
bpo-32381: Add _PyRun_AnyFileObject() (GH-23723)
pymain_run_file() no longer encodes the filename: pass the filename
as an object to the new _PyRun_AnyFileObject() function.

Add new private functions:

* _PyRun_AnyFileObject()
* _PyRun_InteractiveLoopObject()
* _Py_FdIsInteractive()
2020-12-09 22:37:27 +01:00
Victor Stinner 550e4673be
bpo-32381: Add _PyRun_SimpleFileObject() (GH-23709)
pymain_run_startup() now pass the filename as a Python object to
_PyRun_SimpleFileObject().
2020-12-09 00:32:54 +01:00
Petr Viktorin c168b5078f
bpo-42111: Make the xxlimited module an example of best extension module practices (GH-23226)
- Copy existing xxlimited to xxlimited53 (named for the limited API version it uses)
- Build both modules, both in debug and release
- Test both modules
2020-12-08 08:36:53 -08:00
Brandt Bucher 226a012d1c
bpo-42536: GC track recycled tuples (GH-23623)
Several built-in and standard library types now ensure that their internal result tuples are always tracked by the garbage collector:

- collections.OrderedDict.items
- dict.items
- enumerate
- functools.reduce
- itertools.combinations
- itertools.combinations_with_replacement
- itertools.permutations
- itertools.product
- itertools.zip_longest
- zip

Previously, they could have become untracked by a prior garbage collection.
2020-12-04 19:45:57 -08:00
Victor Stinner 8b6c4a921a
bpo-42262: Py_NewRef() casts its argument to PyObject* (GH-23626)
Write also unit tests on Py_NewRef() and Py_XNewRef().
2020-12-03 14:01:10 +01:00
Pablo Galindo dedc2cd5f0
bpo-41625: Do not add os.splice on AIX due to compatibility issues (GH-23608) 2020-12-02 17:57:18 +00:00
Pablo Galindo 93a0ef7647
Correct return type in Modules/_ssl.c::sslmodule_legacy (GH-23609) 2020-12-02 06:07:56 +00:00
Victor Stinner 32bd68c839
bpo-42519: Replace PyObject_MALLOC() with PyObject_Malloc() (GH-23587)
No longer use deprecated aliases to functions:

* Replace PyObject_MALLOC() with PyObject_Malloc()
* Replace PyObject_REALLOC() with PyObject_Realloc()
* Replace PyObject_FREE() with PyObject_Free()
* Replace PyObject_Del() with PyObject_Free()
* Replace PyObject_DEL() with PyObject_Free()
2020-12-01 10:37:39 +01:00
Victor Stinner 00d7abd7ef
bpo-42519: Replace PyMem_MALLOC() with PyMem_Malloc() (GH-23586)
No longer use deprecated aliases to functions:

* Replace PyMem_MALLOC() with PyMem_Malloc()
* Replace PyMem_REALLOC() with PyMem_Realloc()
* Replace PyMem_FREE() with PyMem_Free()
* Replace PyMem_Del() with PyMem_Free()
* Replace PyMem_DEL() with PyMem_Free()

Modify also the PyMem_DEL() macro to use directly PyMem_Free().
2020-12-01 09:56:42 +01:00
Raymond Hettinger cc061d0e6f
bpo-38200: Add itertools.pairwise() (GH-23549) 2020-11-30 20:42:54 -08:00
pxinwr 1244c816d7
bpo-31904: Support signal module on VxWorks (GH-23391) 2020-11-30 22:48:33 +01:00
Serhiy Storchaka 686c203cd4
bpo-42423: Accept single base class in PyType_FromModuleAndSpec() (GH-23441) 2020-11-22 13:25:02 +02:00
Christian Heimes ea97ebab35
bpo-1635741: Port select module to multiphase init (GH-23409) 2020-11-21 20:29:26 +01:00
Christian Heimes 035deee265
bpo-1635741: Port _posixsubprocess module to multiphase init (GH-23406) 2020-11-21 20:28:14 +01:00
David CARLIER 0e62efc51e
bpo-42232: mmap module add Darwin specific madvise options. (GH-23076) 2020-11-21 03:39:56 -08:00
Devin Jeanpierre 31729366e2
bpo-40791: Make compare_digest more constant-time. (GH-20444)
* bpo-40791: Make compare_digest more constant-time.

The existing volatile `left`/`right` pointers guarantee that the reads will all occur, but does not guarantee that they will be _used_. So a compiler can still short-circuit the loop, saving e.g. the overhead of doing the xors and especially the overhead of the data dependency between `result` and the reads. That would change performance depending on where the first unequal byte occurs. This change removes that optimization.

(This is change #1 from https://bugs.python.org/issue40791 .)
2020-11-21 00:55:23 -08:00
Erlend Egeberg Aasland a6109ef68d
bpo-1635741: Convert _sre types to heap types and establish module state (PEP 384) (GH-23393) 2020-11-20 21:36:23 +09:00
Mohamed Koubaa 2db8e35489
bpo-1635741: Enhance _datetime error handling (GH-23139) 2020-11-20 11:39:40 +01:00
Christian Heimes 5c36da78d7
bpo-42333: Port _ssl extension module to heap types (GH-23392)
All types in _ssl module are now heap types.
2020-11-20 09:40:12 +01:00
Christian Heimes 03c8ddd9e9
bpo-42413: socket.timeout is now an alias of TimeoutError (GH-23413)
Signed-off-by: Christian Heimes <christian@python.org>
2020-11-20 00:26:07 -08:00
Christian Heimes b437aa83f9
bpo-1635741: Port _posixshmem extension module to multiphase initialization (GH-23404)
Signed-off-by: Christian Heimes <christian@python.org>
2020-11-19 07:20:42 -08:00
Dong-hee Na 588c7c9f08
bpo-1635741: Fix _struct for build bot error (GH-23402)
Automerge-Triggered-By: GH:tiran
2020-11-19 06:14:34 -08:00
Christian Heimes 646d7fdefb
bpo-1635741: Port gc module to multiphase initialization (GH-23377)
Signed-off-by: Christian Heimes <christian@python.org>

Automerge-Triggered-By: GH:tiran
2020-11-19 06:08:34 -08:00
Christian Heimes cfeb5437a8
bpo-1635741: Port _struct to multiphase initialization (GH-23398)
Signed-off-by: Christian Heimes <christian@python.org>
2020-11-19 22:36:23 +09:00
Christian Heimes bf9d70a1a5
bpo-1635741: Port spwd to multiphase initialization (GH-23390)
Signed-off-by: Christian Heimes <christian@python.org>
2020-11-19 10:54:03 +01:00