GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-108494: Fix AC limited C API for kwargs by vstinner · Pull Request #108516 · python/cpython Conversation
|
|
@erlend-aasland @AlexWaygood @serhiy-storchaka: Here is a fix for PyArg_ParseTupleAndKeywords(). It removes the unused |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| """, indent=4)] | ||
| declarations = "" | ||
|
|
||
| else: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Does it work if requires_defining_class is true?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
No, it doesn't. This change is incomplete, it can be completed later. Or do you mean that an exception should be raised instead of an compilation error?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Currently it can produce invalid code which is compiled. There are two opposite approaches:
I am currently trying the second approach. It allows to re-generate all clinic code using the limited API and test that at least it works (I found many cases in which the current code does not generate working code). Please hold this PR, the current code is more suitable for this experiment. After testing it will be easy to switch to the first approach.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
A module targeting the limited C API cannot use the private API. It fails at build.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # positional-only for the limited C API | ||
| flags = "METH_VARARGS" | ||
| elif clinic.limited_capi: | ||
| if not requires_defining_class and pos_only == len(parameters) - pseudo_args: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Does it work if pseudo_args is not zero?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I have no idea. I don't know what are pseudo args.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| {parse_arguments})) | ||
| goto exit; | ||
| """, indent=4)] | ||
| declarations = "char* _keywords[] = {{{keywords_c} NULL}};" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| declarations = "char* _keywords[] = {{{keywords_c} NULL}};" | |
| declarations = "static char *_keywords[] = {{{keywords_c} NULL}};" |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't reallly understand the difference between the two. The value is constant so the variable should not really exist on the stack, no?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
There is a difference. It is an array of pointers. If it is a local variable, it should fill with initial values every time the function is called. If it is a static variable, it is only filled with initial values at the program's start (or when the function is called first time).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
See #108536. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Does your PR make this one useless, or should it be merged first? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think that it makes it useless, maybe except the test. But for testing I want to reuse existing tests, so the current |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Serhiy's PR got merged and it's way more complete, I close this PR: #108536 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.