Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
gh-132987: Support __index__() in the stat module#133097
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -295,9 +295,21 @@ _PyLong_AsMode_t(PyObject *op) | ||
unsigned long value; | ||
mode_t mode; | ||
if (PyLong_Check(op)) { | ||
value = PyLong_AsUnsignedLong(op); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This code path looks like a micro-optimization (to avoid PyNumber_Index). I don't think that it's worth it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Not only. Many functions like But this is not completely consistent, so this may not make large difference. | ||
} | ||
else { | ||
op = PyNumber_Index(op); | ||
if (op == NULL) { | ||
return (mode_t)-1; | ||
} | ||
value = PyLong_AsUnsignedLong(op); | ||
Py_DECREF(op); | ||
} | ||
if ((value == (unsigned long)-1) && PyErr_Occurred()) { | ||
return (mode_t)-1; | ||
} | ||
mode = (mode_t)value; | ||
if ((unsigned long)mode != value) { | ||
Uh oh!
There was an error while loading.Please reload this page.