Skip to content

Conversation

@nanjekyejoannah
Copy link
Collaborator

Tracking for new and join operations, applied to both unicode and bytes.

This tracking breaks ordinal configurations for unicode, so before I reconfigure, let us confirm with this PR if this is the intended design from our discussion of the minimal example in the google doc on the string assumptions.

@nanjekyejoannah nanjekyejoannah changed the title Track Track for new and join on both str and unicode May 1, 2024
*/
typedef struct _object {
PyObject_HEAD
Py_ssize_t ob_bstate;
Copy link
Member

Choose a reason for hiding this comment

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

Don't we want to put this only in strings/bytes, rather than in every object? Or is that not possible?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Some methods use the abstract object type see: #39 , so it is necessary.

Copy link
Member

Choose a reason for hiding this comment

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

I'm unsure what it means to ask for the bstate of something that isn't a string. Maybe I'm missing something!

* original sequence can be iterated over
* again, so we must pass seq here.
*/
if (!PyString_Check(item) && !item->ob_bstate == NULL) {
Copy link
Member

Choose a reason for hiding this comment

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

What I now realise is we probably need a Py_GetBState(...) function that returns (say) -1 for "not string/unicode" and then 0/1/2/3/whatever for the actual bstate. That way we can avoid putting bstate on every object.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Today I started to add Py_GetBState, I broke other tests that I am still fixing.

@nanjekyejoannah
Copy link
Collaborator Author

Lets figure out tracking in before we get back here

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