FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-28754: AC on bisect. by JulienPalard · Pull Request #177 · python/cpython · GitHub

Repository navigation

bpo-28754: AC on bisect. - #177

Closed
JulienPalard wants to merge 1 commit into
python:masterfrom
JulienPalard:issue28754-ac-bisect
Closed

JulienPalard wants to merge 1 commit into
python:masterfrom
JulienPalard:issue28754-ac-bisect

Conversation

JulienPalard commented Feb 19, 2017 •
edited by methane
Loading

Copy link
Copy Markdown
Member

JulienPalard changed the title bpo28754: AC on bisect. bpo-28754: AC on bisect. Feb 19, 2017

methane left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM.
But please wait approval from expert.
(@rhettinger is listed on http://cpython-devguide.readthedocs.io/experts.html)

Comment thread Modules/_bisectmodule.c
#include "Python.h"

static int
ssize_t_converter(PyObject *obj, void *ptr)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

ssize_t_converter is not used for parsing arguments. It is used only in optional_ssize_t_converter. Wouldn't be better to inline it?

Comment thread Modules/_bisectmodule.c

a: object
x: object
lo: Py_ssize_t(c_default='0') = 0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

c_default='0' is redundant.

Comment thread Modules/_bisectmodule.c


/*[clinic input]
bisect.bisect_right

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

You can use the return converter for simplifying the code.

bisect.bisect_right -> Py_ssize_t

The body of bisect_bisect_right_impl() would be just:

return internal_bisect_right(a, x, lo, hi);

Comment thread Lib/test/test_bisect.py

def test_hi_backcompatbility(self):
for func, data, elem, expected in self.precomputedCases:
self.assertEqual(func(data, elem, 0, -1),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This doesn't check that passing -1 and None is the same as not specifying the hi argument. Compare results with func(data, elem).

rhettinger self-assigned this Apr 5, 2017

Copy link
Copy Markdown
Contributor

I don't want the pure python API to change at all. It is a long standing API and there is nothing wrong with it. Also, passing it -1 here as a special value makes real code less readable. Further, the change slightly slows down the case where high is specified. In a high performance building block module, we shouldn't add in unnecessary checks.

Copy link
Copy Markdown
Member

To try and help move older pull requests forward, we are going through and backfilling 'awaiting' labels on pull requests that are lacking the label. Based on the current reviews, the best we can tell in an automated fashion is that a core developer requested changes to be made to this pull request.

If/when the requested changes have been made, please leave a comment that says, I have made the requested changes; please review again. That will trigger a bot to flag this pull request as ready for a follow-up review.

akruis added a commit to akruis/cpython that referenced this pull request Nov 1, 2018
…ute()

I missed the C-fame case, when I changed the frame-function ref counting
in Stackless issue python#117.
JulienPalard deleted the issue28754-ac-bisect branch June 16, 2019 14:05
jaraco pushed a commit that referenced this pull request Dec 2, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL