diff options
author | Larry Hastings <larry@hastings.org> | 2014-02-01 06:03:12 (GMT) |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2014-02-01 06:03:12 (GMT) |
commit | 7726ac9163081a3730d30d4334135d6bf26900fc (patch) | |
tree | eac56b188bab64935e41c848a274d2ec47ed40f0 /Modules/posixmodule.c | |
parent | 04edd2eb7f29eb147d54bd32c2e0a55af44a4323 (diff) | |
download | cpython-7726ac9163081a3730d30d4334135d6bf26900fc.zip cpython-7726ac9163081a3730d30d4334135d6bf26900fc.tar.gz cpython-7726ac9163081a3730d30d4334135d6bf26900fc.tar.bz2 |
#Issue 20456: Several improvements and bugfixes for Argument Clinic,
including correctly generating code for Clinic blocks inside C
preprocessor conditional blocks.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index fca852d..0646043f 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -2366,21 +2366,26 @@ class path_t_converter(CConverter): converter = 'path_converter' def converter_init(self, *, allow_fd=False, nullable=False): - def strify(value): - return str(int(bool(value))) - # right now path_t doesn't support default values. # to support a default value, you'll need to override initialize(). + if self.default is not unspecified: + fail("Can't specify a default to the path_t converter!") - assert self.default is unspecified + if self.c_default is not None: + fail("Can't specify a c_default to the path_t converter!") self.nullable = nullable self.allow_fd = allow_fd + def pre_render(self): + def strify(value): + return str(int(bool(value))) + + # add self.py_name here when merging with posixmodule conversion self.c_default = 'PATH_T_INITIALIZE("{}", {}, {})'.format( self.function.name, - strify(nullable), - strify(allow_fd), + strify(self.nullable), + strify(self.allow_fd), ) def cleanup(self): @@ -2397,7 +2402,7 @@ class dir_fd_converter(CConverter): [python start generated code]*/ -/*[python end generated code: output=da39a3ee5e6b4b0d input=d702d58a8469cc7d]*/ +/*[python end generated code: output=da39a3ee5e6b4b0d input=5c9f456f53244fc3]*/ /*[clinic input] @@ -11122,6 +11127,15 @@ posix_set_handle_inheritable(PyObject *self, PyObject *args) #endif /* MS_WINDOWS */ +/*[clinic input] +dump buffer +[clinic start generated code]*/ + +#ifndef OS_TTYNAME_METHODDEF + #define OS_TTYNAME_METHODDEF +#endif /* !defined(OS_TTYNAME_METHODDEF) */ +/*[clinic end generated code: output=5d071bbc8f49ea12 input=524ce2e021e4eba6]*/ + static PyMethodDef posix_methods[] = { |