[Python-checkins] peps: - Fix typos and curses.window.addch definition.
stefan.krah
python-checkins at python.org
Thu Mar 14 12:41:21 CET 2013
http://hg.python.org/peps/rev/1c5f1077ab31
changeset: 4796:1c5f1077ab31
user: Stefan Krah <skrah at bytereef.org>
date: Thu Mar 14 12:40:29 2013 +0100
summary:
- Fix typos and curses.window.addch definition.
- Point out that the C variable declaration and cleanup sections are in
fact optional.
- Mention that C declaration parsing needs to be improved in the reference
implementation.
files:
pep-0437.txt | 35 ++++++++++++++++++-----------------
1 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/pep-0437.txt b/pep-0437.txt
--- a/pep-0437.txt
+++ b/pep-0437.txt
@@ -87,9 +87,9 @@
Converters are specified by their name, Python input type(s) and C output
-type(s). Default converters must be have quoted names, custom converters
-must have regular names. A Python type is given by its name. If a function
-accepts multiple Python types, the set is written in list form.
+type(s). Default converters must have quoted names, custom converters must
+have regular names. A Python type is given by its name. If a function accepts
+multiple Python types, the set is written in list form.
Since the default converters may have multiple implicit return values,
the C output type(s) are written according to the following convention:
@@ -116,13 +116,12 @@
Keyword arguments
^^^^^^^^^^^^^^^^^
-This example contains the definition of os.stat. The individual sections
-will be explained in detail. Grammatically, the whole define block consists
-of a function specification and an output section. The function specification
-in turn consists of a declaration section, a C-declaration section and a
-cleanup code section. Sections within the function specification are
-separated in yacc style by '%%'::
-
+This example contains the definition of os.stat. The individual sections will
+be explained in detail. Grammatically, the whole define block consists of a
+function specification and an output section. The function specification in
+turn consists of a declaration section, an optional C-declaration section and
+an optional cleanup code section. Sections within the function specification
+are separated in yacc style by '%%'::
/*[define posix_stat]
def os.stat(path: path_converter, *, dir_fd: OS_STAT_DIR_FD_CONVERTER = None,
@@ -169,15 +168,16 @@
C-declarations
~~~~~~~~~~~~~~
-This section contains C variable declarations. Since the converter functions
-have been declared beforehand, the preprocessor can type-check the declarations.
+This optional section contains C variable declarations. Since the converter
+functions have been declared beforehand, the preprocessor can type-check
+the declarations.
Cleanup
~~~~~~~
-The cleanup section contains literal C code that will be inserted unmodified
-after the implementation function.
+The optional cleanup section contains literal C code that will be inserted
+unmodified after the implementation function.
Output
@@ -210,10 +210,8 @@
such functions. For completeness' sake, this is the proposed syntax::
/*[define]
- def curses.window.addch(y: "i", x: "i", ch: "O", attr: "l") -> None
+ def curses.window.addch(y: "i", x: "i", ch: "O", attr: "l") -> None: pass
where groups = [[ch], [ch, attr], [y, x, ch], [y, x, ch, attr]]
- %%
- int newval = -1;
[define_end]*/
Here *ch* is the central parameter, *attr* can optionally be added on the
@@ -289,6 +287,9 @@
* The lexer does not handle triple quoted strings.
+ * C declarations are parsed in a primitive way. The final implementation
+ should utilize 'declarator' and 'init-declarator' from the C grammar.
+
* The *preprocess* tool does not emit code for the left-and-right optional
arguments case. The *printsemant* tool can deal with this case.
--
Repository URL: http://hg.python.org/peps
More information about the Python-checkins
mailing list