Skip to content
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

allow long type along with int type #1088

Closed
wants to merge 1 commit into from
Closed

allow long type along with int type #1088

wants to merge 1 commit into from

Conversation

vany-egorov
Copy link

reopen of #1085 pull request (single commit pull request)

refs yarnpkg/yarn#2286
refs yarnpkg/yarn#2376

allow long type as result of ExpandVariables call. along with str and int.
skip long type(value) along with int.

debug (buggy long type):

[
  {"type(expanded)": "<type 'long'>", "expanded": "1483986851164", "value": "1483986851164", "phase": "0", "build_file": "binding.gyp"},
  {"type(expanded)": "<type 'long'>", "expanded": "1483986851164", "value": "1483986851164", "phase": "0", "build_file": "deps\\libexpat\\libexpat.gyp"}
]

@Fishrock123
Copy link
Contributor

@vany-egorov FWIW you can git push origin your-branch --force to update the Pull Request if you want to change the commits via git rebase or git commit --amend. :)

Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

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

LGTM. Would be nice to have a regression test, though.

@@ -1222,9 +1222,9 @@ def ProcessVariablesAndConditionsInDict(the_dict, phase, variables_in,
# Skip "variables", which was already processed if present.
if key != 'variables' and type(value) is str:
expanded = ExpandVariables(value, phase, variables, build_file)
if type(expanded) not in (str, int):
if type(expanded) not in (str, int, long):
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that you are changing it, I would prefer

if isinstance(expanded, (basestring, int, long)):

@vany-egorov
Copy link
Author

@Fishrock123 thanks! git rebase -i origin/long~1 long && git push --force origin long work like a charm (^^)

@@ -1222,9 +1222,9 @@ def ProcessVariablesAndConditionsInDict(the_dict, phase, variables_in,
# Skip "variables", which was already processed if present.
if key != 'variables' and type(value) is str:
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that we are changing, I would like to see this also fixed :-)

@bnoordhuis
Copy link
Member

@vany-egorov Did you have any luck with a regression test? If not, can you rebase it so I can land it? Thanks.

refs yarnpkg/yarn#2376

allow long type as result of ExpandVariables call. along with str and int.
skip long type(value) along with int.

debug (buggy long type):
[
  {"type(expanded)": "<type 'long'>", "expanded": "1483986851164", "value": "1483986851164", "phase": "0", "build_file": "binding.gyp"},
  {"type(expanded)": "<type 'long'>", "expanded": "1483986851164", "value": "1483986851164", "phase": "0", "build_file": "deps\\libexpat\\libexpat.gyp"}
]

use isinstance(...) instead of type(...) and use basestring instead of string while typechecking;
@vany-egorov
Copy link
Author

@bnoordhuis I didn't do any regression tests.
I did: git remote add upstream git://github.com/nodejs/node-gyp.git && git pull --rebase upstream master && git push -f origin long

@rvagg
Copy link
Member

rvagg commented Jun 21, 2019

Anyone against merging this? Seems to still be good.

/cc @cclauss

@cclauss
Copy link
Contributor

cclauss commented Jun 21, 2019

long was removed in Python 3 in favor of an implementation of int that is of infinite precision. Given that Python 2 reaches its end of life is 194 days, is there a really strong need to add support for legacy Python long at this late date?

If so, please define long in Python 3 as follows (just after the imports):

try:
    long
except NameError:
    long = int

@rvagg
Copy link
Member

rvagg commented Jun 21, 2019

if this is only for Python 2 then let's not and just focus on getting to Python 3, thanks @cclauss

@rvagg rvagg closed this Jun 21, 2019
@vany-egorov vany-egorov deleted the long branch June 21, 2019 14:32
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.

6 participants