-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
Add tests for the C tokenizer and expose it as a private module #27924
Conversation
9d34dc1
to
b11828c
Compare
b11828c
to
deee43b
Compare
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.
LGTM (a couple PEP 7 nits, and one question about the condition)
Running the buildbots (for refleaks, if there are any) |
🤖 New build scheduled with the buildbot fleet by @isidentical for commit deee43b 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
79876e1
to
7abe25a
Compare
|
[clinic start generated code]*/ | ||
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=96d98ee2fef7a8bc]*/ |
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.
Is this expected?
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.
Yeah, check other modules that have classes created with the argument clinic. Maybe I am missing what you mean though 😅
if (self == NULL) { | ||
return NULL; | ||
} | ||
PyObject* filename = PyUnicode_FromString("<string>"); |
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.
This returns a new reference, don't you have to decref it in line 53?
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.
No, the tokenizer free function does it
Ah, I misread the comment. Yeah, we are missing a decref in the error path
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.
Addressed in #27935
{Py_tp_getattro, PyObject_GenericGetAttr}, | ||
{Py_tp_iter, PyObject_SelfIter}, | ||
{Py_tp_iternext, tokenizeriter_next}, | ||
{0, 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.
Why are some of the initializers 8-char indented while others are 4-char indented?
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.
Hummm, I think is because I messed up with the format. All should be 4 char. Will correct this in another pR unless you manage to do it before
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.
Addressed in #27935
}; | ||
|
||
static PyModuleDef_Slot tokenizemodule_slots[] = { | ||
{Py_mod_exec, tokenizemodule_exec}, |
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.
Example of a 4-indented initializer.
No description provided.