Commit Graph

14274 Commits

Author SHA1 Message Date
Nikita Sobolev f5a9c34f38
gh-120056: Add `IP_RECVERR`, `IP_RECVORIGDSTADDR`, `IP_RECVTTL` to `socket` module (#120058)
* gh-120056: Add `IP_RECVERR` and `IP_RECVTTL` to `socket` module

* Fix news

* Address review

* Update NEWS
2024-06-11 21:00:56 -04:00
Pablo Galindo Salgado ec3af291fe
gh-120346: Respect PYTHON_BASIC_REPL when running in interactive inspect mode (#120349) 2024-06-11 16:15:01 +00:00
Victor Stinner 7aff2de62b
gh-120057: Add os.environ.refresh() method (#120059) 2024-06-10 16:34:17 +00:00
Victor Stinner b90bd3e5bb
gh-120155: Fix Coverity issue in zoneinfo load_data() (#120232)
Declare the 'rv' varaible at the top of the load_data() function to
make sure that it's initialized before the first 'goto error' which
uses 'rv' (return rv).

Fix the Coverity issue:

Error: UNINIT (CWE-457):
Python-3.12.2/Modules/_zoneinfo.c:1233:5: skipped_decl: Jumping over declaration of ""rv"".
Python-3.12.2/Modules/_zoneinfo.c:1284:5: uninit_use: Using uninitialized value ""rv"".
  1282|       }
  1283|
  1284|->     return rv;
  1285|   }
  1286|
2024-06-10 11:54:35 +02:00
Clinton e5a7bc6f2e
gh-120296: Fix format string of fcntl.ioctl() audit (#120301) 2024-06-10 08:17:50 +00:00
neonene 38a25e9560
gh-120244: Fix re.sub() reference leak (GH-120245) 2024-06-08 10:22:07 +00:00
Saul Shanabrook 55402d3232
gh-119258: Eliminate Type Guards in Tier 2 Optimizer with Watcher (GH-119365)
Co-authored-by: parmeggiani <parmeggiani@spaziodati.eu>
Co-authored-by: dpdani <git@danieleparmeggiani.me>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
Co-authored-by: Ken Jin <kenjin@python.org>
2024-06-08 17:41:45 +08:00
Jacob Walls 6b606522ca
gh-119577: Adjust DeprecationWarning when testing element truth values in ElementTree (GH-119762)
Adjust DeprecationWarning when testing element truth values in ElementTree, we're planning to go with the more natural True return rather than a disruptive harder to code around exception raise, and are deferring the behavior change for a few more releases.
2024-06-06 20:18:30 -07:00
Sam Gross e21057b999
gh-117657: Fix TSAN race involving import lock (#118523)
This adds a `_PyRecursiveMutex` type based on `PyMutex` and uses that
for the import lock. This fixes some data races in the free-threaded
build and generally simplifies the import lock code.
2024-06-06 13:40:58 -04:00
Victor Stinner 78634cfa3d
gh-120155: Initialize variables in _tkinter.c (#120156)
Initialize variables in _tkinter.c to make static analyzers happy.
2024-06-06 17:31:33 +02:00
benchatt 14e3c7071b
gh-115225: Raise error on unsupported ISO 8601 time strings (#119339)
Some time strings that contain fractional hours or minutes are permitted
by ISO 8601, but such strings are very unlikely to be intentional. The
current parser does not parse such strings correctly or raise an error.
This change raises a ValueError when hours or minutes contain a decimal mark.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2024-06-05 13:35:40 -04:00
Pablo Galindo Salgado d9095194dd
gh-119842: Honor PyOS_InputHook in the new REPL (GH-119843)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2024-06-04 20:32:43 +02:00
Christopher Chavez e079935282
gh-112672: Fix builtin Tkinter with Tcl 9.0 (GH-112681)
* Add declaration of Tcl_AppInit(), missing in Tcl 9.0.
* Use Tcl_Size instead of int where needed.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-04 19:47:15 +03:00
Serhiy Storchaka 7111d9605f
gh-89928: Fix integer conversion of device numbers (GH-31794)
Fix os.major(), os.minor() and os.makedev().
Support device numbers larger than 2**63-1.
Support non-existent device number (NODEV).
2024-06-04 19:36:37 +03:00
Bénédikt Tran ff1857d6ed
gh-120029: export `DEF_TYPE_PARAM` compiler flag (#120028) 2024-06-04 07:24:22 -07:00
Eric Snow 105f22ea46
gh-117398: Use Per-Interpreter State for the _datetime Static Types (gh-119929)
We make use of the same mechanism that we use for the static builtin types.  This required a few tweaks.

The relevant code could use some cleanup but I opted to avoid the significant churn in this change.  I'll tackle that separately.

This change is the final piece needed to make _datetime support multiple interpreters.  I've updated the module slot accordingly.
2024-06-03 17:09:18 -06:00
Eric Snow dba7a167db
gh-117142: Support Importing ctypes in Isolated Interpreters (gh-119991)
This makes the support official.

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-06-03 16:42:48 -06:00
Eric Snow d82a7ba041
gh-117398: Add datetime Module State (gh-119810)
I was able to make use of the existing datetime_state struct, but there was one tricky thing I had to sort out.  We mostly aren't converting to heap types, so we can't use things like PyType_GetModuleByDef() to look up the module state.  The solution I came up with is somewhat novel, but I consider it straightforward.  Also, it shouldn't have much impact on performance.

In summary, this main changes here are:

* I've added some macros to help hide how various objects relate to module state
* as a solution to the module state lookup problem, I've stored the last loaded module on the current interpreter's internal dict (actually a weakref)
* if the static type method is used after the module has been deleted, it is reloaded
* to avoid extra work when loading the module, we directly copy the objects (new refs only) from the old module state into the new state if the old module hasn't been deleted yet
* during module init we set various objects on the static types' __dict__s; to simplify things, we only do that the first time; once those static types have a separate __dict__ per interpreter, we'll do it every time
* we now clear the module state when the module is destroyed (before, we were leaking everything in _datetime_global_state)
2024-06-03 15:56:00 -06:00
Sam Gross 47fb4327b5
gh-117657: Fix race involving immortalizing objects (#119927)
The free-threaded build currently immortalizes objects that use deferred
reference counting (see gh-117783). This typically happens once the
first non-main thread is created, but the behavior can be suppressed for
tests, in subinterpreters, or during a compile() call.

This fixes a race condition involving the tracking of whether the
behavior is suppressed.
2024-06-03 20:58:41 +00:00
Sergey B Kirpichev 61d3ab32da
gh-116560: Add PyLong_GetSign() public function (#116561)
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-06-03 14:06:31 +02:00
Radislav Chugunov 52586f930f
gh-119506: fix `_io.TextIOWrapper.write()` write during flush (#119507)
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2024-06-03 16:47:36 +09:00
Victor Stinner 64ff1e217d
gh-119770: Make termios ioctl() constants positive (#119840) 2024-05-31 17:18:40 +02:00
Sam Gross bcc1be39cb
gh-119585: Fix crash involving `PyGILState_Release()` and `PyThreadState_Clear()` (#119753)
Make sure that `gilstate_counter` is not zero in when calling
`PyThreadState_Clear()`. A destructor called from `PyThreadState_Clear()` may
call back into `PyGILState_Ensure()` and `PyGILState_Release()`. If
`gilstate_counter` is zero, it will try to create a new thread state before
the current active thread state is destroyed, leading to an assertion failure
or crash.
2024-05-31 10:50:52 -04:00
Christopher Chavez 94e9585e99
gh-103194: Fix Tkinter’s Tcl value type handling for Tcl 8.7/9.0 (GH-103846)
Some of standard Tcl types were renamed, removed, or no longer
registered in Tcl 8.7/9.0. This change fixes automatic conversion of Tcl
values to Python values to avoid returning a Tcl_Obj where the primary
Python types (int, bool, str, bytes) were returned in older Tcl.
2024-05-31 11:23:53 +03:00
Irit Katriel 13a5fdc72f
gh-119744: move a few functions from compile.c to flowgraph.c (#119745) 2024-05-30 21:55:06 +01:00
Steve Dower 78d697b7d5
gh-119690: Adds Unicode support for named pipes in _winapi (GH-119717) 2024-05-29 16:51:09 +01:00
Kirill Podoprigora 34f9b3e724
gh-119655: Fix reference leak in the ``_datetimemodule.c`` (gh-119713) 2024-05-29 09:43:03 -06:00
Matthias Görgens 18c1a8d3a8
gh-97588: Align ctypes struct layout to GCC/MSVC (GH-97702)
Structure layout, and especially bitfields, sometimes resulted in clearly
wrong behaviour like overlapping fields. This fixes

Co-authored-by: Gregory P. Smith <gps@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-05-29 12:02:53 +02:00
Victor Stinner 7ca74a760a
gh-119661: Add _Py_SINGLETON() include in Argumenet Clinic (#119712)
When the _Py_SINGLETON() is used, Argument Clinic now adds an
explicit "pycore_runtime.h" include to get the macro. Previously, the
macro may or may not be included indirectly by another include.
2024-05-29 11:37:04 +02:00
Sergey B Kirpichev cd11ff12ac
gh-119613: Use C99+ functions instead of Py_IS_NAN/INFINITY/FINITE (#119619) 2024-05-29 09:51:19 +02:00
Eric Snow 548a11d5cf
gh-117398: Convert datetime.IsoCalendarDate To A Heap Type (gh-119637)
This is the only static type in the module that we will not keep static.
2024-05-28 16:42:23 -06:00
Petr Viktorin a89fc26f4a
gh-117398: gh-119655: datetime: Init static state once & don't free it (GH-119662)
- While datetime uses global state, only initialize it once.
- While `capi` is static, don't free it (thanks @neonene in https://github.com/python/cpython/pull/119641/files#r1616710048)
2024-05-28 17:27:52 +00:00
Serhiy Storchaka b313cc68d5
gh-117557: Improve error messages when a string, bytes or bytearray of length 1 are expected (GH-117631) 2024-05-28 12:01:37 +03:00
Erlend E. Aasland 3e8b60905e
gh-117398: Add multiphase support to _datetime (gh-119373)
This is minimal support.  Subinterpreters are not supported yet.  That will be addressed in a later change.

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-05-27 16:02:46 -06:00
Eric Snow ae7b17673f
gh-119584: Fix test_import Failed Assertion (gh-119623)
The fix in gh-119561 introduced an assertion that doesn't hold true if any of the three new test extension modules are loaded more than once.  This is fine normally but breaks if the new test_check_state_first() is run more than once, which happens for refleak checking and with the regrtest --forever flag.  We fix that here by clearing each of the three modules after loading them.  We also tweak a check in _modules_by_index_check().
2024-05-27 19:35:30 +00:00
Eric Snow 0c5ebe13e9
gh-119560: Drop an Invalid Assert in PyState_FindModule() (gh-119561)
The assertion was added in gh-118532 but was based on the invalid assumption that PyState_FindModule() would only be called with an already-initialized module def.  I've added a test to make sure we don't make that assumption again.
2024-05-25 19:30:48 +00:00
Nice Zombies 96b392df30
gh-118263: Add additional arguments to path_t (Argument Clinic type) in posixmodule (GH-118355) 2024-05-24 19:04:17 +01:00
Victor Stinner 92fab3356f
gh-69214: Fix fcntl.ioctl() request type (#119498)
Use an 'unsigned long' instead of an 'unsigned int' for the request
parameter of fcntl.ioctl() to support requests larger than UINT_MAX.
2024-05-24 14:31:40 +02:00
Victor Stinner e94dbe4ed8
gh-119461: Fix ThreadedVSOCKSocketStreamTest (#119465)
Add socket.VMADDR_CID_LOCAL constant.

Fix ThreadedVSOCKSocketStreamTest: if get_cid() returns the host
address or the "any" address, use the local communication address
(loopback): VMADDR_CID_LOCAL.

On Linux 6.9, apparently, the /dev/vsock device is now available but
get_cid() returns VMADDR_CID_ANY (-1).
2024-05-23 23:26:09 +02:00
Eric Snow b30d30c747
gh-117398: Statically Allocate the Datetime C-API (GH-119472) 2024-05-23 21:15:52 +02:00
Petr Viktorin a192547dfe
gh-117142: Slightly hacky fix for memory leak of StgInfo (GH-119424)
Add a funciton that inlines PyObject_GetTypeData and skips
type-checking, so it doesn't need access to the CType_Type object.
This will break if the memory layout changes, but should
be an acceptable solution to enable ctypes in subinterpreters in
Python 3.13.

Mark _ctypes as safe for multiple interpreters

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
2024-05-23 16:01:37 +00:00
neonene e12a6780bb
gh-117142: ctypes: Clean up c-analyzer .tsv files (GH-117544)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-05-22 20:30:41 +00:00
Geoffrey Thomas ef172521a9
Remove almost all unpaired backticks in docstrings (#119231)
As reported in #117847 and #115366, an unpaired backtick in a docstring
tends to confuse e.g. Sphinx running on subclasses of standard library
objects, and the typographic style of using a backtick as an opening
quote is no longer in favor. Convert almost all uses of the form

    The variable `foo' should do xyz

to

    The variable 'foo' should do xyz

and also fix up miscellaneous other unpaired backticks (extraneous /
missing characters).

No functional change is intended here other than in human-readable
docstrings.
2024-05-22 12:35:18 -04:00
Eric Snow 81865002ae
gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across Interpreters (gh-119331)
_PyArg_Parser holds static global data generated for modules by Argument Clinic.  The _PyArg_Parser.kwtuple field is a tuple object, even though it's stored within a static global.  In some cases the tuple is statically allocated and thus it's okay that it gets shared by multiple interpreters.  However, in other cases the tuple is set lazily, allocated from the heap using the active interprepreter at the point the tuple is needed.

This is a problem once that interpreter is destroyed since _PyArg_Parser.kwtuple becomes at dangling pointer, leading to crashes.  It isn't a problem if the tuple is allocated under the main interpreter, since its lifetime is bound to the lifetime of the runtime.  The solution here is to temporarily switch to the main interpreter.  The alternative would be to always statically allocate the tuple.

This change also fixes a bug where only the most recent parser was added to the global linked list.
2024-05-22 09:57:52 -06:00
Irit Katriel 6e9863d7a3
gh-118692: Avoid creating unnecessary StopIteration instances for monitoring (#119216) 2024-05-21 20:42:51 +00:00
Nice Zombies b64182550f
gh-118507 : Refactor `nt._path_is*` to improve applicability for other cases (GH-118755) 2024-05-21 21:36:36 +01:00
Arnon Yaari 87939bd579
gh-117657: Fix itertools.count thread safety (#119268)
Fix itertools.count in free-threading mode
2024-05-21 10:16:34 -07:00
Erlend E. Aasland af359cee75
gh-118928: sqlite3: correctly bail if sequences of params are used with named placeholders (#119197) 2024-05-20 09:44:42 -04:00
Kirill Podoprigora 100c7ab00a
gh-119049: Fix incorrect display of warning which is constructed by C API (GH-119063)
The source line was not displayed if the warnings module had not yet
been imported.
2024-05-16 20:27:59 +00:00
Steve Dower 94591dca51
gh-118486: Simplify test_win32_mkdir_700 to check the exact ACL (GH-119056) 2024-05-15 11:59:41 +01:00
Erlend E. Aasland d8e0e00919
gh-118928: sqlite3: disallow sequences of params with named placeholders (#118929)
Follow-up of gh-101693. The previous DeprecationWarning is replaced with 
raising sqlite3.ProgrammingError.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-05-14 16:10:55 +00:00
Nikita Sobolev fc75792594
gh-118998: Handle errors correctly in `tmtotuple` in `timemodule` (#118999) 2024-05-14 00:20:59 +03:00
Victor Stinner 7d7eec595a
gh-117873: Revert _posixshmem.shm_open() change (#118901) 2024-05-13 16:03:52 +02:00
Hugo van Kemenade a019347947
gh-118924: Remove `sqlite3.version` and `sqlite3.version_info` (#118925) 2024-05-10 20:42:34 +00:00
Jelle Zijlstra 13d7cf997b
gh-118895: Call PyType_Ready() on typing.NoDefault (#118897) 2024-05-10 08:42:00 -07:00
Victor Stinner a895756aec
gh-117398: Move types to datetime state (#118606)
Move types to the datetime_state structure of the _datetime
extension.
2024-05-10 15:24:06 +02:00
Victor Stinner 7cc5e81a82
gh-117873: Use positional-only parameters in _posixshmem (#118012)
* shm_unlink() parameter becomes positional-only.
* shm_open() first parameter (path) becomes positional-only,
  the two following parameters remain positional-or-keyword.
2024-05-10 12:04:16 +02:00
Dobatymo e85e8deaf3
gh-118209: Add Windows structured exception handling to mmap module (GH-118213) 2024-05-10 10:47:30 +01:00
Sam Gross 46c808172f
Revert "gh-115432: Add critical section variant that handles a NULL object (#115433)" (#118861)
This reverts commit ad4f909e0e.

The API ended up not being used.
2024-05-09 18:33:53 -04:00
Steve Dower 8af84b503d
gh-118773: Use language-invariant SDDL string instead of aliases for ACLs. (GH-118800) 2024-05-09 17:43:21 +01:00
mpage c30d8e5d6c
gh-117657: Acquire a critical section around `SemLock.__{enter,exit}__` (#118812)
These methods are purely wrappers around `Semlock.{acquire,release}`,
which expect a critical section to be held.
2024-05-09 12:05:52 -04:00
Raymond Hettinger e8cbcf4955
GH-101588: Remove deprecated pickle/copy/deepcopy from itertools (gh-118816) 2024-05-09 03:31:47 -05:00
trag1c c4f9823be2
gh-118671: Updated dead ActiveState links (#118730)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-05-08 01:06:38 -06:00
Abhinav Upadhyay 26bab423fb
bpo-115773: Use the right variable name based on the field we are trying read (#118591)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2024-05-07 14:50:41 +00:00
Serhiy Storchaka 65f5e586a1
gh-66410: Do not stringify arguments of Tkinter callback (GH-98592)
Callbacks registered in the tkinter module now take arguments as
various Python objects (int, float, bytes, tuple), not just str.
To restore the previous behavior set tkinter module global wantobject to 1
before creating the Tk object or call the wantobject() method of the Tk object
with argument 1.
Calling it with argument 2 restores the current default behavior.
2024-05-07 12:07:32 +00:00
Youfu Zhang fe47d9bee3
gh-118314: Fix padding edge case in binascii.a2b_base64 strict mode (GH-118320)
Fix an edge case in `binascii.a2b_base64` strict mode, where
excessive padding was not detected when no padding is necessary.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2024-05-07 11:18:45 +02:00
Dino Viehland ff6cbb2503
gh-112075: use per-thread dict version pool (#118676)
use thread state set of dict versions
2024-05-07 00:22:26 +00:00
Sam Gross 723d4d2fe8
gh-118527: Intern code consts in free-threaded build (#118667)
We already intern and immortalize most string constants. In the
free-threaded build, other constants can be a source of reference count
contention because they are shared by all threads running the same code
objects.
2024-05-06 20:12:39 -04:00
Serhiy Storchaka 67ce820d51
gh-71592: Fix a leak in tkinter.Tk destructor when _debug is true (GH-118664) 2024-05-06 19:25:20 +00:00
Dino Viehland 5a1618a2c8
gh-118362: Fix thread safety around lookups from the type cache in the face of concurrent mutators (#118454)
Add _PyType_LookupRef and use incref before setting attribute on type
Makes setting an attribute on a class and signaling type modified atomic
Avoid adding re-entrancy exposing the type cache in an inconsistent state by decrefing after type is updated
2024-05-06 10:50:35 -07:00
Serhiy Storchaka 1ff626ebda
gh-71592: Add ability to trace Tcl commands executed by Tkinter (GH-118291)
This is an experimental feature, for internal use.

Setting tkinter._debug = True before creating the root window enables
printing every executed Tcl command (or a Tcl command equivalent to the
used Tcl C API).

This will help to convert a Tkinter example into Tcl script to check
whether the issue is caused by Tkinter or exists in the underlying Tcl/Tk
library.
2024-05-06 20:12:51 +03:00
Petr Viktorin 417dd3aca7
gh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Module_SetGIL (GH-118645) 2024-05-06 18:59:36 +02:00
Pieter Eendebak 05adfbba2a
gh-95382: Improve performance of json encoder with indent (GH-118105) 2024-05-06 11:04:39 +03:00
Pablo Galindo Salgado f27f8c790a
gh-111201: A new Python REPL (GH-111567)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-05-05 21:32:23 +02:00
Victor Stinner aa61f8bfcf
gh-110850: Remove _PyTime_TimeUnchecked() function (#118552)
Use the new public Raw functions:

* _PyTime_PerfCounterUnchecked() with PyTime_PerfCounterRaw()
* _PyTime_TimeUnchecked() with PyTime_TimeRaw()
* _PyTime_MonotonicUnchecked() with PyTime_MonotonicRaw()

Remove internal functions:

* _PyTime_PerfCounterUnchecked()
* _PyTime_TimeUnchecked()
* _PyTime_MonotonicUnchecked()
2024-05-05 12:15:19 +02:00
Davide Rizzo 08d169f14a
gh-109617: fix ncurses incompatibility on macOS with Xcode 15 (#111258)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-04 23:41:47 +02:00
Irit Katriel 85af789961
gh-111997: C-API for signalling monitoring events (#116413) 2024-05-04 08:23:50 +00:00
Brett Simmers c2627d6eea
gh-116322: Add Py_mod_gil module slot (#116882)
This PR adds the ability to enable the GIL if it was disabled at
interpreter startup, and modifies the multi-phase module initialization
path to enable the GIL when loading a module, unless that module's spec
includes a slot indicating it can run safely without the GIL.

PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went
with `Py_MOD_GIL_NOT_USED` for consistency with gh-104148.

A warning will be issued up to once per interpreter for the first
GIL-using module that is loaded. If `-v` is given, a shorter message
will be printed to stderr every time a GIL-using module is loaded
(including the first one that issues a warning).
2024-05-03 11:30:55 -04:00
Alexander Kanavin 37ccf16786
gh-101732: Modules/_ssl.c: use Y2038 compatible openssl function when available (GH-118425) 2024-05-03 15:34:05 +02:00
Jelle Zijlstra ca269e58c2
gh-116126: Implement PEP 696 (#116129)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-05-03 06:17:32 -07:00
Eric Snow f201628073
gh-117953: Other Cleanups in the Extensions Machinery (gh-118206)
This change will make some later changes simpler.
2024-05-03 00:51:43 +00:00
Steve Dower 8ed5466795
gh-118486: Switch mkdir(mode=0o700) on Windows to use OWNER RIGHTS instead of CURRENT_USER (GH-118515) 2024-05-02 19:43:54 +01:00
Pablo Galindo Salgado 6bcbee09df
gh-93502: Add new C-API functions to trace object creation and destruction (#115945) 2024-05-02 19:30:00 +02:00
Sergey B Kirpichev 9789440de3
gh-82062: Fix support of parameter defaults on methods in extension modules (GH-115270)
Now inspect.signature() supports references to the module globals in
parameter defaults on methods in extension modules.  Previously it was
only supported in functions.  The workaround was to specify the fully
qualified name, including the module name.
2024-05-02 17:44:33 +03:00
Steve Dower 81939dad77
gh-118486: Support mkdir(mode=0o700) on Windows (GH-118488) 2024-05-02 15:20:43 +01:00
Victor Stinner b52c753e0f
gh-110850: Add PyTime_TimeRaw() function (#118394)
Add "Raw" variant of PyTime functions:

* PyTime_MonotonicRaw()
* PyTime_PerfCounterRaw()
* PyTime_TimeRaw()

Changes:

* Add documentation and tests. Tests release the GIL while calling
  raw clock functions.
* py_get_system_clock() and py_get_monotonic_clock() now check that
  the GIL is hold by the caller if raise_exc is non-zero.
* Reimplement "Unchecked" functions with raw clock functions.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-05-01 18:05:01 +00:00
Guido van Rossum 7d83f7bcc4
gh-118335: Configure Tier 2 interpreter at build time (#118339)
The code for Tier 2 is now only compiled when configured
with `--enable-experimental-jit[=yes|interpreter]`.

We drop support for `PYTHON_UOPS` and -`Xuops`,
but you can disable the interpreter or JIT
at runtime by setting `PYTHON_JIT=0`.
You can also build it without enabling it by default
using `--enable-experimental-jit=yes-off`;
enable with `PYTHON_JIT=1`.

On Windows, the `build.bat` script supports
`--experimental-jit`, `--experimental-jit-off`,
`--experimental-interpreter`.

In the C code, `_Py_JIT` is defined as before
when the JIT is enabled; the new variable
`_Py_TIER2` is defined when the JIT *or* the
interpreter is enabled. It is actually a bitmask:
1: JIT; 2: default-off; 4: interpreter.
2024-04-30 18:26:34 -07:00
Victor Stinner e93c39b47e
gh-118422: Fix run_fileexflags() test (#118429)
Don't test the undefined behavior of fileno()
on a closed file, but use fstat() as a reliable
test if the file was closed or not.
2024-04-30 22:32:55 +02:00
Shantanu 6999d68d28
gh-118218: Reuse return tuple in itertools.pairwise (GH-118219) 2024-04-30 23:16:52 +03:00
Erlend E. Aasland b568c2c1ff
gh-118406: Add signature for sqlite3.Connection objects (#118428) 2024-04-30 19:58:22 +00:00
Sam Gross b2c3b70c71
gh-118332: Fix deadlock involving stop the world (#118412)
Avoid detaching thread state when stopping the world. When re-attaching
the thread state, the thread would attempt to resume the top-most
critical section, which might now be held by a thread paused for our
stop-the-world request.
2024-04-30 15:01:28 -04:00
Nice Zombies 9a75d56d5d
gh-118379: Use PyTuple_Pack instead of Py_BuildValue if possible (GH-118381) 2024-04-30 17:55:15 +03:00
Serhiy Storchaka 17a8af9508
gh-118402: Fix inspect.signature() for functools.cmp_to_key() result (GH-118427) 2024-04-30 17:49:28 +03:00
Sam Gross 7ccacb220d
gh-117783: Immortalize objects that use deferred reference counting (#118112)
Deferred reference counting is not fully implemented yet. As a temporary
measure, we immortalize objects that would use deferred reference
counting to avoid multi-threaded scaling bottlenecks.

This is only performed in the free-threaded build once the first
non-main thread is started. Additionally, some tests, including refleak
tests, suppress this behavior.
2024-04-29 14:36:02 -04:00
Serhiy Storchaka 444ac0b7a6
gh-118285: Fix signatures of operator.{attrgetter,itemgetter,methodcaller} instances (GH-118316)
* Allow to specify the signature of custom callable instances of extension
  type by the __text_signature__ attribute.
* Specify signatures of operator.attrgetter, operator.itemgetter, and
  operator.methodcaller instances.
2024-04-29 19:30:48 +03:00
Erlend E. Aasland c7e7bfc4ca
gh-115119: Detect _decimal dependencies using pkg-config (#115406)
pkg-config is supported for libmpdec 4.0.0 and newer.
2024-04-29 08:58:57 +02:00
Henrik Tunedal 133c1a7cdb
gh-118293: Suppress mouse cursor feedback when launching Windows processes with multiprocessing (GH-118315) 2024-04-28 21:10:44 +00:00
Eric Snow 09c2947581
gh-110693: Pending Calls Machinery Cleanups (gh-118296)
This does some cleanup in preparation for later changes.
2024-04-26 01:05:51 +00:00
neonene 2c45148912
gh-117578: Introduce _PyType_GetModuleByDef2 private function (GH-117661)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-04-25 13:51:31 +02:00
Nice Zombies 10bb90ed49
gh-102511: Speed up os.path.splitroot() with native helpers (GH-118089) 2024-04-25 10:07:38 +01:00