Skip to content

Commit 12adfec

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Import upstream Github python/cpython ref 'main'
Summary: Imported python/cpython `3.15.0a6+` from upstream rev [`836f2c9`](https://www.github.com/python/cpython/commit/836f2c97f99925e84ec20d3c6da335a841f63b62) (committed 2026-02-18 04:16:27+00:00). # Commit Info Base: (`3.15.0a6+`) - [`2f7634c`](https://www.github.com/python/cpython/commit/2f7634c0291c92cf1e040fc81c4210f0883e6036) (commit date: 2026-02-17 02:28:21+00:00) Imported: (`3.15.0a6+`) - [`836f2c9`](https://www.github.com/python/cpython/commit/836f2c97f99925e84ec20d3c6da335a841f63b62) (commit date: 2026-02-18 04:16:27+00:00) # Files added ``` Misc/NEWS.d/next/C_API/2026-02-12-19-03-31.gh-issue-141510.U_1tjz.rst Misc/NEWS.d/next/Core_and_Builtins/2026-02-06-21-45-52.gh-issue-144438.GI_uB1LR.rst Misc/NEWS.d/next/Core_and_Builtins/2026-02-12-19-01-13.gh-issue-141510.KlKjZg.rst Misc/NEWS.d/next/Core_and_Builtins/2026-02-17-18-27-28.gh-issue-144914.DcXO4m.rst Misc/NEWS.d/next/Core_and_Builtins/2026-02-17-22-27-11.gh-issue-141510.-4yYsf.rst ``` Differential Revision: D93569833 fbshipit-source-id: 8dbf2971e84c22927861576a5d8112f83c46bf37
1 parent 3794f3c commit 12adfec

1 file changed

Lines changed: 13 additions & 20 deletions

File tree

cinderx/UpstreamBorrow/borrowed-3.15.gen_cached.c

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ _PyInterpreterState_GetConfig(PyInterpreterState *interp)
201201
#define LOAD_INDEX(keys, size, idx) ((const int##size##_t*)(keys->dk_indices))[idx]
202202
#define STORE_INDEX(keys, size, idx, value) ((int##size##_t*)(keys->dk_indices))[idx] = (int##size##_t)value
203203
#endif
204+
#define _PyAnyDict_CAST(op) \
205+
(assert(PyAnyDict_Check(op)), _Py_CAST(PyDictObject*, op))
206+
#define GET_USED(ep) FT_ATOMIC_LOAD_SSIZE_RELAXED((ep)->ma_used)
204207
#define STORE_KEY(ep, key) FT_ATOMIC_STORE_PTR_RELEASE((ep)->me_key, key)
205208
#define STORE_VALUE(ep, value) FT_ATOMIC_STORE_PTR_RELEASE((ep)->me_value, value)
206209
#define STORE_SPLIT_VALUE(mp, idx, value) FT_ATOMIC_STORE_PTR_RELEASE(mp->ma_values->values[idx], value)
@@ -578,7 +581,7 @@ _PyDict_CheckConsistency(PyObject *op, int check_content)
578581
do { if (!(expr)) { _PyObject_ASSERT_FAILED_MSG(op, Py_STRINGIFY(expr)); } } while (0)
579582

580583
assert(op != NULL);
581-
CHECK(PyDict_Check(op));
584+
CHECK(PyAnyDict_Check(op));
582585
PyDictObject *mp = (PyDictObject *)op;
583586

584587
PyDictKeysObject *keys = mp->ma_keys;
@@ -1456,23 +1459,7 @@ static int
14561459
setitem_take2_lock_held(PyDictObject *mp, PyObject *key, PyObject *value)
14571460
{
14581461
ASSERT_DICT_LOCKED(mp);
1459-
1460-
assert(key);
1461-
assert(value);
1462-
assert(PyDict_Check(mp));
1463-
Py_hash_t hash = _PyObject_HashFast(key);
1464-
if (hash == -1) {
1465-
dict_unhashable_type(key);
1466-
Py_DECREF(key);
1467-
Py_DECREF(value);
1468-
return -1;
1469-
}
1470-
1471-
if (mp->ma_keys == Py_EMPTY_KEYS) {
1472-
return insert_to_emptydict(mp, key, hash, value);
1473-
}
1474-
/* insertdict() handles any resizing that might be necessary */
1475-
return insertdict(mp, key, hash, value);
1462+
return anydict_setitem_take2(mp, key, value);
14761463
}
14771464
static int
14781465
setitem_lock_held(PyDictObject *mp, PyObject *key, PyObject *value)
@@ -1514,6 +1501,11 @@ _PyDict_DelItem_KnownHash_LockHeld(PyObject *op, PyObject *key, Py_hash_t hash)
15141501
int
15151502
_PyDict_SetItem_LockHeld(PyDictObject *dict, PyObject *name, PyObject *value)
15161503
{
1504+
if (!PyDict_Check(dict)) {
1505+
PyErr_BadInternalCall();
1506+
return -1;
1507+
}
1508+
15171509
if (value == NULL) {
15181510
Py_hash_t hash = _PyObject_HashFast(name);
15191511
if (hash == -1) {
@@ -2901,14 +2893,15 @@ _PyObject_HasLen(PyObject *o) {
29012893
#endif // WITH_MIMALLOC
29022894
#define MALLOC_ALLOC {NULL, _PyMem_RawMalloc, _PyMem_RawCalloc, _PyMem_RawRealloc, _PyMem_RawFree}
29032895
#ifdef WITH_MIMALLOC
2904-
# define MIMALLOC_ALLOC {NULL, _PyMem_MiMalloc, _PyMem_MiCalloc, _PyMem_MiRealloc, _PyMem_MiFree}
2896+
# define MIMALLOC_ALLOC {NULL, _PyMem_MiMalloc, _PyMem_MiCalloc, _PyMem_MiRealloc, _PyMem_MiFree}
2897+
# define MIMALLOC_RAWALLOC {NULL, _PyMem_MiRawMalloc, _PyMem_MiRawCalloc, _PyMem_MiRawRealloc, _PyMem_MiRawFree}
29052898
# define MIMALLOC_OBJALLOC {NULL, _PyObject_MiMalloc, _PyObject_MiCalloc, _PyObject_MiRealloc, _PyObject_MiFree}
29062899
#endif
29072900
#if defined(WITH_PYMALLOC)
29082901
# define PYMALLOC_ALLOC {NULL, _PyObject_Malloc, _PyObject_Calloc, _PyObject_Realloc, _PyObject_Free}
29092902
#endif // WITH_PYMALLOC
29102903
#if defined(Py_GIL_DISABLED)
2911-
# define PYRAW_ALLOC MALLOC_ALLOC
2904+
# define PYRAW_ALLOC MIMALLOC_RAWALLOC
29122905
# define PYMEM_ALLOC MIMALLOC_ALLOC
29132906
# define PYOBJ_ALLOC MIMALLOC_OBJALLOC
29142907
#elif defined(WITH_PYMALLOC)

0 commit comments

Comments
 (0)