Skip to content

Conversation

@iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Dec 9, 2021

Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

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

Nice! I left some comments :)

Comment on lines 1086 to 1088
_Py_static_string(PyId_newline, "\n");
PyObject *lines = PyUnicode_Split(
note, _PyUnicode_FromId(&PyId_newline), -1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Completely OT:

  • Silly question: Why do we not use PyUnicode_InternFromString instead of _Py_static_string+_PyUnicode_FromId here?
  • If _PyUnicode_FromId fails, PyUnicode_Split will default to use whitespace as separator. Is that ok? IMO, we should check that the separator object is not NULL before proceeding to PyUnicode_Split.

Copy link
Member Author

Choose a reason for hiding this comment

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

Because I don't know what I'm doing :) (I added this recently, I'll change it).

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually why not PyUnicode_Splitlines?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually why not PyUnicode_Splitlines?

Oh, that's nice :)

iritkatriel and others added 4 commits December 9, 2021 13:32
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

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

LGTM!

@iritkatriel iritkatriel merged commit dc4a212 into python:main Dec 9, 2021
@iritkatriel iritkatriel deleted the bpo-45635-pythonrun branch December 9, 2021 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants