Commit Graph

12330 Commits

Author SHA1 Message Date
Livius 85a4748118
bpo-21302: Add clock_nanosleep() implementation for time.sleep() (GH-28111)
In Unix operating systems, time.sleep() now uses the clock_nanosleep() function,
if available, which allows to sleep for an interval specified with nanosecond precision.

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-09-13 14:37:38 +02:00
Erlend Egeberg Aasland c78d5ca380
bpo-45126: Fix ref. leak in `sqlite3.Connection.__init__` (GH-28231) 2021-09-12 21:27:42 +09:00
Serhiy Storchaka 92bf8691fb
bpo-43413: Fix handling keyword arguments in subclasses of some buitin classes (GH-26456)
* Constructors of subclasses of some buitin classes (e.g. tuple, list,
  frozenset) no longer accept arbitrary keyword arguments.
* Subclass of set can now define a __new__() method with additional
  keyword parameters without overriding also __init__().
2021-09-12 13:27:50 +03:00
Dong-hee Na 9abd07e596
bpo-44987: Speed up unicode normalization of ASCII strings (GH-28283) 2021-09-11 18:04:38 +03:00
David CARLIER 5f5b7d0c65
bpo-45163: Haiku build fix. (GH-28269)
linkage issues mainly for shared libs and missing system library,
also little nit into the signal extension as strsignal returns
a constant in this platform.
2021-09-11 11:46:22 +03:00
Henry-Joseph Audéoud 707137b863
bpo-40563: Support pathlike objects on dbm/shelve (GH-21849)
Co-authored-by: Hakan Çelik <hakancelik96@outlook.com>
2021-09-10 15:26:16 +03:00
Senthil Kumaran 794430700d
bpo-45067 - Verify the version of ncurses for extended color support feature usage. (GH-28260)
* issue45067 - Fix _curses compilation in CentOS 7. Verify the version of ncurses
for extended color support feature usage.

The function extended_color_content was introduced in 2017.  The ncurses-devel
package in CentOS 7 had a older version ncurses resulted in compilation error.
For compiling ncurses with extended color support, we verify the version of the
ncurses library.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-09-09 11:32:11 -07:00
Vincent Michel 06148b1870
bpo-44219: Release the GIL during isatty syscalls (GH-28250)
Release the GIL while performing isatty() system calls on arbitrary
file descriptors. In particular, this affects os.isatty(),
os.device_encoding() and io.TextIOWrapper. By extension,
io.open() in text mode is also affected.
2021-09-09 15:12:03 +02:00
Erlend Egeberg Aasland f235dd0784
bpo-38371: Remove deprecated `tkinter` split() method (GH-28237) 2021-09-08 23:02:19 +03:00
Victor Stinner cb15afcccf
bpo-39573: Py_TYPE becomes a static inline function (GH-28128)
Convert the Py_TYPE() and Py_SIZE() macros to static inline
functions. The Py_SET_TYPE() and Py_SET_SIZE() functions must now be
used to set an object type and size.
2021-09-08 11:59:13 +02:00
Matti Picus 34d82ce7cb
Remove documentation for non-existing socket class attributes (GH-28029)
The functions in question are available on the module-level only.
2021-09-07 20:09:11 +02:00
Stanisław Skonieczny 9dc363ee7c
bpo-45012: Release GIL around stat in os.scandir (GH-28085)
Releasing GIL allows other threads to continue
its work when os.scandir is fetching DirEntry.stat
info from file system.
2021-09-07 19:55:20 +02:00
Erlend Egeberg Aasland 979336de34
bpo-42064: Pass module state to trace, progress, and authorizer callbacks (GH-27940)
- add print-or-clear traceback helper
- add helpers to clear and visit saved contexts
- modify callbacks to use the new callback_context struct
2021-09-07 15:06:17 +02:00
Nikita Sobolev 8ca6b61e3f
bpo-45034: Fix how upper limit is formatted for `struct.pack("H", ...)` (GH-28178)
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-09-07 13:18:46 +01:00
Erlend Egeberg Aasland 0474d06008
bpo-44991: Normalise `sqlite3` callback naming (GH-28088)
- all callbacks are now named xxx_callback
- normalise callable naming in set_*() functions
- normalise context argument naming in callbacks

The sqlite code is being "touched" in bpo-42064 (and related issues);
this style change makes it easier to work with and review.
2021-09-07 13:43:44 +02:00
Erlend Egeberg Aasland 65c5756be9
Remove unused macros from Modules/_sqlite/microprotocols.h (GH-28171) 2021-09-05 12:59:30 +09:00
Victor Stinner 7974c30b9f
bpo-45094: Add Py_NO_INLINE macro (GH-28140)
* Rename _Py_NO_INLINE macro to Py_NO_INLINE: make it public and
  document it.
* Sort macros in the C API documentation.
2021-09-03 16:44:02 +02:00
Victor Stinner a1e15a7a60
bpo-45082: Cleanup ctypes.c_buffer alias (GH-28129)
* Remove commented deprecation of ctypes.c_buffer.
* Remove references to ctypes.c_string which doesn't exist.
* Remove StringTestCase: it only had skipped test methods.
2021-09-02 19:02:03 +02:00
Ruben Vorderman ea23e7820f
bpo-43613: Faster implementation of gzip.compress and gzip.decompress (GH-27941)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-09-02 17:02:59 +02:00
Victor Stinner 19ba2122ac
bpo-37330: open() no longer accept 'U' in file mode (GH-28118)
open(), io.open(), codecs.open() and fileinput.FileInput no longer
accept "U" ("universal newline") in the file mode. This flag was
deprecated since Python 3.3.
2021-09-02 12:58:00 +02:00
Victor Stinner a806608705
bpo-45085: Remove the binhex module (GH-28117)
The binhex module, deprecated in Python 3.9, is now removed. The
following binascii functions, deprecated in Python 3.9, are now also
removed:

* a2b_hqx(), b2a_hqx();
* rlecode_hqx(), rledecode_hqx().

The binascii.crc_hqx() function remains available.
2021-09-02 12:10:08 +02:00
Serhiy Storchaka 3c65457156
bpo-45060: Get rid of few uses of the equality operators with None (GH-28087) 2021-08-31 16:59:52 +03:00
Petr Viktorin 01dea5f12b
bpo-42064: Offset arguments for PyObject_Vectorcall in the _sqlite module (GH-27931)
This allows e.g. methods to be called efficiently by providing
space for a "self" argument; see PY_VECTORCALL_ARGUMENTS_OFFSET docs.
2021-08-31 14:34:44 +02:00
Erlend Egeberg Aasland 001ef4600f
bpo-44991: Make GIL handling more explicit in `sqlite3` callbacks (GH-27934)
- acquire the GIL at the very start[1]
- release the GIL at the very end

[1] The trace callback performs a sanity check before acquiring the GIL

Automerge-Triggered-By: GH:encukou
2021-08-31 05:18:43 -07:00
Erlend Egeberg Aasland 86d8b46523
bpo-16379: expose SQLite error codes and error names in `sqlite3` (GH-27786) 2021-08-30 19:32:21 +01:00
Tobias Bergkvist 71853a7302
bpo-44689: ctypes.util.find_library() now finds macOS 11+ system libraries when built on older macOS systems (#27251)
Previously, when built on older macOS systems, `find_library` was not able to find macOS system libraries when running on Big Sur due to changes in how system libraries are stored.
2021-08-30 02:55:47 -04:00
Victor Stinner 3fc5d84046
bpo-44394: Update libexpat copy to 2.4.1 (GH-26945)
Update the vendored copy of libexpat to 2.4.1 (from 2.2.8) to get the
fix for the CVE-2013-0340 "Billion Laughs" vulnerability. This copy
is most used on Windows and macOS.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-08-29 16:08:24 +02:00
Adam Dangoor 28db1f61f2
Fix typo in a comment in Modules/_ssl.c: s/validata/validate/ (GH-27993) 2021-08-27 13:38:24 +02:00
Soumendra Ganguly ae224bb566
bpo-41818: Add termios.tcgetwinsize(), termios.tcsetwinsize(). (GH-23686)
* Add termios.tcgetwinsize(), termios.tcsetwinsize(). Update docs.
* Add TIOCGSIZE support to termios.tcgetwinsize()
* Add TIOCSSIZE support to termios.tcsetwinsize()

Authored-by: Soumendra Ganguly <soumendraganguly@gmail.com>

* termios.tcgetwinsize() and termios.tcsetwinsize() should return/accept two-item tuples instead of lists.
* Refactor tcsetwinsize to share common code and accept any two item sequence, with overflow checking.

Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
2021-08-26 19:56:26 -07:00
Erlend Egeberg Aasland a3c11cebf1
bpo-27334: Fix reference leak introduced by GH-26202 (GH-27942) 2021-08-25 15:57:54 +02:00
Erlend Egeberg Aasland 7ecd3425d4
bpo-27334: roll back transaction if sqlite3 context manager fails to commit (GH-26202)
Co-authored-by: Luca Citi
Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
2021-08-25 11:59:42 +01:00
Erlend Egeberg Aasland 3df0fc89bc
bpo-44976: Lazy creation of sqlite3 result rows (GH-27884) 2021-08-25 11:28:47 +01:00
Pablo Galindo Salgado a24676bedc
Add tests for the C tokenizer and expose it as a private module (GH-27924) 2021-08-24 17:50:05 +01:00
Erlend Egeberg Aasland 9ed523159c
bpo-42064: Pass module state to `sqlite3` UDF callbacks (GH-27456)
- Establish common callback context struct
- Convert UDF callbacks to fetch module state from callback context
2021-08-24 05:24:09 -07:00
Serhiy Storchaka 4d68917386
bpo-44984: Rewrite test_null_strings in _testcapi (GH-27904)
Test also PyObject_Repr(NULL) and PyObject_Bytes(NULL).
2021-08-23 20:05:07 +02:00
Erlend Egeberg Aasland 6dd1cdb0cf
Remove unused UNKNOWN macros from cursor.h and prepare_protocol.h (GH-27885) 2021-08-22 22:23:45 +09:00
Erlend Egeberg Aasland 878e726701
bpo-44965: Early exit for non-DML statements in sqlite3.Cursor.executemany() (GH-27865) 2021-08-21 19:58:58 +01:00
Erlend Egeberg Aasland 243b6c3b8f
bpo-44079: Strip superfluous statement cache from sqlite3.Connection (GH-25998) 2021-08-19 00:37:53 +01:00
Hai Shi fcd651d16f
bpo-42035: Enhance test_get_type_name() of _testcapi (GH-27649) 2021-08-17 16:50:33 +02:00
Hai Shi 3e2c643ae0
bpo-42035: Add PyType_GetQualName() to get a type's qualified name. (GH-27551) 2021-08-17 15:39:34 +02:00
Ken Jin d84d2c4985
bpo-44914: Add tests for some invariants of tp_version_tag (GH-27774) 2021-08-16 20:18:36 +01:00
Irit Katriel 8ac0886091
bpo-44890: collect specialization stats if Py_DEBUG (GH-27731) 2021-08-12 12:15:06 +01:00
Serhiy Storchaka 058fb35b57
bpo-44854: Remove trailing whitespaces (GH-27689) 2021-08-09 21:32:54 +03:00
Serhiy Storchaka 0eec6276fd
bpo-44859: Improve error handling in sqlite3 and and raise more accurate exceptions. (GH-27654)
* MemoryError is now raised instead of sqlite3.Warning when
  memory is not enough for encoding a statement to UTF-8
  in Connection.__call__() and Cursor.execute().
* UnicodEncodeError is now raised instead of sqlite3.Warning when
  the statement contains surrogate characters
  in Connection.__call__() and Cursor.execute().
* TypeError is now raised instead of ValueError for non-string
  script argument in Cursor.executescript().
* ValueError is now raised for script containing the null
  character instead of truncating it in Cursor.executescript().
* Correctly handle exceptions raised when getting boolean value
  of the result of the progress handler.
* Add many tests covering different corner cases.

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
2021-08-08 08:49:44 +03:00
Ronald Oussoren 17c2316794
bpo-42971: Add errno.EQFULL (macOS) (GH-24419)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-08-06 23:35:13 +02:00
Serhiy Storchaka 7d747f26e6
bpo-44839: Raise more specific errors in sqlite3 (GH-27613)
MemoryError raised in user-defined functions will now preserve
its type. OverflowError will now be converted to DataError.
Previously both were converted to OperationalError.
2021-08-06 21:28:47 +03:00
Erlend Egeberg Aasland 8f010dc920
bpo-44822: Don't truncate `str`s with embedded NULL chars returned by `sqlite3` UDF callbacks (GH-27588) 2021-08-05 10:22:08 +03:00
Victor Stinner c34fa2bb06
bpo-41117: Cleanup subtract_refs() (GH-27593)
subtract_refs() reuses the 'op' variable rather than calling the
FROM_GC() macro twice.

Issue reported by William Pickard.
2021-08-04 18:09:14 +02:00
Noah Kantrowitz be42c06bb0
Update URLs in comments and metadata to use HTTPS (GH-27458) 2021-07-30 15:54:46 +02:00
Erlend Egeberg Aasland 2d34664051
bpo-31746: Fix broken call in GH-27431 (GH-27464) 2021-07-29 21:47:23 +01:00