Skip to content

Conversation

@addaleax
Copy link
Member

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

process

Description of change

1aa595e introduced a throw for accessing Symbol properties of process.env. However, this breaks util.inspect(process) and things like Object.prototype.toString.call(process.env), so this patch changes the behaviour for the getter to just always return undefined.

/cc @cjihrig

1aa595e introduced a `throw` for accessing `Symbol` properties of `process.env`. However, this breaks `util.inspect(process)` and things like `Object.prototype.toString.call(process.env)`, so this patch changes the behaviour for the getter to just always return `undefined`.
@addaleaxaddaleax added c++ Issues and PRs that require attention from people who are familiar with C++. dont-land-on-v4.x process Issues and PRs related to the process subsystem. labels Nov 16, 2016
@nodejs-github-botnodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Nov 16, 2016
const PropertyCallbackInfo<Value>& info){
Isolate* isolate = info.GetIsolate();
if (property->IsSymbol()){
return info.GetReturnValue().SetUndefined();
Copy link
Member

Choose a reason for hiding this comment

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

Calling .SetUndefined() explicitly doesn't hurt but it's not strictly necessary as it's the default return value. We don't call it anywhere else.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

@bnoordhuis I think making the return value explicit is more readable here, that’s all. If you prefer, I have no problem dropping it.

Copy link
Member

Choose a reason for hiding this comment

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

It's fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this the C++ equivalent of function(){return undefined}? I've no strong feelings, but explicit isn't necessarily more readable, IMHO.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Isn't this the C++ equivalent of function(){return undefined}?

Yup.

I've no strong feelings, but explicit isn't necessarily more readable, IMHO.

I agree, but in this instance I think it makes sense.

@cjihrigcjihrig mentioned this pull request Nov 16, 2016
Copy link
Member

@mhdawsonmhdawson left a comment

Choose a reason for hiding this comment

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

LGTM

@jasnelljasnell added the semver-major PRs that contain breaking changes and should be released in the next major version. label Nov 18, 2016
@jasnell
Copy link
Member

Marking as semver-major due to the change in error handling.

@addaleax
Copy link
MemberAuthor

@jasnell This partially undoes a not-yet-released semver-major change, I’m not sure that qualifies as semver-major on its own?

CI: https://ci.nodejs.org/job/node-test-commit/6089/

@addaleax
Copy link
MemberAuthor

Landed in 3295a7f, thanks for reviewing everyone!

addaleax added a commit that referenced this pull request Nov 20, 2016
1aa595e introduced a `throw` for accessing `Symbol` properties of `process.env`. However, this breaks `util.inspect(process)` and things like `Object.prototype.toString.call(process.env)`, so this patch changes the behaviour for the getter to just always return `undefined`. Ref: #9446Fixes: #9641 PR-URL: #9631 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
@addaleaxaddaleax deleted the util-inspect-process-env branch November 20, 2016 00:58
@jasnell
Copy link
Member

It's a bit of a grey area

On Sat, Nov 19, 2016 at 4:05 PM Anna Henningsen [email protected]
wrote:

@jasnellhttps://github.com/jasnell This partially undoes a
not-yet-released semver-major change, I’m not sure that qualifies as
semver-major on its own?

CI: https://ci.nodejs.org/job/node-test-commit/6089/


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#9631 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAa2eYKDlWH8AgY0gpoQ5rtZ38ViTs_tks5q_47NgaJpZM4KzQBC
.

italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 18, 2017
1aa595e introduced a `throw` for accessing `Symbol` properties of `process.env`. However, this breaks `util.inspect(process)` and things like `Object.prototype.toString.call(process.env)`, so this patch changes the behaviour for the getter to just always return `undefined`. Ref: nodejs#9446Fixes: nodejs#9641 PR-URL: nodejs#9631 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
@jasnelljasnell mentioned this pull request Apr 4, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++Issues and PRs that require attention from people who are familiar with C++.processIssues and PRs related to the process subsystem.semver-majorPRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@addaleax@jasnell@sam-github@bnoordhuis@targos@cjihrig@mhdawson@nodejs-github-bot