-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
@@ -105,6 +105,7 @@ whose size is determined when the object is allocated. | |||
*/ | |||
typedef struct _object { | |||
PyObject_HEAD | |||
Py_ssize_t ob_bstate; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Lets figure out tracking in before we get back here |
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.