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

docs isr_rules, micropython: add note that creating a ref to a bound method causes allocation. #3431

Closed

Conversation

peterhinch
Copy link
Contributor

As discussed in #3428.

@pfalcon
Copy link
Contributor

pfalcon commented Nov 12, 2017

This has stray commits, please rebase.

@@ -111,6 +111,13 @@ Functions
Such an IRQ puts restrictions on the code that runs in the IRQ (for example
the heap may be locked) and scheduling a function to call later will lift
those restrictions.

If the callback to be passed to ``schedule`` is a bound method, passing this
directly will fail. This is because creating a reference to a bound method
Copy link
Contributor

Choose a reason for hiding this comment

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

"a bound method, passing this directly will fail." This isn't true in general. The paragraph apparently should start with "Note: If schedule is call from a preempting IRQ, when memory allocation is not allowed, ..."

@peterhinch
Copy link
Contributor Author

Has this fixed it? Git continues to baffle me, I'm afraid :(

@pfalcon
Copy link
Contributor

pfalcon commented Nov 12, 2017

Nope, as you can see, there're still 2 commits.

In your "doc-ref-bound-method" branch, you need to do "git rebase -i master", then follow the on-screen instructions. (You need to remove a commit not related to this patch.)

@peterhinch peterhinch force-pushed the doc-ref-bound-method branch 2 times, most recently from 74c70c4 to bade097 Compare November 12, 2017 19:00
@peterhinch
Copy link
Contributor Author

I had to do a force push but hopefully this has worked.

@@ -124,6 +124,30 @@ A means of creating an object without employing a class or globals is as follows
The compiler instantiates the default ``buf`` argument when the function is
loaded for the first time (usually when the module it's in is imported).

An instance of object creation occurs when a reference to a bound method is created. This means that
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please wrap lines similarly to the paragraph above. (I also would recommend wrapping them at <80 chars for any new paragraphs).

@@ -112,5 +112,14 @@ Functions
the heap may be locked) and scheduling a function to call later will lift
those restrictions.

Note: If ``schedule`` is called from a preempting IRQ, when memory
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please use the xref syntax as described in https://github.com/micropython/micropython/blob/master/CODECONVENTIONS.md#documentation-conventions (specifically, all occurrences should be:

`schedule()`

@peterhinch
Copy link
Contributor Author

Is this OK now?

@dpgeorge
Copy link
Member

Thanks! Merged in ec1e9a1

@dpgeorge dpgeorge closed this Nov 23, 2017
@peterhinch peterhinch deleted the doc-ref-bound-method branch November 23, 2017 05:33
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.

None yet

3 participants