-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
lib: disbanden circular dependency #14885
Conversation
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 but how was the circular dependency created? It's not clear to me.
@Ipinca honestly speaking: I am not absolutely sure as I did not check further but this was my first guess when looking at it and it worked. |
The buffer module is lazily required in the deepEqual checks. That is why there is the circular dependency. |
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.
Yay 🙌
Since Line 120 in bf18fe1
be replaced with a simple Buffer.from ?
Or maybe replace the Lines 133 to 134 in bf18fe1
with new Uint8Array (since that is actually the underlying operation)
I'm thinking out loud since I'm not sure if it will just mask the circular dependency. |
@refack I like the idea of using |
Lets see if it works - https://ci.nodejs.org/job/node-test-commit-linuxone/8136/ |
@@ -131,8 +129,8 @@ function areSimilarTypedArrays(a, b) { | |||
} | |||
return true; | |||
} | |||
return compare(from(a.buffer, a.byteOffset, len), |
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 would just make this Buffer.from()
to make it clearer what is happening
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 am no sure I can follow. The Buffer.from part was removed intentionally. Should I add a comment to describe the Uint8Array part?
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.
IMHO a comment explaining just that would be great.
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 edited the comment above the function. I am not really sure what to write besides what I now changed.
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 if CI is green
Still LGTM. |
PR-URL: nodejs#14885 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in 9aa7093 |
PR-URL: nodejs/node#14885 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs/node#14885 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #14885 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #14885 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #14885 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This does not land cleanly in LTS. Please feel free to manually backport by following the guide. Please also feel free to replace do-not-land if it is being backported |
This is going to be much easier after the backport for #13862 has landed. I open a PR for that in a few minutes. |
After looking at this again, I do not see the necessity to backport this. So I changed the labels accordingly. |
The circular dependency can be disbanded by directly using the binding functions in assert.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
util, assert