Commit Graph

12111 Commits

Author SHA1 Message Date
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