Skip to content

small unix and windows cleanups - #5782

Closed
dlech wants to merge 6 commits into
micropython:masterfrom
dlech:unix-print-str
Closed

dlech wants to merge 6 commits into
micropython:masterfrom
dlech:unix-print-str

Conversation

@dlech

@dlech dlech commented Mar 21, 2020

Copy link
Copy Markdown
Contributor

The first commit was suggested to be separated from #5723 in #5723 (comment)

The second commit is the same thing for windows.

The third commit was something I noticed while looking at the other two.

@dlech

dlech commented Mar 21, 2020

Copy link
Copy Markdown
Contributor Author

The 4th commit, I caught out of the corner of my eye as I was closing a window. 😃

@dlech

dlech commented Mar 21, 2020

Copy link
Copy Markdown
Contributor Author

The 5th commit fixes a windows build error that has probably been around for at least 2 years but wasn't noticed on CI until the other changes here.

@dlech

dlech commented Mar 21, 2020

Copy link
Copy Markdown
Contributor Author

The 6th commit fixes another windows CI build error that seems unrelated to the other changes here.

@dlech
dlech force-pushed the unix-print-str branch 2 times, most recently from 25c5618 to f655f52 Compare March 22, 2020 00:39
@stinos

stinos commented Mar 22, 2020

Copy link
Copy Markdown
Contributor

First commit mentions an SHA for https://github.com/micropython/micropython/commit/354d17523f599746a84e5b22fa670c9910137947 which seems completely unrelated to what gets done there? Or if it isn't, can you explain exactly why? Minor: commit message should be 'removes' instead of 'removed'. And start with a capital after the colon.

Second commit seems to have the squashed message of other commits, but the commits themselves are still separate.

Anyway maybe merge the first 2 commits since they do the same and require the same explanation, then squash introduction of STDIN_FILENO and the needed includes.

dlech added 6 commits March 22, 2020 11:45
This removes the port-specific implmentation of MP_PLAT_PRINT_STRN
on the unit port. Since fee7e56, this is no longer a single
function call, so we are not really optimising anything over using
the default impelementation of calling mp_hal_stdout_tx_strn_cooked().
This removes the port-specific implmentation of MP_PLAT_PRINT_STRN
on the windows port.

This fixes releasing the GIL during the call to write() (this was
missed in bc3499f).

Also, mp_hal_dupterm_tx_strn() was defined but never used anywhere,
so it is safe to delete it.
This replaces 0 and 1 with STDIN_FILENO and STDOUT_FILENO to make the
intention of the code more clear.
This file uses STD{IN,OUT,ERR}_FILENO macros which come from this
header file.
py/stream.h uses size_t and off_t which are defined in sys/types.h
@dlech

dlech commented Mar 22, 2020

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Having the second commit separate is intentional since the first is just a clean up and the second is fixing a mistake. And as far as I can tell, the last two commits are not directly related to the other changes but are fixing existing independent problems that were exposed as a side effect.

@stinos

stinos commented Mar 22, 2020

Copy link
Copy Markdown
Contributor

Having the second commit separate is intentional

Both are removing custom MP_PLAT_PRINT_STRN for essentially the same reasons I think (cleanup, not needed to have a separate definition since the mp_hal_xxx function does the same thing already)? And the windows one additionally was also wrong in the first place? I guess that could stay separate, but it's a bit confusing that the common reason isn't mentioned in both then.

the last two commits are not directly related to the other changes

Yes you're right, I missed that it was adding unistd.h for extmod, not for the ports.

@dpgeorge

Copy link
Copy Markdown
Member

Thanks for this. Even though the first two commits are related I think it makes sense to have them separated as done here, eg in case they introduce regressions they are easier to track down (but I would have also been happy to merge had they been combined).

Merged in b1066a9 through 2f7d2bb with some minor edits to the commit messages.

@dpgeorge dpgeorge closed this Mar 24, 2020
tannewt pushed a commit to tannewt/circuitpython that referenced this pull request Dec 29, 2021
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.

3 participants