msg236403 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-02-22 10:37 |
Argument Clinic generates multiple definitions in non-block mode for functions with alternating signature. See example file. If FOO is not defines, SPAM_METHODDEF is defined twice.
First time in:
#ifndef SPAM_METHODDEF
#define SPAM_METHODDEF
#endif /* !defined(SPAM_METHODDEF) */
Second time in:
#if !defined(FOO)
...
#define SPAM_METHODDEF \
|
msg236405 - (view) |
Author: Larry Hastings (larry) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-02-22 10:56 |
Can you give me a test case?
|
msg236407 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-02-22 11:08 |
Oh, sorry. Here is a sample. Other sample see in issue23501.
|
msg237183 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-03-04 15:10 |
Here is a patch which moves all methoddef_ifndef to the end of the buffer or file, so they are not conflicts with other definitions.
|
msg237185 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-03-04 15:12 |
Here is a sample file generated by fixed clinic.py.
|
msg237192 - (view) |
Author: Larry Hastings (larry) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-03-04 16:59 |
In your sample output we still get two #ifndef SPAM_METHODDEF stanzas. Wouldn't it be better to only have one?
Maybe Clinic needs to be smarter about generating those anyway. Let me think about it.
|
msg237201 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-03-04 19:04 |
Actually in this sample output no one #ifndef SPAM_METHODDEF stanza is needed, because SPAM_METHODDEF is defined in any case.
|
msg238076 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-03-14 10:23 |
May be first commit this non-perfect solution? Generated code is correct, it is just not optimal. This issue is a dependency of issue23501, that is a dependency of issue23492, that is a dependency of my patch for optimizing argument parsing in 1-argument functions.
|
msg238119 - (view) |
Author: Larry Hastings (larry) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-03-15 04:20 |
How about this approach? Only ever emit the #ifndef stanza once per symbol.
|
msg238120 - (view) |
Author: Larry Hastings (larry) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-03-15 04:21 |
(see larry.ac_multiple_macro_definitions.diff.1.txt posted above)
|
msg238122 - (view) |
Author: Larry Hastings (larry) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-03-15 04:25 |
Oops, I should have run "make clinic", so you could see all the changes that result from this patch.
|
msg238126 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-03-15 06:35 |
It doesn't fix the issue, because the #ifndef stanza is emitted before second definition. Try to run clinic.py with your patch on sample.c. But may be this idea can be used with my patch.
|
msg238128 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-03-15 07:22 |
Yes, this works. Here is combined patch and proceeded sample file.
|
msg238384 - (view) |
Author: Larry Hastings (larry) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-03-18 08:51 |
What do you think of this approach? Now a "Destination" object behaves like an array of text accumulators. If you ask for one that doesn't exist it's created for you. When the Destination is dumped, the output from each accumulator is joined together, like buffer[0] + buffer[1] + buffer[2]. (You can even specify negative indices, if you want text that goes *before* the default text accumulator.)
With this approach, all the #ifndef stanzas are at the end of the emitted text.
|
msg238420 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-03-18 11:21 |
This looks as generalization of my patch. It produces the same output. I left comments on Rietveld, but in any case the patch LGTM.
|
msg239576 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-03-30 07:18 |
Could you please commit your patch (may be with changes) Larry?
|
msg239596 - (view) |
Author: Larry Hastings (larry) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-03-30 11:53 |
I want to redo it--it's smelly. I hope to get it done this week.
|
msg240008 - (view) |
Author: Larry Hastings (larry) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-04-03 16:11 |
As promised, here's a cleaned-up version of the patch. The taxonomy of objects now makes sense: a Destination contains a BufferSeries object, rather than Destinations weirdly supporting __getitem__ to reference different objects.
I tripped over myself a little with the "two-pass" destination / preset. It was an experiment long ago but nobody's using it. So rather than fix it I just turned it off.
|
msg240009 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-04-03 16:47 |
Looks as you didn't notice my comments on Rietveld.
|
msg240010 - (view) |
Author: Larry Hastings (larry) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-04-03 16:51 |
I did, I just didn't respond. I'll do that now.
|
msg240012 - (view) |
Author: Larry Hastings (larry) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-04-03 17:12 |
Updated patch, removed all references to two-pass. Also realized I needed to make the default behavior for methoddef_ifndef go to the end. And, finally, I forgot to merge the "only print each #ifndef block once" code I wrote before when I redid the patch, so that's in now.
|
msg240016 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-04-03 17:46 |
larry.ac_multiple_macro_definitions.diff.5.txt LGTM.
|
msg240028 - (view) |
Author: Roundup Robot (python-dev) ![Python triager (Python triager)](@@file/triager.png) |
Date: 2015-04-03 20:09 |
New changeset 25eef0ecb9c1 by Larry Hastings in branch 'default':
Issue #23500: Argument Clinic is now smarter about generating the "#ifndef"
https://hg.python.org/cpython/rev/25eef0ecb9c1
|
msg240029 - (view) |
Author: Larry Hastings (larry) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-04-03 20:09 |
Does this really need a backport to 3.4?
|
msg240030 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-04-03 20:16 |
I think this is not needed.
|
msg240031 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-04-03 20:17 |
Thank you Larry.
|
msg240035 - (view) |
Author: Larry Hastings (larry) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2015-04-03 20:35 |
Removing 3.4 from the version list as I close the bug, then. If we decide we need it backported please reopen (or create a new bug, either is fine).
|
|
Date |
User |
Action |
Args |
2022-04-11 14:58:13 | admin | set | github: 67688 |
2015-04-03 20:35:59 | larry | set | status: open -> closed versions:
- Python 3.4 messages:
+ msg240035
resolution: fixed stage: commit review -> resolved |
2015-04-03 20:17:22 | serhiy.storchaka | set | messages:
+ msg240031 |
2015-04-03 20:16:55 | serhiy.storchaka | set | messages:
+ msg240030 |
2015-04-03 20:09:58 | larry | set | messages:
+ msg240029 |
2015-04-03 20:09:18 | python-dev | set | nosy:
+ python-dev messages:
+ msg240028
|
2015-04-03 18:43:52 | serhiy.storchaka | set | assignee: larry stage: patch review -> commit review |
2015-04-03 17:46:36 | serhiy.storchaka | set | messages:
+ msg240016 |
2015-04-03 17:12:00 | larry | set | files:
+ larry.ac_multiple_macro_definitions.diff.5.txt
messages:
+ msg240012 |
2015-04-03 16:51:32 | larry | set | messages:
+ msg240010 |
2015-04-03 16:47:02 | serhiy.storchaka | set | messages:
+ msg240009 |
2015-04-03 16:11:34 | larry | set | files:
+ larry.ac_multiple_macro_definitions.diff.4.txt
messages:
+ msg240008 |
2015-03-30 11:53:07 | larry | set | messages:
+ msg239596 |
2015-03-30 07:18:58 | serhiy.storchaka | set | messages:
+ msg239576 |
2015-03-18 11:21:16 | serhiy.storchaka | set | messages:
+ msg238420 |
2015-03-18 08:51:59 | larry | set | files:
+ larry.ac_multiple_macro_definitions.diff.3.txt
messages:
+ msg238384 |
2015-03-15 07:22:30 | serhiy.storchaka | set | files:
+ clinic_append_2.patch, sample.c
messages:
+ msg238128 |
2015-03-15 06:35:09 | serhiy.storchaka | set | messages:
+ msg238126 |
2015-03-15 04:25:07 | larry | set | files:
+ larry.ac_multiple_macro_definitions.diff.2.txt
messages:
+ msg238122 |
2015-03-15 04:21:19 | larry | set | messages:
+ msg238120 |
2015-03-15 04:20:56 | larry | set | files:
+ larry.ac_multiple_macro_definitions.diff.1.txt
messages:
+ msg238119 |
2015-03-14 10:23:28 | serhiy.storchaka | set | messages:
+ msg238076 |
2015-03-04 19:04:23 | serhiy.storchaka | set | messages:
+ msg237201 |
2015-03-04 16:59:43 | larry | set | messages:
+ msg237192 |
2015-03-04 15:12:42 | serhiy.storchaka | set | files:
+ sample.c
messages:
+ msg237185 |
2015-03-04 15:10:30 | serhiy.storchaka | set | keywords:
+ needs review, patch files:
+ clinic_append.patch messages:
+ msg237183
stage: patch review |
2015-02-25 15:30:19 | serhiy.storchaka | set | components:
+ Argument Clinic |
2015-02-22 11:08:43 | serhiy.storchaka | set | files:
+ sample.c
messages:
+ msg236407 |
2015-02-22 11:05:50 | serhiy.storchaka | link | issue23501 dependencies |
2015-02-22 10:56:53 | larry | set | messages:
+ msg236405 |
2015-02-22 10:38:05 | serhiy.storchaka | set | nosy:
+ larry
|
2015-02-22 10:37:42 | serhiy.storchaka | create | |