Skip to content

Update the migration of Set, Enum, Range (Does not matter anymore), and itertools.batched and pairwise#99

Open
CaQtiml wants to merge 52 commits intofxpl:old-regions-main3from
CaQtiml:region-main-mil-test
Open

Update the migration of Set, Enum, Range (Does not matter anymore), and itertools.batched and pairwise#99
CaQtiml wants to merge 52 commits intofxpl:old-regions-main3from
CaQtiml:region-main-mil-test

Conversation

@CaQtiml
Copy link
Copy Markdown

@CaQtiml CaQtiml commented Apr 7, 2026

No description provided.

CaQtiml and others added 30 commits January 26, 2026 12:45
Cown: Add new tests for releasing open regions
Regions: Correct off-by-one LRC and Cown release code
…_sequence do not need the migration.

also migrate _PySlice_GetLongIndices, slice_dealloc, and slice_new since they are related to range_as_mapping
Regions: Correct `_PyRegion_AddRefsArray()` write barrier
Regions: Add `PyRegion_ShareRegion` function
Py_hash_t hash = _PyObject_HashFast(key);
if (hash == -1) {
set_unhashable_type(key);
Py_DECREF(key);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PyRegion_RemoveLocalRef

// We don't pre-increment here, the caller holds a strong
// reference to the object which we are stealing.
return set_add_entry_takeref(so, key, hash);
return set_add_entry_takeref(so, key, hash, false);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDK, but it looks like it should be

Suggested change
return set_add_entry_takeref(so, key, hash, false);
return set_add_entry_takeref(so, key, hash, true);

??

Comment on lines +638 to +643
PyObject *entry_key = PyRegion_NewRef(entry->key);
if(entry_key == NULL) {
Py_DECREF(keys);
goto done;
}
PyList_SET_ITEM(keys, idx++, entry_key);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: All of this is safe because keys is local, an assert and doc comment to explain this would be good

return NULL;
}
Py_SETREF(result, newresult);
PyRegion_XSETLOCALREF(result, newresult);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THis can fail:

if(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants