Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track for new and join on both str and unicode #40

Closed

Conversation

nanjekyejoannah
Copy link

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
@@ -105,6 +105,7 @@ whose size is determined when the object is allocated.
*/
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
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!

@@ -1646,6 +1646,15 @@ string_join(PyStringObject *self, PyObject *orig)
* 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
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
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