| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…rations. When you use `'%s' % SubClassOfStr()`, where `SubClassOfStr.__rmod__` exists, the reverse operation is ignored as normally such string formatting operations use the `PyUnicode_Format()` fast path. This patch tests for subclasses of `str` first and picks the slow path in that case. Fixes issue28598.
|
Open question: Should this patch be backported to 3.6 and 3.5? It's a bug fix, not a new feature. |
Sorry, something went wrong.
Yes, it should be backported if it's a bug (I haven't investigated myself yet.)
We don't use issueNNNN anymore. The correct way to link PRs to bugs.p.o is bpo-NNNN. |
Sorry, something went wrong.
Ta, also for the title change! Updated the 'fixes' line too. |
Sorry, something went wrong.
There was a problem hiding this comment.
In general LGTM except few minor details.
And I'm not sure about the style of commit messages now. Should it include issue number at the first line? Should it contain "Patch by YYY." (now the author is specified in metadata)?
Sorry, something went wrong.
| PyNumber_Remainder(dividend, divisor); | ||
| PyObject *res; | ||
| if (PyUnicode_CheckExact(dividend) && !( | ||
| PyUnicode_Check(divisor) && !PyUnicode_CheckExact(divisor))) { |
There was a problem hiding this comment.
Too many negations.
I would expand the expression as PyUnicode_CheckExact(dividend) && (!PyUnicode_Check(divisor) || PyUnicode_CheckExact(divisor)).
Sorry, something went wrong.
| Core and Builtins | ||
| ----------------- | ||
|
|
||
| - Issue #28598: Support __rmod__ for subclasses of str being called before str.__mod__. |
There was a problem hiding this comment.
Add "Patch by Martijn Pieters."
Sorry, something went wrong.
Codecov Report
@@ Coverage Diff @@
## master #51 +/- ##
==========================================
- Coverage 82.37% 82.37% -0.01%
==========================================
Files 1427 1427
Lines 350948 350953 +5
==========================================
- Hits 289099 289097 -2
- Misses 61849 61856 +7Continue to review full report at Codecov.
|
Sorry, something went wrong.
|
Should this really be backported? It seems like a change in semantics more than a bugfix. |
Sorry, something went wrong.
|
@brettcannon This is definitely a bug, not a change in semantics. From the object.__rmod__ documentation:
str % subclass_of_str doesn't follow this behavior, and str is the only type that doesn't (everything else goes through the PyNumber_Remainder() slow path). This patch fixes that bug. |
Sorry, something went wrong.
Allow miss-islington to merge the PR if all of these conditions met: - All CI passed - At least one core dev approved - PR is made by miss-islington
Back port latest changes to importlib.resources Closes python#51 See merge request python-devs/importlib_resources!55
…ython#51) * feat: store bb_test flag in frame to reload during resume * feat: bigger CACHE entries for everything, CACHE for JUMP_BACKWARD * nit: increase overallocate factor even more * feat: remove bb_flag/bb_test and use only the frame's
| Back | FazBrowse Home | New Git URL |
When you use '%s' % SubClassOfStr(), where SubClassOfStr.__rmod__ exists, the reverse operation is ignored as normally such string formatting operations use the PyUnicode_Format() fast path. This patch tests for subclasses of str first and picks the slow path in that case.
Fixes bpo-28598.