-
Notifications
You must be signed in to change notification settings - Fork 1.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
allow long type along with int type #1088
Conversation
@vany-egorov FWIW you can |
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. Would be nice to have a regression test, though.
gyp/pylib/gyp/input.py
Outdated
@@ -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): |
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.
Now that you are changing it, I would prefer
if isinstance(expanded, (basestring, int, long)):
@Fishrock123 thanks! |
gyp/pylib/gyp/input.py
Outdated
@@ -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: |
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.
Now that we are changing, I would like to see this also fixed :-)
@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;
@bnoordhuis I didn't do any regression tests. |
Anyone against merging this? Seems to still be good. /cc @cclauss |
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 |
if this is only for Python 2 then let's not and just focus on getting to Python 3, thanks @cclauss |
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):