Add tests for the C tokenizer and expose it as a private module#27924
Add tests for the C tokenizer and expose it as a private module#27924pablogsal merged 5 commits intopython:mainfrom
Conversation
9d34dc1 to
b11828c
Compare
b11828c to
deee43b
Compare
isidentical
left a comment
There was a problem hiding this comment.
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. |
Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
79876e1 to
7abe25a
Compare
|
| [clinic start generated code]*/ | ||
| /*[clinic end generated code: output=da39a3ee5e6b4b0d input=96d98ee2fef7a8bc]*/ |
There was a problem hiding this comment.
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.
This returns a new reference, don't you have to decref it in line 53?
There was a problem hiding this comment.
No, the tokenizer free function does it
Ah, I misread the comment. Yeah, we are missing a decref in the error path
| {Py_tp_getattro, PyObject_GenericGetAttr}, | ||
| {Py_tp_iter, PyObject_SelfIter}, | ||
| {Py_tp_iternext, tokenizeriter_next}, | ||
| {0, NULL}, |
There was a problem hiding this comment.
Why are some of the initializers 8-char indented while others are 4-char indented?
There was a problem hiding this comment.
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
| }; | ||
|
|
||
| static PyModuleDef_Slot tokenizemodule_slots[] = { | ||
| {Py_mod_exec, tokenizemodule_exec}, |
There was a problem hiding this comment.
Example of a 4-indented initializer.
No description provided.